centos 6.3 kvm external ip forwarding to guests

user1111702 asked:

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

My answer:


You are using a bridge, not routing. Don’t configure the IP addresses on your host machine if you want to use them in the guests. You should not have br0:0 and the rest of them.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.