0

I am running a docker swarm manager in VM Workstation 15 player with NAT(VM: Ubuntu 19.10, Host: Windows 10). I ran docker swarm init --advertise-addr 223.181.240.48:2377 on my mangager vm. Now i copied to the token and used it on my my other vm that is running on another node and another network with NAT. it returns the following error:

Error response from daemon: Timeout was reached before node joined. The attemp to join the swarm will continue in the background. Use the "docker info" command to see the current swarm status of your node.

Then i tried googling for error and got to know that the problem may arise due to firewall and i might have to unblock the port.Also, as i am using NAT, i have to either use automatic bridge or port forward.First, I tried using bride(in vm setting, i changed network to bridge), but when i tried "my ip",the results were same in both host machine and vm(223.181.240.48).So, i tried port forwarding with NAT,i went to C:/ProgramData/VMware/vmnetnat.conf and added the following line

[incomingtcp]
2377:192.168.172.2:2377

192.168.172.2 is my vm's net gateway address. Then i again ran the docker swarm command, copied to my other vm. Now, i got the following error:

Error response from daemon: rpc error: code =Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: Error while dialing dial tcp 233.181.240.48:2377: connect: connection refused"

Then i tried sudo ufw allow 2377/tcp to unblock port in vm. Then retried the whole procedure again. Now i am again receiving the timeout error. Did i miss something in the middle? or did something wrong? And what is the difference between the ip i receive through a "my ip " google search and the ipv4 i receive in wired connection setting(dhcp on).

Prem Ib
  • 136
  • 2
  • 11
  • I don't believe nodes communicating between each other through NAT is a supported configuration. The nodes need to be able to communicate between each other by IP address without a firewall over several ports. You'll need some kind of network between the nodes, perhaps a VPN like wireguard would work. – BMitch Mar 15 '20 at 11:32
  • @BMitch - "what is the difference between the ip i receive through a "my ip " google search and the ipv4 i receive in wired connection setting(dhcp on)." - i need some clarification here, i am extremely new to virtual machines and ubuntu. – Prem Ib Mar 15 '20 at 11:40
  • One is a public IP that others on the internet see your requests on, and the other is a private IP behind a NAT router that cannot be directly accessed. – BMitch Mar 15 '20 at 12:35
  • @BMitch So, how am i supposed to connect to my vm? which one should i use? – Prem Ib Mar 15 '20 at 13:33
  • You'll need some kind of network between the nodes, perhaps a VPN like wireguard would work. – BMitch Mar 15 '20 at 14:05
  • 1
    That seems to be wrong syntax for _vmnetnat.conf_. See [this answer](https://stackoverflow.com/questions/52386841/how-to-do-port-forwarding-on-vmware-player-14-1-2-ubuntu-18-04-guest-windows-1) for a working example . – David Balažic Jun 03 '20 at 15:18

0 Answers0