Only Ubuntu PCs lost internet connection in my network. All my Windows PC could access the internet but Ubuntu PCs. If you have a similar circumstance and you have docker installed on Linux machine, docker might overwrite your Linux machine’s default gateway. Here is how to solve this problem.

At first, I checked the route table by route command.

route

If docker’s destination IP address (such as 172.17.0.0) is different from your default gateway’s IP address, you may need to set your default gateway manually in docker’s daemon.json file in /etc/dcoker/daemon.json.

The route command returned me the docker’s destination IP address.

Destination Gateway Genmask Flags Metric Ref Use Iface
172.17.0.0 0.0.0.0 255.255.255.0 U 0 0 0 docker0

So, I needed to set the default gateway IP address in daemon.json. Before editing daemon.json file, I backuped /etc/docker/daemon.json.

cp /etc/docker/daemon.json <backup directory path>

Edit /etc/docker/daemon.json

sudo vim /etc/docker/daemon.json

Add below to daemon.json

{
“bip”: “<your devault gateway>/24”
}

Reload netplan

sudo netplan apply

Restart docker

systemctl restart docker

If this does not fix the problem, you may want to modify daemon.json like below.


    “debug”: true, 
    “default-gateway”: “<your default gateway>” 

Reload netplan and restart docker again. I hope this help you!