Finally I found the proper way to achieve question goal. It implies Linux bridging, because I wasn't able to solve the issue with libvirt networking.
Steps:
- Identify KVM VM interfaces. Probably interfaces names start with
vnet*
In this example vnet0
and vnet1
Create a Linux bridge with:
brctl addbr virbr1
Attach Physical interface and KVM VMs interfaces to new bridge:
WARNING: if you are connected to the physical server through the network (SSH, Telnet, etc.), you will lose connection. Use a terminal or an alternative method (like other interface with connectivity).
brctl addif virbr1 vnet0
brctl addif virbr1 vnet1
brctl addif virbr1 eth0
- Configure physical server interface not having assigned IP address:
In CentOS 6.5, edit file /etc/sysconfig/network-scripts/ifcfg-eth0
with these contents:
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
NAME=eth0
TYPE=Ethernet
IPV6INIT=no
USERCTL=no
- Configure physical server bridge to have IP address:
In CentOS 6.5, edit file /etc/sysconfig/network-scripts/ifcfg-virbr1
with these contents:
DEVICE=virbr1
BOOTPROTO=none
ONBOOT=yes
IPADDR=<physical_server_public_ip_address>
NETMASK=<physical_server_public_ip_netmask>
GATEWAY=<physical_server_gateway_ip_address>
NAME=virbr1
TYPE=Ethernet
IPV6INIT=no
USERCTL=no
NM_CONTROLLED=no
DNS1=<physical_server_primary_dns_server_ip_address>
DNS2=<physical_server_secondary_dns_server_ip_address>
- Restart physical server networking:
service network restart
NOTE: you should recover physical server networking connectivity (through the interface and the bridge)
- Configure network interface of the KVM VMs:
This depends on the OS of the VMs. Anyway it should include IP address, netmask and default gateway, at least. Obviously DNS servers will complete the configuration.
All these configurations are static and could be substituted by DHCP assignment. In this case, MAC addresses of the bridge and the KVM VM interfaces could be useful.