Home NetworkingThe Hidden Network Conflict: Finally Fixed!

The Hidden Network Conflict: Finally Fixed!

by Behrad
339 views

Remember my Hidden Network Conflict problem? Well… apparently it still remembered me! Last week I ran into the exact same issue and Docker network conflict again. This time I decided that deleting the conflicting network wasn’t enough: time to fix this once and for all!

Here We Go Again…

Back in March 2025, I wrote The Hidden Network Conflict: Update after discovering that Docker had automatically created a network overlapping with one of my actual network ranges. Due to that, some devices stopped working.

At the time, I already found that adjusting Docker’s default-address-pools could prevent this from happening again. But since everything was working and this was my live environment, I decided not to touch it. Yeah… you probably already know where this is going. 😉

Last week I ran into the same problem again! Instead of fixing only the conflicting network, I decided to spend a bit more time to fix this and also actually clean up my Docker networks!

Cleaning Up My Docker Networks

Before deciding which network Docker should use automatically, I started by checking the existing Docker networks and routes:

docker network ls
ip route | grep -E '172\.|192\.168'

It became clear that over time Docker had created several networks, including multiple 172.x.x.x/16 ranges and even a network inside 192.168.0.0/20. So a mixture of everything, so allowing Docker to freely pick ranges clearly wasn’t something I wanted anymore. I decided to separate everything into three parts:

192.168.178.0/24    Home LAN
172.16.x.0/24       Manually managed Docker networks
172.20.0.0/14       Automatically created Docker networks

I started with assigning individual /24 networks, only to realize that this was just an absolute overkill right before I was done!! I mean these container only need a few addresses, so even a /30 would have worked! But hey, I was already done, so I decided to stick with the /24! A standard /24 network being the industry standard kept my unconfirmed OCD away!

One Important Dependency

While moving everything around, I discovered another good reason not to blindly change Docker networks as Nginx Proxy Manager suddenly refused to start with:

nginx: [emerg] host not found in upstream "authelia"

NPM, Authelia and Redis were sharing the same Docker network, which allowed NPM to resolve authelia through Docker DNS. By separating them, I had accidentally broken that communication. I therefore created one shared network called Proxy-Auth:

Proxy-Auth:       172.16.16.0/24
Authelia:         172.16.16.2
Authelia-redis:   172.16.16.3
NPM:              172.16.16.4

After migrating them to Proxy-Auth, NPM and Authelia worked correctly again. Lesson learned: before removing a Docker network, check why containers are sharing it! 😉

Finally Limiting Docker’s Automatic Networks

Now for the actual permanent fix. I configured Docker to use a dedicated range whenever it automatically creates a network. My /etc/docker/daemon.json now contains:

sudo nano /etc/docker/daemon.json

{
  "default-address-pools": [
    {
      "base": "172.20.0.0/14",
      "size": 24
    }
  ]
}

Before restarting Docker, I validated the configuration with

sudo dockerd --validate --config-file=/etc/docker/daemon.json

Which returned that my configuration was OK! Now it was time for Docker restart:

sudo systemctl restart docker

And checked whether Docker picked up the new pool:

docker info | grep -A 5 "Default Address Pools"
Default Address Pools:
Base: 172.20.0.0/14, Size: 24

But configuration is one thing… I wanted to see it actually work:

docker network create test-auto-pool

Docker automatically assigned:

172.20.1.0/24

Yaaay! Exactly what I wanted. The test network could go again:

docker network rm test-auto-pool

This Time, Actually Fixed!

My Docker networking is now much more predictable. Manually managed networks live in 172.16.x.0/24, automatically generated networks come from 172.20.0.0/14, and my physical LAN remains safely separated at 192.168.178.0/24.

More importantly, Docker can no longer randomly pick a range which happens to overlap with one of the networks I actually need to reach. Funny enough, I already wrote about this solution in March 2025 but didn’t dare applying it because everything was working at the time.

Apparently I just needed the problem to bite me one more time before actually fixing it properly! 😉

Subscribe to Blog via email!

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

You may also like

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More