4

I am trying to configure a private network for use with my Xen VMs, in addition to the public network in use by another of the VMs (VM1, which has its own public IP).

So far, I have the public side working perfectly with a bridged network...

On the host machine:

eth0: 91.x.x.1, gateway: 91.x.x.254
xenbr0: bridged with eth0
VM1 connected to xenbr0, with a new IP address, 91.x.x.2, and gateway 91.x.x.254

On the host machine, I've also created a private dummy ethernet port:

dummy0: 192.168.1.1

and a bridge via XenServer, pdummy0 (using these instructions http://tipstricks.itmatrix.eu/?p=681)

Everything's working there, as well - the two VMs connected to the bridge can ping each other, as well as the host machine via the private 192.168.1.1 IP.

VM2: 192.168.1.2
VM3: 192.168.1.3

The last step here, is to have each of those VMs (VM2 & VM3) to be able to see the internet... What routes / IP forwarding do I need to set up to make that happen?

Sample route from VM2, /sbin/route:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0   *               255.255.255.0   U     0      0        0 eth0
1

enable packet forwarding on your host.

# /sbin/sysctl -w net.ipv4.ip_forward=1

then add forwarding rules on your host iptables rules

# iptables -A FORWARD -s 192.168.1.0/24 -d 91.x.x.1/24 -j ACCEPT
# iptables -A FORWARD -s 91.x.x.1/24 -d 192.168.1.0/24 -j ACCEPT

add static routes in your router via console or webui.

#ip route add 192.168.1.0/24 via 91.x.x.1 

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.