0

Local Network = 192.168.100.0/24

Private Docker network = 172.18.0.0/16

Machine 1 = 192.168.100.5

Machine 2 = 192.168.100.7 , 172.18.0.1

Docker Container = 172.18.0.2

On Machine 1, I did

ip route add 172.18.0.0/16 via 192.168.100.7

On Machine 2, I already allowed port forwarding by uncommenting net.ipv4.ip_forward=1 in /etc/sysctl.conf

I even did ip masquerading,

sudo iptables -t nat -A POSTROUTING -s 172.18.0.0/16 -o eth0 -j MASQUERADE

But for some reason i cant ping the docker container from Machine 1 but i can ping Machine 1 from the docker container and i don't know why

If it helps, when creating the docker container, i used -p 2222:22 as i wanted to connect via ssh

Detra
  • 13
  • 2

0 Answers0