centos 6.3 kvm external ip forwarding to guests

Posted by user1111702 on Server Fault See other posts from Server Fault or by user1111702
Published on 2012-09-07T14:00:17Z Indexed on 2012/09/07 15:40 UTC
Read the original article Hit count: 299

I have a centos 6.3 server with kvm installed. The server has 4 external ips and one NIC.

176.9.xxx.xx1
176.9.xxx.xx2
176.9.xxx.xx3
176.9.xxx.xx4

I use the following configuration

ifcfg-eth0 as slave to ifcfg-br0

the configuration in ifcfg-eth0 is

DEVICE=eth0
ONBOOT=yes
BRIDGE=br0
HWADDR=14:da:e9:b3:8b:99

and in the ifcfg-br0

DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
BROADCAST=176.9.xxx.xxx
IPADDR=176.9.xxx.xx1
NETMASK=255.255.255.0
SCOPE="peer 176.9.xxx.xxx"

and I have 3 more aliases for br0 , br0:1 to get the trafic from the second external ip

DEVICE=br0:1
IPADDR=176.9.xxx.xx2
NETMASK=255.255.255.248
ONBOOT=yes

br0:2 to get the trafic from the third external ip

DEVICE=br0:1
IPADDR=176.9.xxx.xx3
NETMASK=255.255.255.248
ONBOOT=yes

br0:3 to get the trafic from the second external ip

DEVICE=br0:1
IPADDR=176.9.xxx.xx4
NETMASK=255.255.255.248
ONBOOT=yes

The above settings work fine and I recieve the trafic from all the external ips. My problem is that I want to pass the trafic from external ip to specific virtual guest on my server. ie trafic that comes from 176.9.xxx.xxx2 must pass to virtual machine 1 176.9.xxx.xxx3 must pass to virtual machine 2 176.9.xxx.xxx4 must pass to virtual machine 3

Can you please help me how to achieve this ? What are the settings on the host and what should I do to the guests.

Thank you in advance

© Server Fault or respective owner

Related posts about centos

Related posts about iptables