Docker-Swarm Join a docker-swarm from another subnet

0 votes

I have 4 virtual machines in the same subnet, which are part of a docker-swarm. Now I want connect another node (virtual machine), which is located in a different subnet.

How do i set an overlay network in docker that is able to handle such a connection?

Aug 22, 2018 in Docker by lina
• 8,220 points
2,060 views

1 answer to this question.

0 votes

You need the following ports open between your swarm nodes:

  • 2377/tcp: Swarm mode api
  • 7946/both: Overlay networking control
  • 4789/udp: Overlay networking data
  • protocol 50 for ipsec (secure option) of overlay networking

The following iptables commands can be used for this (you may want to limit the source host to only your other docker swarm nodes):

iptables -A INPUT -p tcp -m tcp --dport 2377 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 7946 -j ACCEPT
iptables -A INPUT -p tcp -m udp --dport 7946 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 4789 -j ACCEPT
iptables -A INPUT -p 50 -j ACCEPT

This needs to be configured on all of your swarm nodes if they have a restrictive host firewall, and on the network firewalls protecting your subnets.

answered Aug 22, 2018 by Nilesh
• 7,060 points

Related Questions In Docker

0 votes
2 answers
+1 vote
2 answers
+2 votes
1 answer
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria
3,925 views
0 votes
1 answer

Docker Swarm- Build image only when stack deployed from manager node

Use docker build to build the image. ...READ MORE

answered Aug 24, 2018 in Docker by Nilesh
• 7,060 points
1,287 views
0 votes
1 answer

Restore a docker swarm

If there is something wrong only with ...READ MORE

answered Aug 24, 2018 in Docker by Nilesh
• 7,060 points
930 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP