Re: how to configure to accept both additional static routes AND a default gateway
Bruce Ferrell
Sat Jun 13 06:50:16 2020
On 6/12/20 9:57 PM, Bruce Ferrell wrote:
On 6/12/20 12:44 AM, Roy Marples wrote:
Hi Bruce
On 12/06/2020 06:08, Bruce Ferrell wrote:
I have a number of Raspberry PIs in use and I'd long noticed that they didn't seem to get the default gateway sent by my DHCP server. I've been working around this but it has
finally become vexing enough that I spent some time searching and trying to find a configuration that would do the right thing. No dice.
That server is ISC DHCP Server 4.1.1-P1. The host for this dhcp server also hosts an openvpn server and the additional route is so that hosts on my internal network know how to
reach openvpn clients.
The Windows 7/8/10 dhcp client does the right thing... The OS X dhcp client does the right thing; sets the default gateway. Using wireshark, I can see both being sent from the
server. Other linux systems that use ISC DHCPD in client mode does the right thing (kind of a no brainer). Only DHCPCD fails to set the default gateway while setting the
static route for the vpn network.
Yes, I understand I can set a rule file on the individual endpoints or otherwise manually configure, but doesn't that sort of defeat the purpose of dhcp?
So... What IS the solution?
Can you share the wireshark trace please?
I suspect that you've setup one route using Classless Static Routes and the other using the Default Router option. dhcpcd does not allow both to be used at the same time as this
violates RFC 3442 under the DHCP Client Behavior section.
If my guess is correct you'll just need to set all the routes in the CSR.
Roy
Not even a guess on your part Roy... And thank you! I'll send the trace file separately if you still want it.
To get on record for others when they google this... And there are a LOT of questions on it, here's what I had to do to make things work correctly:
My DHCP server:
#option routers 192.0.2.135;
#option rfc3442-classless-routes code 121 = array of integer 8;
option classless-routes code 121 = array of integer 8;
#option rfc3442-classless-static-routes 32,0,0,0,0,129,0,2,135,24,192,168,22,192,0,2,135;
option classless-routes 32, 0,0,0,0, 192,0,2,135, 24, 192,168,22, 192,0,2,135;
NOTICE: just classless-routes, not rfc3422-classless-routes, but when the rfc3442 version was there, it still blocked setting the default route AND the static route was not set.
No change the on the PI/dhcpcd.conf:
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
No, I was wrong... That didn't work after all
It results in this route table:
netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.0.2.135 255.255.255.255 UGH 0 0 0 eth0
192.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.22.0 192.0.2.135 255.255.255.0 UG 0 0 0 eth0
instead of this:
0.0.0.0 192.0.2.135 0.0.0.0 UGH 0 0 0 eth0
192.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.22.0 192.0.2.135 255.255.255.0 UG 0 0 0 eth0
But this did:
option classless-routes 24, 192,168,22, 192,0,2,135, 0, 192,0,2,135;
netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.0.2.135 0.0.0.0 UG 0 0 0 eth0
192.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.22.0 192.0.2.135 255.255.255.0 UG 0 0 0 eth0
pi@raspberrypi:~ $ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=115 time=10.3 ms
^C
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 10.277/10.277/10.277/0.000 ms
Archive administrator: postmaster@marples.name