I am running two Ubuntu Linux Guests on a Windows 7 Host.

I've set up Internal Networking between them. This all works fine if I let 
VirtualBox pick and use the MACs on the virtual interfaces.

But in my case my Linux Guests set the Hardware MAC address on the virtual 
interfaces.

The first Linux Guest (call it A) has the NIC configured as follows:

NIC 2: MAC: 080027823BE6, Attachment: Internal Network 'intnet1', Cable 
connected: on, Trace: on (file: foobar.pcap
), Type: virtio, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: 
allow-all, Bandwidth group: none

The second Linux Guest (call it B) has the NIC configured as follows:

NIC 2: MAC: 0800278B0F78, Attachment: Internal Network 'intnet1', Cable 
connected: on, Trace: on (
p), Type: virtio, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: 
allow-all, Bandwidth group: none

In other words I'm using "virtio" and I've configured the promiscuous policy to 
"Allow All". (Allow VMs doesn't work either).

I set up IP addresses in this interface (it's called "eth1" in each of the 
Linux systems). As I said for reasons that I don't have to go into here the 
Linux system wants to set its own MAC on the interface. So for purposes of this 
discussion call it MACA on system A and MACB on system B.

This is done from my Linux guest system using the ioctl() SIOCSIFHWADDR. 
Specifically:


    if (ioctl(sock, SIOCSIFHWADDR, &ifr) < 0) {
        VLOG_ERR("netdev_set_macaddr (%s) MAC (%s) ioctl failed '%s'\n",
                  intf, macaddr, strerror(errno));


What I'm finding is that once this is done indeed the guest is now sending 
packets with an SRCMAC of the specified MAC

If I now ping from system A to system B here is what happens.

System A sends a Broadcast ARP to resolve the MAC address for B. This packet is 
received by system B and of course a UNICAST reply is sent back with the 
resolution for MAC B.

System B then sends a unicast ARP packet (source MACB dest MACA) asking for the 
resolution of systemA's MAC.

The pcap trace file I've put on System B's NIC (foobar2.pcap) shows all of 
these packets. But the pcap trace file on system A (foobar.pcap) only shows the 
original ARP broadcast packet from system A to system B. It does NOT show 
either of the Unicast replies. So of course they don't make it into the System 
A Libux system and hence the ping doesn't work.

This is the behavior I'd expect had I not set promiscuous mode on the virtual 
NICs inside VirtualBox. But I have set promiscuous mode and I cannot understand 
why it is not working.

Various web searches led me to one post that said that PROMISC mode in 
VirtualBox has no effect unless the guest has set the interface into 
promiscuous mode. Indeed I found this to be true. Once I set promiscuous mode 
on the guest the Unicast packets got through.

But this isn't really the essence of my question. I would have expected that 
setting the MAC address from the guest would CHANGEW the MAC address inside 
VirtualBox. It appears that it doesn't. Using VBoxManage shows that VirtualBox 
still thinks that the MAC is the original MAC that was set by VirtualBox. This 
is no doubt the reason why Unicast packets with a MACDA of MACA are not 
delivered to guest system A. Inside VirtualBox it no doubt still considers the 
MAC to address to be the original MAC address.

What I've also found is weird is that if I "reboot" the guest by typing reboot 
the guest comes up thinking the MAC is MACA, i.e. the MAC that got set on the 
last run NOT the MAC that VirtualBox has internally. If instead I power off the 
guest or do a shutdown when it comes up again it comes up with a MAC of theMAC 
that VirtyalBox says it has.

This says to me that VirtualBox is keeping the programmed MAC inside its 
simulated PCI through a guest reboot but that when the guest is powered off or 
shutdown this simulated PCI is also getting reset.

But in NEITHER case is VirtualBox truly using the programmed MAC. I'm trying to 
understand if this is the desired behaviour for VirtualBox and if so why. Why 
can't I program the MAC and have it used? If I could I'd expect I wouldn't even 
need to set Promiscuous Mode inside VirtualBox.

I've tried looking at the code but got rather lost. The best I can come up with 
is that programming of the virtual hardware in the host is not being read by 
the host driver inside VirtualBox when the guest programs the MAC value.

Any comments would be most appreciated.

Thanks,

Dave

PS I put an earlier version of this question in one of the forums. 
https://forums.virtualbox.org/viewtopic.php?f=6&t=79239, but I didn't get any 
replies hence the real question here.


________________________________

DISCLAIMER:
This e-mail and any attachments to it may contain confidential and proprietary 
material and is solely for the use of the intended recipient. Any review, use, 
disclosure, distribution or copying of this transmittal is prohibited except by 
or on behalf of the intended recipient. If you have received this transmittal 
in error, please notify the sender and destroy this e-mail and any attachments 
and all copies, whether electronic or printed.
_______________________________________________
vbox-dev mailing list
vbox-dev@virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Reply via email to