Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a server with a public IP in eth0 and routed network config.

I have created DomUs with private IPs (10.0.1.x) and they can ping Dom0 and other private IPs, however I want them to ping the outer world.

How can I achieve this?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

After some research, here are the commands to be executed on the Dom0. Replace $VIF_NAME with the virtual interface name of your Xen VM.

Add forwarding

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -o eth0 -i $VIF_NAME -j ACCEPT
iptables -A FORWARD -o $VIF_NAME -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT

Remove forwarding

IDS=$(iptables -L FORWARD -nv --line-numbers | grep "$VIF_NAME" | cut -d' ' -f1 | sort -r)
for id in $IDS; do
  iptables -D FORWARD $id
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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