[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: QEMU accessing VLAN



On Thu, Aug 11, 2016 at 04:08:35PM +0100, Andrew Wood wrote:
> 
> 
> On 11/08/16 13:47, Igor Cicimov wrote:
> > 
> > >
> > What type of network card did you create the vm with? You need to use
> > the virtio virtual network interface in your vm configuration.
> > 
> Thanks for your reply.  I wondered about that but the QEMU wiki doesnt seem
> to detail how to configure it to to what I want. I will need to specify more
> than just --net nic,model=virtio ? Presumably using this I could give it a
> 'real' IP address on the network rather than asking QEMU to do port
> forwarding?

In that case, you want to change your host computer's config:

Suppose that your main nic is eth0. Instead of

auto eth0
iface eth0 inet static
   address 10.1.7.57
   netmask 255.255.127.0
   gateway 10.1.0.1


you want to change that to

auto eth0

auto br0
iface br0 inet static
    address 10.1.7.57
    netmask 255.255.127.0
    gateway 10.1.0.1
    bridge_ports eth0 
    bridge_maxwait 1
    bridge_stp      on

And from then on, remember that br0 is your main nic, not eth0.

Now you can start your kvm/qemu with:

 -device virtio-net-pci,vlan=0,id=net0,mac=$MAC,bus=pci.0,addr=0x3

(remember to specify the MAC address, or use
livirtd/virt-manager to take care of setup details for you)

-dsr-


Reply to: