Unable to connect to outside via bridge network

Hey all,

I’m at my wits’ end with this issue and I’m hoping the community can help. I can run a container through the default host network just fine, but am unable to do so with the default bridge network. This is similar to the issue described at Docker bridge networking does not work in Ubuntu 22.04, but I am not running Netplan (as far as I can tell) so the solution described there doesn’t seem applicable. Here’s what I’ve done so far:

  • verify container gets IP
  • verify docker0 interface has the correct gateway IP for the bridge network
  • started busybox container to see if I can ping anything - I can ping my laptop’s IP address, but not the address of the router I am connected to

While poking at things, I did notice that my network interface (wlp2s0) doesn’t appear to be connected to the docker0 bridge as far as I can tell. Maybe I’m looking in the wrong spot, or maybe that’s perfectly normal - but it did jump out to me as odd.

In case it matters, I’m running Ubuntu 22.04 with the docker-ce package (5:24.0.7-1~ubuntu.22.04~jammy) installed from the Docker repos. Everything is up to date.

Hopefully someone with more expertise can point me in the right direction. :slight_smile: Thank you!

On a Desktop Linux the network is usually managed by the NetworkManager service which can automatically detect Wifi connections and you can connect to the wifi through the UI.

I personally never had any issues with netplan either, since I use it only on servers and I always add a specific interface to the config.

I guess you mean you don’t see in the interface list that one network is parent of the other. It doesn’t work that way. Docker will not reconfigure your existing interfaces. The traffic is routed to the LAN interface via iptables rules.

I remember that someone had this issue when there were multiple networks and the traffic was routed to the wrong interface which was not connected to the internet.

You could try some debugging. I wrote about some tips in my blogpost

Search for “tshark” and “tcpdump”.

One more thing just as an idea but unlikely cause. The nwtwork of LXD and Docker are not compatible so when you have LXD on a machine and you install Docker on the same machine i could break the network of LXD. I don’t think it would happen the other way around, but there could be something that changes iptables rules. Check if you have any firewalls confiured locally. Like UFW.

Thanks for your help! You got me headed in the right direction - it turns out that my workplace’s device policies are disabling IP forwarding, and that is what is breaking my Docker networking. It makes sense that stuff would break if that is disabled! With any luck I can get that policy disabled or something, but if not at least I know I can use the host network as a workaround.