You are not logged in.

#1 2021-01-06 17:43:51

mdeff
Member
Registered: 2016-08-22
Posts: 5

[SOLVED] ip route add discards IPv4 prefix

# ip -4 route add 1.2.3.4/32 dev eth0
# ip -4 route
1.2.3.4 dev eth0 scope link

On the other hand, for IPv6:

# ip -6 route add 1:2:3::4/32 dev eth0
# ip -6 route
1:2::/32 dev eth0 metric 1024 pref medium

Any idea why is the prefix discarded for IPv4?

Last edited by mdeff (2021-01-09 17:28:30)

Offline

#2 2021-01-07 16:38:14

rsmarples
Member
Registered: 2009-05-12
Posts: 257

Re: [SOLVED] ip route add discards IPv4 prefix

For IPv4 a /32 means there is no subnet because there are a maximum of 32 bits in the subnet so only the address is on the link.
Hence, scope link. The subnet isn't discarded as such, just described differently.

For IPv6 a /32 fits easily inside the maximum of 128 bits so you see a subnet.

Offline

#3 2021-01-09 17:28:12

mdeff
Member
Registered: 2016-08-22
Posts: 5

Re: [SOLVED] ip route add discards IPv4 prefix

You're right, thanks!

Offline

Board footer

Powered by FluxBB