[libvirt-users] bridged networking using VLAN : guest with 2 NIC

Dan Sa dreamrider787 at gmail.com
Mon Oct 28 15:34:45 UTC 2013


hello all,

I have been trying to set-up bridged network with VLAN and not able to
succeed as many tutorials address only single NIC.

I am trying to setup 2 guests (backtrack instance) each guest has NIC1 and
NIC2. following is snippet for guest1

I am not able to get 192.168.0.2 address back on guest eth0.


VIRT-MANAGER  GUI :

guest1-lan details radio button

left side panel

NIC1 ------------------> Virtual Network Interface
                            Source Device : Virtual Network "default" NAT
                            Device Model : Hypervisor default
                             MAc Address : xxxxxxxxxxxxxx

NIC2 ------------------> Virtual Network Interface
                            Source Device : Specify Shared Device Name
                                        Bridge name : guest1-lan
                            Device Model : virto
                             MAc Address : xxxxxxxxxxxxxx

HOST MACHINE :

brctl show has br0 for bridge
and virbr0 with 192.168.122.x address (created by default virtual network
NAT)


 /etc/sysconfig/network-scripts/

1) Bridge BR0 (cat ifcfg-br0)

DEVICE="br0"
TYPE="Bridge"
ONBOOT="yes"
NM_CONTROLLED="no"
BOOTPROTO="static"
IPADDR="xx.xx.xx.xx"
NETMASK="255.255.254.0"
GATEWAY="xx.xx.xx.xx"
DNS1="x.y.z.s"
DNS2="x.y.q.s"

2) cat ifcfg-em1
NM_CONTROLLED="yes"
HWADDR="02:12D:E2:B1:32"
BOOTPROTO="static"
DEVICE="em1"
BRIDGE="br0"
ONBOOT="yes"

3) ifcfg-em2
NM_CONTROLLED="yes"
HWADDR="02:24:7e:d0:b1:42"
BOOTPROTO="static"
DEVICE="em2"
ONBOOT="yes"

4) THIS IS GUEST   (cat ifcfg-guest1-lan)
DEVICE=guest1-lan
TYPE=Bridge
ONBOOT=yes
BOOTPROTO=static
DELAY=1

5) GUEST VLAN (cat ifcfg-em2.620)

DEVICE=em2.620
VLAN=yes
ONBOOT=yes
BRIDGE=guest1-lan

BRCTL Show Command :

br0  8000.00237de0a132  no              em1
                                                       vnet0
guest1-lan 8000.00237de0a133   no    em2.620
virbr0        8000.5254003e19b3    yes  virbr0-nic


VIRSH :

virsh # net-list
Name                 State      Autostart
-----------------------------------------
guest1-lan           active     yes
default              active     yes


virsh # iface-list
Name                 State      MAC Address
--------------------------------------------
br0                  active     00:23:7d:e0:a1:32
guest1-lan       active     00:23:7d:e0:a1:33


iface-edit :

virsh # iface-edit guest1-lan

<interface type='bridge' name='guest1-lan'>
  <start mode='onboot'/>
  <bridge delay='1'>
    <interface type='vlan' name='em2.620'>
      <vlan tag='620'>
        <interface name='em2'/>
      </vlan>
    </interface>
  </bridge>
</interface>

------------------------------------------------------------------

/etc/libvirt/qemu/networks

cat guest1-lan.xml
<network>
  <name>guest1-lan</name>
  <uuid>a12747ec-21c9-0d21-ab06-064ba204bc52</uuid>
  <forward mode='bridge' dev="br0"/>
  <bridge name='guest1-lan' />
  <ip address='192.168.0.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.0.2' end='192.168.0.254' />
    </dhcp>
  </ip>
</network>


cat default.xml

<network>
  <name>default</name>
  <uuid>8778244b-1a0c-c15f-c348-26462a07a639</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' />
  <mac address='52:54:00:3E:19:B3'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
    </dhcp>
  </ip>
</network>

any guidance will be appriciated

regards
dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20131028/16adfaa3/attachment.htm>


More information about the libvirt-users mailing list