LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   KVM guest with 2 network interfaces in diferrent VLANs (https://www.linuxquestions.org/questions/linux-networking-3/kvm-guest-with-2-network-interfaces-in-diferrent-vlans-4175510964/)

tklima 07-13-2014 08:32 AM

KVM guest with 2 network interfaces in diferrent VLANs
 
Hi all,

I would like to configure a guest VM which will have two network interfaces in different VLANs (106,711).

the host configuration looks as follows:
/etc/sysconfig/network-scripts/ifcfg-eth0 (connected to a trunk port)
Code:

DEVICE=eth0
BOOTPROTO=none
HWADDR=00:22:19:D4:25:A8
IPV6INIT=no
IPV6_AUTOCONF=no
ONBOOT=yes
TYPE=Ethernet

/etc/sysconfig/network-scripts/ifcfg-eth0.106
Code:

DEVICE=eth0.106
BOOTPROTO=none
HWADDR=00:22:19:D4:25:A8
ONBOOT=yes
TYPE=Ethernet
VLAN=yes


/etc/sysconfig/network-scripts/ifcfg-eth0.711
Code:

DEVICE=eth0.711
BOOTPROTO=none
HWADDR=00:22:19:D4:25:A8
ONBOOT=yes
TYPE=Ethernet
VLAN=yes

Then I added two bridges for both VLANs
Code:

brctl addbr br0
brctl addif br0 eth0.711
ifconfig br0 10.56.2.2 netmask 255.255.255.240 up
brctl addbr br1
brctl addif br1 eth0.106
ifconfig br1 10.238.22.8 netmask 255.255.255.0

and created two tap interfaces and added them to the corresponding bridges.
Code:

tunctl -b -u root
ifconfig tap0 up
brctl addif br0 tap0
tunctl -b -u root
ifconfig tap1 up
brctl addif br1 tap1

The brctl show command output looks fine:
Code:

brctl show
bridge name        bridge id                STP enabled        interfaces
br0                8000.002219d425a8        no                tap0
                                                        eth0.711
br1                8000.002219d425a8        no                tap1
                                                        eth0.106

The virtual machine is started
Code:

/usr/libexec/qemu-kvm -hda /data/disk.raw  -smp 2 -m 2G -net nic,macaddr=52:54:00:12:34:55 -net tap,ifname=tap0,script=no  -net nic,macaddr=52:54:00:12:34:75 -net tap,ifname=tap1,script=no
The guest has 2 interfaces (eth0=tap0,eth1=tap1)
The problem I have is that even though the tap1 interface is bridged to the VLAN 106 the eth1 interface in the guest still gets an IP address from the VLAN 711. Is my setup correct or am I missing anything?


I use CentOS 5.6 as the host system.

Thanks for your help

Tomas

T3RM1NVT0R 07-20-2014 02:26 PM

As you said that you are using CentOS as host I am assuming you are using libvirtd. Check network card settings in virt-manager for this guest for both the NIC, as you said that they should be pointing to different VLAN it should be configured at guest level accordingly in virt-manager.


All times are GMT -5. The time now is 04:17 PM.