qemu-discuss
[Top][All Lists]
Advanced

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

Re: [Qemu-discuss] Getting tap networking working


From: Vlad Yasevich
Subject: Re: [Qemu-discuss] Getting tap networking working
Date: Thu, 05 Jun 2014 11:26:51 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 06/04/2014 07:22 PM, Dale R. Worley wrote:
> 
> 3) Setting a unique MAC address on the guest side of each VM's
> interface.  QEMU provides each virtual NIC with a MAC address (of
> course), but it is *not* taken from the MAC address of the tap device
> it is connected to.  If you don't specify it, every QEMU instance uses
> one default MAC for every guest NIC.  And the packets that go onto the
> bridge carry the MAC address of the virtual NIC, not that of the
> back-end tap device.  If two VMs use the same MAC address, packets
> can't be routed properly by the bridge.

Right, but you don't want to set the guest mac to be the same as
the mac of the tap device.  Linux bridge assumes that mac addresses of
the port device really belong to the bridge and will then pass
the packets to the bridge itself, instead of of other ports.

> 
> The recommendation is that you give each virtual NIC a unique MAC
> address starting with "52:54" (which is a locally-administered MAC
> address).
> 
> The front-end MAC address is set by the "mac" specification of the
> -device option.  (Beware that some documentation mistakenly says this
> is the "macaddr" specification!)
> 
> 4) Some documentation shows IPv4 packet forwarding being set on (by
> manipulating /proc/sys/net/ipv4/ip_forward).  This is *not* necessary.
> 
> Assembling all of this, the following instructions create a working
> network between two VMs:
> 
> $ brctl addbr br0
> $ brctl setfd br0 0
> $ ifconfig br0 up
> 
> $ ip tuntap add dev tap1 mode tap
> $ brctl addif br0 tap1
> $ ifconfig tap1 0.0.0.0 promisc up

Promisc is not needed since adding the device to
bridge will set promisc mode.  All you have to do is
bring the link up with
 $ ip link set tap1 up

> 
> $ ip tuntap add dev tap2 mode tap
> $ brctl addif br0 tap2
> $ ifconfig tap2 0.0.0.0 promisc up
> 
> $ systemctl stop firewalld

don't think this is needed either.

> 
> $ qemu-system-i386 -m 1G -machine accel=kvm -enable-kvm -name 'QEMU 1' 
> -no-reboot \
>       -drive file=linux.system.disk1,media=disk,index=0,snapshot=on \
>       -hdb linux.second.disk1 \
>       -netdev tap,id=eth,ifname=tap1,script=no,downscript=no \
>       -device e1000,netdev=eth,mac=52:54:00:00:00:01 &
> $ qemu-system-i386 -m 1G -machine accel=kvm -enable-kvm -name 'QEMU 2' 
> -no-reboot \
>       -drive file=linux.system.disk1,media=disk,index=0,snapshot=on \
>       -hdb linux.second.disk2 \
>       -netdev tap,id=eth,ifname=tap2,script=no,downscript=no \
>       -device e1000,netdev=eth,mac=52:54:00:00:00:02 &
> 
> In VM 1:
> $ ifconfig ens3 10.1.1.11 up
> In VM 2:
> $ ifconfig ens3 10.1.1.12 up
> 

Yep. This should work

-vlad
> Dale
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]