1

I have a raspberry pi running raspbian and I want to use it as a wired router (DHCP server on eth0 and DHCP client on wlan0). It starts to work but I have a problem that I can't fix. My routing table get broken at regular intervals.

When booting, I have:

pi@raspberrypi:~ $ ip route show
default via 192.168.20.254 dev eth0 src 192.168.20.254 metric 202 
default via 192.168.0.1 dev wlan0 proto dhcp src 192.168.0.31 metric 303 
192.168.0.0/24 dev wlan0 proto dhcp scope link src 192.168.0.31 metric 303 
192.168.20.0/24 dev eth0 proto dhcp scope link src 192.168.20.254 metric 202 

I fix it with:

pi@raspberrypi:~ $ sudo ip route delete default via 192.168.20.254 dev eth0

and I get (which works well):

pi@raspberrypi:~ $ ip route show
default via 192.168.0.1 dev wlan0 proto dhcp src 192.168.0.31 metric 303 
192.168.0.0/24 dev wlan0 proto dhcp scope link src 192.168.0.31 metric 303 
192.168.20.0/24 dev eth0 proto dhcp scope link src 192.168.20.254 metric 202

But after a while (and after reboot) it returns to its previous state.

/etc/dhcpcd.conf is configured like this:

hostname

clientid

persistent

option rapid_commit

option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option interface_mtu

require dhcp_server_identifier

slaac private

interface eth0
static ip_address=192.168.20.254/24
static routers=192.168.20.254
static domain_name_servers=208.67.222.222 207.67.220.220

/etc/network/interfaces/ is basically empty.

I have read through a lot of articles but I can't find one that answers my request. Thank you !

1 Answer 1

1

Dhcpd is adding the problem route because you have told it to do that.

Remove the line

static routers=192.168.20.254

and your problem should go away.

1
  • I suspected than it was reappearing due to the DHCP lease renewal. Thank you !
    – Jona
    Commented Aug 21, 2020 at 12:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .