Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have two virtual machines running on virtual box. The master has one interface(eth0) bridged to the host nic(eth0) and another one connected to the internal network(eth1). This acts as a gateway to the internal network. The second virtual machine is connected to the internal network only (using eth0).

I cant seem to access the internet from the second virtual machine nor can i do ping -I eth1 8.8.8.8 for example.

Here is the script i use to setup nat

iptables -A FORWARD -i eth1 -j ACCEPT
iptables -A FORWARD -o eth1 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT

I dont know what i am doing wrong please help.

Sources:

  1. http://linuxers.org/howto/how-set-nat-linux-using-iptables

  2. http://www.centos.org/docs/4/4.5/Security_Guide/s1-firewall-ipt-fwd.html

share|improve this question

migrated from serverfault.com Nov 14 '13 at 14:53

This question came from our site for professional system and network administrators.

    
What is the output of 'route -n'? –  ethrbunny Nov 14 '13 at 13:33
    
route -n is showing the gateway as 10.1.1.1 (which is correct). I can ping both the interfaces on master (10.1.1.1 and 192.168.1.45). I cant however ping the machine that is hosting the virtual machines (192.168.1.43) nor can i ping 8.8.8.8. Both result in ping returning destination host prohibited. –  qwrty Nov 15 '13 at 5:44
    
Hello, i disabled iptables on the server and rebooted the machine, ran the nat script posted above and everything works perfectly :) thanks for your help. –  qwrty Nov 15 '13 at 6:06
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.