Tuesday, April 21, 2020

Routing to vagrant VM.

Newbie to networking here. I have vagrant VM running with docker installed and I need to ping the containers from the host machine(mac). I have the following route table in my mac.

Routing tables

Internet: Destination Gateway Flags Refs Use Netif Expire default 192.168.8.1 UGSc 91 3 en0 127 127.0.0.1 UCS 0 0 lo0 127.0.0.1 127.0.0.1 UH 5 36653 lo0 169.254 link#15 UCS 1 0 en0 ! 172.30.1/24 link#21 UC 2 0 vboxnet ! 172.30.1.1 a:0:27:0:0:1 UHLWIi 1 10 lo0 172.30.1.5 8:0:27:13:d9:12 UHLWI 0 17 vboxnet 204 192.168.8 link#15 UCS 0 0 en0 ! 192.168.8.1/32 link#15 UCS 2 0 en0 ! 192.168.8.1 ec:89:14:2a:64:1e UHLWIir 33 336 en0 1194 192.168.8.100/32 link#15 UCS 0 0 en0 ! 192.168.100 link#20 UC 1 0 vboxnet ! 192.168.100.1 a:0:27:0:0:0 UHLWIi 1 12 lo0 224.0.0/4 link#15 UmCS 2 0 en0 ! 224.0.0.251 1:0:5e:0:0:fb UHmLWI 0 0 en0 239.255.255.250 1:0:5e:7f:ff:fa UHmLWI 0 84 en0 255.255.255.255/32 link#15 UCS 0 0 en0 !

Following is the routing table of my VM

vagrant@vagrant:/$ route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default _gateway 0.0.0.0 UG 100 0 0 eth0 10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 _gateway 0.0.0.0 255.255.255.255 UH 100 0 0 eth0 172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0 172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker_gwbridge 172.30.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1

172.30.1.5 is the IP address of the Vagrant VM and the 172.17.0.2 is the IP address of the Docker container that's inside the VM. How do I do that?



No comments:

Post a Comment