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

Prevent dhcpcd from setting default route


I’m trying to configure my server with two gateways: enp5s0 through 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
enp9s0: probing address
enp9s0: leased for 14400 seconds
enp9s0: adding route to
enp9s0: adding default route via
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.


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