Home | News | Download | Packages | Forum | Wiki | Github

Prevent dhcpcd from setting default route


#1

I’m trying to configure my server with two gateways: enp5s0 through 192.168.1.1 and enp5s0 with dhcp from another ISP.

Can’t seem to configure this through the use of /etc/sv/dhcpcd-eth0/run, so I’m trying to do it manually in /etc/rc.local.
In /etc/rc.local, after setting ip addr and routes for enp5s0, I have to ask dhcpcd for enps90:

dhcpcd -B enp9s0

DUID 00:01:00:01:1f:f5:…
enp9s0: IAID 9…
enp9s0: soliciting an IPv6 router
enp9s0: rebinding lease of 39.53.131.237
enp9s0: probing address 39.53.131.237/23
enp9s0: leased 39.53.131.237 for 14400 seconds
enp9s0: adding route to 39.53.130.0/23
enp9s0: adding default route via 39.53.131.254
enp9s0: no IPv6 Routers available

How can I prevent dhcpcd from setting routes? I want to manually add them later for a second routing table.

Or, if possible, how to set it up automatically for both interfaces?


(Masato the Empty) #2

man dhcpcd.conf
search for the “nogateway” option. That should do what you want.


#3

I was there (at the man) for some times but didn’t see it. Thanks, that part’s solved now.