Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #170943 > unrolled thread

QEMU accessing VLAN

Started byAndrew Wood <andrewjameswood@ymail.com>
First post2016-08-10 18:00 +0200
Last post2016-08-12 01:30 +0200
Articles 6 — 3 participants

Back to article view | Back to linux.debian.user


Contents

  QEMU accessing VLAN Andrew Wood <andrewjameswood@ymail.com> - 2016-08-10 18:00 +0200
    Re: QEMU accessing VLAN Igor Cicimov <icicimov@gmail.com> - 2016-08-11 14:50 +0200
      Re: QEMU accessing VLAN Andrew Wood <andrewjameswood@ymail.com> - 2016-08-11 17:10 +0200
        Re: QEMU accessing VLAN Dan Ritter <dsr@randomstring.org> - 2016-08-11 17:50 +0200
          Re: QEMU accessing VLAN Igor Cicimov <icicimov@gmail.com> - 2016-08-12 01:30 +0200
        Re: QEMU accessing VLAN Igor Cicimov <icicimov@gmail.com> - 2016-08-12 01:30 +0200

#170943 — QEMU accessing VLAN

FromAndrew Wood <andrewjameswood@ymail.com>
Date2016-08-10 18:00 +0200
SubjectQEMU accessing VLAN
Message-ID<s4E5c-6Zf-45@gated-at.bofh.it>
I've got a host with some QEMU virtual machines on it, the host did have 
just one IP address (untagged VLAN) on eth0, Ive now added a second IP 
on VLAN 2 (eth0.2). The host machine is working fine but a QEMU VM is 
not able to access anything on VLAN2.

Im using the default setup whereby QEMU provides NAT. Do I need to alter 
the VM config somehow. I was expecting it to pass packets up to the host 
and the host to recognise which interface it was for and route it out 
accordingly. Obviously Im  missing something. Can anyone advise me please?


Regards

Andrew

[toc] | [next] | [standalone]


#170964

FromIgor Cicimov <icicimov@gmail.com>
Date2016-08-11 14:50 +0200
Message-ID<s4XAS-3T5-21@gated-at.bofh.it>
In reply to#170943

[Multipart message — attachments visible in raw view] — view raw

On 11 Aug 2016 1:56 am, "Andrew Wood" <andrewjameswood@ymail.com> wrote:
>
> I've got a host with some QEMU virtual machines on it, the host did have
just one IP address (untagged VLAN) on eth0, Ive now added a second IP on
VLAN 2 (eth0.2). The host machine is working fine but a QEMU VM is not able
to access anything on VLAN2.
>
> Im using the default setup whereby QEMU provides NAT. Do I need to alter
the VM config somehow. I was expecting it to pass packets up to the host
and the host to recognise which interface it was for and route it out
accordingly. Obviously Im  missing something. Can anyone advise me please?
>
>
> Regards
>
> Andrew
>
What type of network card did you create the vm with? You need to use the
virtio virtual network interface in your vm configuration.

[toc] | [prev] | [next] | [standalone]


#170968

FromAndrew Wood <andrewjameswood@ymail.com>
Date2016-08-11 17:10 +0200
Message-ID<s4ZMm-5r3-23@gated-at.bofh.it>
In reply to#170964

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?

[toc] | [prev] | [next] | [standalone]


#170969

FromDan Ritter <dsr@randomstring.org>
Date2016-08-11 17:50 +0200
Message-ID<s50p3-5GR-7@gated-at.bofh.it>
In reply to#170968
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-

[toc] | [prev] | [next] | [standalone]


#171002

FromIgor Cicimov <icicimov@gmail.com>
Date2016-08-12 01:30 +0200
Message-ID<s57Ad-2eX-5@gated-at.bofh.it>
In reply to#170969

[Multipart message — attachments visible in raw view] — view raw

On 12 Aug 2016 1:46 am, "Dan Ritter" <dsr@randomstring.org> wrote:
>
> 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
>

Just a note here to avoid confusion, have in mind that qemu vlan, ie vlan=0
above, is *not* the same as 802.1q vlan's its just an internal qemu way for
traffic segmentation. Think OpenVswitch vlan tags if you want.

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

[toc] | [prev] | [next] | [standalone]


#171001

FromIgor Cicimov <icicimov@gmail.com>
Date2016-08-12 01:30 +0200
Message-ID<s57Ad-2eX-13@gated-at.bofh.it>
In reply to#170968

[Multipart message — attachments visible in raw view] — view raw

On 12 Aug 2016 1:08 am, "Andrew Wood" <andrewjameswood@ymail.com> 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 ?

Thats right. Also need vlan tagging enabled on the guest to be able to see
the vlan traffic, 802.1q module loaded etc. Create eth0 and eth0.2 on the
guest too.

Presumably using this I could give it a 'real' IP address on the network
rather than asking QEMU to do port forwarding?
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web