I have one VM of having IP :10.0.102.166
Another VM of having IP:10.0.102.106(Container HOST Machine)
So My requirement is to ping the container from 10.0.102.166
now In 10.0.102.106 I have created one container.so there one Virtual Ethernet interface is created and docker0 interface is created
docker0 Link encap:Ethernet HWaddr 02:42:3a:fd:9a:a7
inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
veth374a4ce Link encap:Ethernet HWaddr e2:e0:e4:f5:68:b7
inet addr:10.0.2.3 Bcast:10.255.255.255 Mask:255.0.0.0
(So By default veth374a4ce does not have any IP.I have assigned an IP with this interface)
and the container IP is 172.17.0.2 with eth0 interface.
eth0 Link encap:Ethernet HWaddr 02:42:ac:11:00:02
inet addr:172.17.0.2 Bcast:0.0.0.0 Mask:255.255.0.0
As we know that veth374a4ce and eth0 is act as two side of pipe in between Container Host and Container.
So if we want to communicate with any specific container we have to talk through that specific veth interface.
So on container host side----
- I have created one custom routing table
echo 200 custom >> /etc/iproute2/rt_tables
2.I have added rule for that routing table
ip rule add from 10.0.102.166 lookup custom
ip route add default via 10.0.2.3 dev veth374a4ce table custom
But I am not able to ping from 10.0.102.166 to container
Can anyone please help here.
Thanks in Advance!