Re: Option 121 Classless Static Routes
Roy Marples
Thu Apr 05 13:31:06 2018
On 05/04/18 08:50, Roy Marples wrote:
Hi Paul
On 04/04/2018 23:49, Walrath, Paul wrote:
In the 7.0.0-rc2 release notes you list “dhcp: fixed classless static
routes”. Do you remember what was fixed? I am using version 6.9.1G.
In this version, not all of the routes in Option 121 seem to end up in
the routing table.
As a test, I had my DHCPv4 server send Option 121 as follows
(Wireshark trace):
Option: (121) Classless Static Route
Length: 36
192.168.10.0/24-192.168.10.1
192.168.10.1/32-0.0.0.0
192.168.20.0/24-192.168.20.1
192.168.20.1/32-0.0.0.0
default-192.168.2.2
default-192.168.2.3
default-192.168.2.4
default-192.168.2.5
The extra default gateways are there just to see what dhcpcd would do
with them.
Wow! That's complex. I've never tested beyond a simple setup.
I'll do similar on my server and see what happens.
The dhcpcd client added the following routes to the routing table:
Destination/Gateway/Genmask
0.0.0.0/192.168.2.2/0.0.0.0
192.168.2.2/0.0.0.0/255.255.255.255
192.168.10.1/0.0.0.0/255.255.255.255
192.168.20.1/0.0.0.0/255.255.255.255
Shouldn’t the following routes also have been added?
192.168.10.0/255.255.255.0/192.168.10.1
192.168.20.0/255.255.255.0/192.168.20.1
Is this what was fixed in 7.0.0-rc2?
No, I'm pretty sure it wasn't that. The fix is here:
https://roy.marples.name/git/dhcpcd.git/commit/?id=510c760cb24ef4b1b16cc14732c5ffe0fbb0d96d
Also, it won't apply to dhcpcd-6 because one of the goals in dhcpcd-7
was to move to a protcol agnostic routing setup which means a lot less
code to maintain.
I'll try and test with dhcpcd-7 tonight as I have my kids birthday party
all day today.
And the result with dhcpcd-7.0.2:
wlp6s0: adding IP address 10.73.2.30/24 broadcast 10.73.2.255
wlp6s0: using Classless Static Routes
wlp6s0: router 192.168.2.2 requires a host route
wlp6s0: adding route to 10.73.2.0/24
wlp6s0: adding host route to 192.168.10.1
wlp6s0: adding route to 192.168.10.0/24 via 192.168.10.1
wlp6s0: adding host route to 192.168.20.1
wlp6s0: adding route to 192.168.20.0/24 via 192.168.20.1
wlp6s0: adding route to 192.168.2.2/32
wlp6s0: adding default route via 192.168.2.2
Notice I swapped the routes a bit so the host route to the router
appears before the subnet route via it.
For more than once default router, dhcpcd will always make sure it works
even if it needs to add a host route for it. I just added a cosmetic fix
so it's reported correctly like so:
wlp6s0: using Classless Static Routes
wlp6s0: router 192.168.2.2 requires a host route
wlp6s0: adding route to 10.73.2.0/24
wlp6s0: adding host route to 192.168.10.1
wlp6s0: adding route to 192.168.10.0/24 via 192.168.10.1
wlp6s0: adding host route to 192.168.20.1
wlp6s0: adding route to 192.168.20.0/24 via 192.168.20.1
wlp6s0: adding host route to 192.168.2.2 <--- fix is here
wlp6s0: adding default route via 192.168.2.2
And here's the routing table:
$ ip r
default via 192.168.2.2 dev wlp6s0 proto dhcp src 10.73.2.30 metric 303
10.73.2.0/24 dev wlp6s0 proto dhcp scope link src 10.73.2.30 metric 303
192.168.2.2 dev wlp6s0 scope link src 10.73.2.30 metric 303
192.168.10.0/24 via 192.168.10.1 dev wlp6s0 proto dhcp src 10.73.2.30
metric 303
192.168.10.1 dev wlp6s0 proto dhcp scope link src 10.73.2.30 metric 303
192.168.20.0/24 via 192.168.20.1 dev wlp6s0 proto dhcp src 10.73.2.30
metric 303
192.168.20.1 dev wlp6s0 proto dhcp scope link src 10.73.2.30 metric 303
Roy
Archive administrator: postmaster@marples.name