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
PING ( 56(84) bytes of data.
64 bytes from icmp_req=1 ttl=64 time=0.036 ms
64 bytes from icmp_req=2 ttl=64 time=0.039 ms
64 bytes from icmp_req=3 ttl=64 time=0.037 ms
--- 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
exited from CT 112

Trying to ping from the host to the container does not work:

root@c1313s02:~# ping -c 3 
PING ( 56(84) bytes of data.

--- 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= DST= 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?

  • We can't guess what iptables rules already exist on your rig, post them for relevant tables (iptables -nvL -t <nat|filter>). – Xavier Lucas Mar 25 '15 at 11:33
  • @XavierLucas, I found the solution after carefully reading what my IPTables is doing – Oz123 Mar 26 '15 at 9:04

I found out the the proxmox server create a device called venet0. So now my IPtables look like this:

$IPT -A INPUT -i venet0

Now I can ping from the container to the VZ hosts and vice versa.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.