I have a host with multiple containers. I would to ping from the host to container, and vice versa. Currently ping works only from inside a container to the host, e.g.:
root@c1313s02:~# vzctl enter 112 entered into CT 112 root@orbit:/# ping 192.168.1.21 PING 192.168.1.21 (192.168.1.21) 56(84) bytes of data. 64 bytes from 192.168.1.21: icmp_req=1 ttl=64 time=0.036 ms 64 bytes from 192.168.1.21: icmp_req=2 ttl=64 time=0.039 ms 64 bytes from 192.168.1.21: icmp_req=3 ttl=64 time=0.037 ms ^C --- 192.168.1.21 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 1999ms rtt min/avg/max/mdev = 0.036/0.037/0.039/0.005 ms root@orbit:/# exit logout exited from CT 112
Trying to ping from the host to the container does not work:
root@c1313s02:~# ping -c 3 192.168.1.13 PING 192.168.1.13 (192.168.1.13) 56(84) bytes of data. --- 192.168.1.13 ping statistics --- 3 packets transmitted, 0 received, 100% packet loss, time 1999ms
Sometime the IPTables log will show:
Mar 25 11:11:13 c1313s02 kernel: IN=venet0 OUT= MAC= SRC=192.168.1.13 DST=192.168.1.21 LEN=84 TOS=0x00 PREC=0x00 TTL=64 ID=1977 PROTO=ICMP TYPE=0 CODE=0 ID=64315 SEQ=18
How can I update my IPTables rules to allow ping from the Host to the container?