I have an Ubuntu host with two ethernet interfaces, one connected to the internet, the other connected to a Raspberri Pi.
Goal: reach the Raspberri Pi from my container (ssh 169.254.1.25
). I can not use Docker’s host network because it conflicts with other requirements I have.
These are the relevant IPs I am testing:
192.168.178.1
my router in the WLAN192.168.178.155
my host in my WLAN169.254.1.25
my Raspberri Pi connected to an ethernet interface in the linux host169.254.1.100
: the second eth interface in my host (the one connected to the Raspberri pi)8.8.8.8
: a known internet host172.70.0.1
: docker0 on the host (bridge created by docker)172.70.0.2
: veth on the container (created by docker)
The Ubuntu host can ping everything:
- my router (
192.168.178.1
) - itself (both
169.254.1.100
and192.168.178.155
) - the Raspberri Pi (
169.254.1.25
) - the
8.8.8.8
My docker container, started in the default manner (Docker attaches the docker0
bridge), gets the following interfaces:
- eth0:
172.70.0.2
- lo:
127.0.0.1
The container can ping:
- itself (
127.0.0.1
and172.70.0.2
) - my router (
192.168.178.1
) - the docker0 bridge (
172.70.0.1
) - the host as seen on WLAN (
192.168.178.155
) - the
8.8.8.8
But it has trouble with:
- the host on the second eth interface (
192.168.178.155
) - the Raspberri Pi (
169.254.1.25
)
This is my routing table:
» ip route
default via 192.168.178.1 dev wlp2s0 proto dhcp metric 600
169.254.1.0/24 dev enx000ec6a42183 proto kernel scope link src 169.254.1.100 metric 100
172.70.0.0/24 dev docker0 proto kernel scope link src 172.70.0.1
192.168.178.0/24 dev wlp2s0 proto kernel scope link src 192.168.178.155 metric 600
IP forwarding is enabled on my host:
» sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
The host routing table clearly specifies what to do when it sees a packet with destination 169.254.1.x
: send it on the interface connect it to Raspberri Pi.
Why is it not working then? Routing is enabled!