I want to remove a default route from my Raspberry Pi running Raspbian.

This is what I get from route -n:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    203    0        0 eth1     U     204    0        0 docker0     U     206    0        0 veth07ba603     U     0      0        0 docker0   U     203    0        0 eth1

I tried the following commands to remove the gateway:

ip route del default via dev eth1
route del default gw
route del default gw dev eth1
route del -net gw netmask dev eth1
ip route del

None of them works.

If I run route -n again the route is still there and I can still reach the internet.

Syslog looks fine too:

Dec  3 02:42:21 pi dhcpcd[474]: eth1: deleted default route via


I figured out that the issue only appears if I run a docker container, e.g:

docker run --name 'foo' -itd alpine /bin/sh

If the container is turned off, I can delete the gateway. But for some reason docker re-creates the default gateway if I start the container with docker start foo. If the container is running, I cannot delete the gateway at all (see above).

Does anyone know what's happening here? How can I run the container without the default gateway? The Pi should not have an internet connection.

  • It looks like you have the correct syntax. What output are you getting from these commands? And what other routes are in your route table?
    – igal
    Dec 2, 2017 at 23:08
  • The commands return nothing, like as if they were successful. I updated the table.
    – Rotareti
    Dec 2, 2017 at 23:13
  • Weird. How did you add the default route to begin with?
    – igal
    Dec 2, 2017 at 23:16
  • route add default gw
    – Rotareti
    Dec 2, 2017 at 23:17
  • My next question was going to be if you have Network Manager running on this system or if this route was getting set in some configuration file, but if you're setting it manually then I'm pretty confused by this situation.
    – igal
    Dec 2, 2017 at 23:25

1 Answer 1


The solution was to assign a static ip to the Pi by adding the following lines to /etc/dhcpcd.conf:

interface eth1
static ip_address=

I can now add and del the default gateway like expected, no matter if the docker container is running or not.

You must log in to answer this question.

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