Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Does the routing order matter:

> route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
123.x.x.151     0.0.0.0         255.255.255.255 UH    0      0        0 vmbr0
123.x.x.154     0.0.0.0         255.255.255.255 UH    0      0        0 vmbr0
123.x.x.128     0.0.0.0         255.255.255.224 U     0      0        0 vmbr0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 vmbr1
0.0.0.0         123.x.x.129     0.0.0.0         UG    0      0        0 vmbr0

is it the same as:

> route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
123.x.x.128     0.0.0.0         255.255.255.224 U     0      0        0 vmbr0
123.x.x.151     0.0.0.0         255.255.255.255 UH    0      0        0 vmbr0
123.x.x.154     0.0.0.0         255.255.255.255 UH    0      0        0 vmbr0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 vmbr1
0.0.0.0         123.x.x.129     0.0.0.0         UG    0      0        0 vmbr0

?

where the difference is, that

123.x.x.128     123.x.x.129         255.255.255.224 U     0      0        0 vmbr0

is higher order than

123.x.x.151     0.0.0.0         255.255.255.255 UH    0      0        0 vmbr0

so if I send to 123.x.x.151 where will it go:

- the routed way over `123.x.x.129`, because it matches the `123.x.x.128` rule, or
- the direct way using the arp table, because it matches the `123.x.x.151` rule

?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

The order in the table doesn't matter; routes with a longer prefix always take priority. If you stop clinging to netmasks and consider the prefix lengths instead (which ip route shows), you have 123.x.x.128/27 and 123.x.x.151/32, and the latter – more specific – route will take priority over the former (more generic one).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.