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

Configured Clear OS to be in Gateway mode on a machine with two NIC cards.

eth0: with ip which is connected to a modem and thus have internet connectivity.

eth1: with ip which is connected to other machines in LAN through switch.

LAN machines with network is not getting internet.How can they get internet Through Clear OS gateway.I have enabled packet forwarding in clear os using "ip_forward=1" What am i missing?.Can you please help me in this.

Following are the static routing i have added: on LAN machine1 with ip address

ip route add via dev eth0

ip route show via dev eth0 dev eth0  proto kernel  scope link  src

But still network is not reachable.Where can be the problem??

EDIT: All the machines are Virtual Machines running on xen.

Network is through Bridge network with host Ethernet card and network is through virtual bridge network with in VMs.

share|improve this question
You forgot to setup nat – user130370 Oct 11 '12 at 8:13
No requirement for nat between 2 private networks, Eric – symcbean Oct 11 '12 at 8:31
Have you checked your iptables rules? – symcbean Oct 11 '12 at 8:32
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT. iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT. But still Its not reachable. :( – Kevin Parker Oct 11 '12 at 8:34
Did you echo echo 1 > /proc/sys/net/ipv4/ip_forward and put net.ipv4.ip_forward = 1 into /etc/sysctl.conf? – Tom O'Connor Oct 11 '12 at 9:20

2 Answers 2

It worked on a real machine.i dont know why it didnt work on VM.But when i tried the same set up on real hardware it worked.Can some one please give me an explanation to this.?

share|improve this answer

If Xen has configured a bridge network to connect the VM guests to the hosts LAN interface, then the guests should not be in a separate IP subnet. A "bridge" connects two networks which are disjoint at the 'hardware' (i.e. Ethernet) level. In that case, all machines, virtual and physical, should have addresses in .

If, on the other hand, the physical LAN and virtual LAN are not bridged, then you will want separate IP subnets, with routing between them. NAT (on the Linux host) is optional, though it might be necessary if your Internet "modem" device is only expecting to provide access to one IP subnet. If you do things this way, then you will need to configure the guests to use as their default gateway.

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.