I want to remove a default route from my Raspberry Pi running Raspbian.
This is what I get from
Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.178.1 0.0.0.0 UG 203 0 0 eth1 169.254.0.0 0.0.0.0 255.255.0.0 U 204 0 0 docker0 169.254.0.0 0.0.0.0 255.255.0.0 U 206 0 0 veth07ba603 172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0 192.168.178.0 0.0.0.0 255.255.255.0 U 203 0 0 eth1
I tried the following commands to remove the gateway:
ip route del default via 192.168.178.1 dev eth1 route del default gw 192.168.178.1 route del default gw 192.168.178.1 dev eth1 route del -net 0.0.0.0 gw 192.168.178.1 netmask 0.0.0.0 dev eth1 ip route del 0.0.0.0/0
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: eth1: deleted default route via 192.168.178.1
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.