Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm currently running KVM on CentOS 6 server, and have bridged networking setup for the first subnet that's assigned to the server.

When I'm trying to use the other subnet, that's using a different gateway, would I need to create new br0 (br1) device for the VLAN or new eth0:1 connection ?

The subnet that's being used as the default would be: 77.XX.XX.9/29

And I have several assigned of the same block size: 216.XX.XX.143/29 216.XX.XX.182/29

Thank you!

share|improve this question

1 Answer 1

up vote 4 down vote accepted

You need to create an interface that's connected to the vlan (like "eth1.2102" for vlan 2102). Then you create a bridge ("br2102") that has the vlan interface as a member. You can use the /etc/sysconfig/network-scripts entries to do that, don't assign IPs to those interfaces. Then use the bridge interface in the qemu/kvm configration as the interface for the virtual machine.

Config example (Tested on Centos 6.0):

ifcfg-eth1:

DEVICE=eth1
BOOTPROTO=static
BROADCAST=0.0.0.0
HWADDR=00:15:17:dc:ff:ff # use your mac here
IPADDR=0.0.0.0
NETMASK=0.0.0.0
NETWORK=0.0.0.0
ONBOOT=yes
IPV6INIT=no
NOZEROCONF=yes
TYPE=Ethernet

ifcfg-eth1.2102:

VLAN=yes
DEVICE=eth1.2102
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
IPV6INIT=no
IPADDR=0.0.0.0
NETMASK=0.0.0.0
NETWORK=0.0.0.0
BRIDGE=br2102

ifcfg-br2102:

DEVICE=br2102
TYPE=Bridge
ONBOOT=yes
# BOOTPROTO=none
BOOTPROTO=static
IPADDR=
NETMASK=

"ifup br2102" should bring up all those interfaces. Be sure to have this 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

Troubleshooting: use "tcpdump -i eth1.2102 -n" and tcpdump -i br2102 -n" to see the traffic on those interfaces. "brctl show" is handy to see the bridge config with the virtual machine interface on the bridge added after startup. PXE booting has a problem, you need to interrupt at the PXE prompt for around 10 seconds before the interface is available. Otherwise the PXE rom doesn't get an IP.

share|improve this answer
    
Would you mind pasting a example brX and eth0.X scripts, so I can match the configuration (no KVM console on the server, so if I mess something up quite time might pass until it's restored). Thank you, you've confirmed my suspicions on the additional bridge interfaces. –  abiko Nov 17 '11 at 7:01
    
I've added some example scripts. If no kvm is available and you're not on the same subnet, you're of course in danger of losing the default route during network config. Maybe add a static host route in that case. –  AndreasM Nov 17 '11 at 7:37
    
Thank you for your help and examples, appreciated ! –  abiko Nov 17 '11 at 9:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.