* [Qemu-devel] why mac addresses are different between inside and outside of vm
@ 2014-02-10 1:23 yue-kvm
2014-02-10 16:20 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: yue-kvm @ 2014-02-10 1:23 UTC (permalink / raw)
To: virt-maint, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 387 bytes --]
hi, all
nwfilter has many rules which depends on the mac of vm, but i find the mac address inside vm is different from mac outside of vm.
outside mac:
vnet0 Link encap:Ethernet HWaddr FE:54:00:71:15:7B ,
inside mac:
eth0 Link encap:Ethernet HWaddr 52:54:00:71:15:7B ,virtio
it looks like vnet* are always changed to start with FE, why?
where is the code to do this?
thanks very much.
[-- Attachment #2: Type: text/html, Size: 767 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] why mac addresses are different between inside and outside of vm
2014-02-10 1:23 [Qemu-devel] why mac addresses are different between inside and outside of vm yue-kvm
@ 2014-02-10 16:20 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2014-02-10 16:20 UTC (permalink / raw)
To: yue-kvm; +Cc: qemu-devel, virt-maint
On Mon, Feb 10, 2014 at 09:23:05AM +0800, yue-kvm wrote:
> nwfilter has many rules which depends on the mac of vm, but i find the mac address inside vm is different from mac outside of vm.
> outside mac:
> vnet0 Link encap:Ethernet HWaddr FE:54:00:71:15:7B ,
> inside mac:
> eth0 Link encap:Ethernet HWaddr 52:54:00:71:15:7B ,virtio
> it looks like vnet* are always changed to start with FE, why?
> where is the code to do this?
The reason for different addresses is that the host-side tap interface
is different from the guest-side NIC. They use different MAC addresses
so that ARP and everything else works correctly. See libvirt
src/util/virnetdevtap.c:virNetDevTapCreateInBridgePort().
Why 0xfe? Because the Linux bridge interface takes on the MAC address
of the (numerically) lowest MAC. Therefore, starting with 0xfe will
make sure the bridge gets the MAC of the physical interface (i.e. host
eth0). See Linux net/bridge/br_stp_if.c:br_stp_recalculate_bridge_id().
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-10 16:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-10 1:23 [Qemu-devel] why mac addresses are different between inside and outside of vm yue-kvm
2014-02-10 16:20 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).