I've spent the last two days reading guides, looking for information, etc. on how to do this, and as of yet have had no luck - so decided I would come here and try asking the experts :)
First things first...
I have a Core i7 server running CentOS 5.4, with a custom kernel that I built, KVM is built-in, as is support for network bridges - I can not change the OS on this, as it is being used in production for other things.
I have successfully setup a CentOS VM, and can access this via virt-manager, but have not been able to get it to connect to the internet.
This is the end result that I need:
Host Server IP (static) = 188.165.xxx.xxx
VPS Server IP (static) = 178.32.xx.xxx
I beleive this is a correct network diagram:
HOST KVM GUEST
INTERNET ---+-eth0 | | 178.32.xx.xxx |
| | +-------+--+---+----- eth0 |
| | | vnet0 | | +---------------+
| | +-------+ |
| | | |
| +----br0 |
Internet <-> eth0 <-> br0 (188.165.xxx.xxx) <-> vnet0 <-> eth0 (178.32.xx.xxx)
Note: Any requests for the VPS IP (178.32.xx.xxx) are routed to the server IP (188.165.xxx.xxx), so I need to get the traffic sent both ways.
Right, now for what I have done:
1) Put the following in /etc/sysctl.conf
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
2) iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
3) created br0, which I attached to eth0 - br0 now has the static IP/gateway that were attached to eth0 originally - this bridge does work, and I can access the server via it.
4) ip route add 178.32.xx.xxx dev br0 (on the host)
route -v (on host): http://pastie.org/private/1s7oktkvxj1gfjted9oqw
5) Start KVM VPS via virt-manager assign IP on VPS (ifconfig eth0 178.32.xx.xxx/32 up)
6) ip route add default dev eth0 (on the VPS)
After doing this, I am able to ping the host from the VPS, and vice-versa.
However, I am not able to ping the VPS from the outside world, and I am not able to connect to the internet from the VPS.
If someone could point out what I am missing out here, or if I am doing something wrong it really would be very much appreciated.
For example, is vnet0 supposed to have an IP?