Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for specifying docker swarm subnet ranges #22

Closed
tomdaley92 opened this issue Jul 10, 2022 · 2 comments
Closed

Add support for specifying docker swarm subnet ranges #22

tomdaley92 opened this issue Jul 10, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@tomdaley92
Copy link
Member

tomdaley92 commented Jul 10, 2022

Ran into an issue IP conflict recently that took me 2 weeks to debug 馃槰 ... Only to find out that docker swarm creates overlay networks starting with the private class A subnet range 10.0.0.0/8 and goes up from there sequentially, per swarm.

Basically I was having issues with my pfSense OpenVPN connection that I set to subnet 10.0.0.0/24. Everything worked, except I was unable to load web pages served from docker swarm lol. Using docker network inspect ingress I found that swarm was setting the this network to 10.0.0.0/24 and any odditional overlay networks to 10.0.1.0/24, then 10.0.2.0/24, and so on...

Hopefully this helps someone out in the future, but figured I should just configure swarm to start the subnet ranges from something like 10.200.0.0/16 to reduce any conflicts in the future, as the 10.0.0.0/8 block is a popular choice for VLAN subnets.

@tomdaley92 tomdaley92 added the enhancement New feature or request label Jul 10, 2022
@tomdaley92 tomdaley92 self-assigned this Jul 10, 2022
@tomdaley92
Copy link
Member Author

When I "refresh" my VMs next, this will be a good time to do this, due to the fact that you can only change the subnet ranges during a docker swarm init.

@tomdaley92 tomdaley92 pinned this issue Jul 10, 2022
@tomdaley92
Copy link
Member Author

per docs this is acheived by creating the docker network before running docker swarm init

For example the order would be:

sudo apt install docker-ce
docker network create \
--subnet=10.200.0.0/16 \
--gateway 10.200.0.1 \
-o com.docker.network.bridge.enable_icc=false \
-o com.docker.network.bridge.name=docker_gwbridge \
-o com.docker.network.bridge.enable_ip_masquerade=true \
docker_gwbridge
docker swarm init

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant