VirtualBox - VM with bridged adapter can't access internet while host can

15,184

You currently have a sort-of useless network configuration:

Wi-Fi -----+
           +- Bridge (visible in Windows) -+
Host-only -+                               +- Bridge (invisible, managed by VirtualBox)
              Virtual machine -------------+

...where the Host-only network adapter isn’t really connected to anything. So first, delete the bridge that’s visible in this screenshot:

Then, go to the virtual machine settings again and select your WiFi adapter in the “Name:” dropdown:

Then, it may work. If VirtualBox is bridged to the bridge (heh), it cannot know the traffic is going over the air.

Why does it not work regularly? The OpenWrt wiki has a great page on client mode wireless with pictures and whatnot:

Problem using standard client mode

enter image description here

The 802.11 standard only uses three MAC addresses for frames transmitted between the Access Point and the Station. Frames transmitted from the Station to the AP don't include the ethernet source MAC of the requesting host and response frames are missing the destination ethernet MAC to address the target host behind the client bridge.

  1. Bridged Host sends a packet to the Target host
  2. Frame is relayed via the W-LAN Client and the MAC address of the transmitting wireless adapter is used as source MAC, the sending ethernet MAC is discarded
  3. W-LAN AP receives the frame and redirects it to the Target
  4. Target receives the frame and generates a response
  5. Target responds to the received frame using the (wrong) source MAC as destination
  6. W-LAN AP relays the frame to the W-LAN Client with the given destination MAC
  7. W-LAN Client receives the frame and assumes it is the final destination since it's wireless MAC is used in the frame, the packet is not forwarded
  8. Bridged Host never sees a response frame since the W-LAN Client became the destination, no connection is possible
Share:
15,184

Related videos on Youtube

UrbiJr
Author by

UrbiJr

I just need more time for coding :-)

Updated on September 18, 2022

Comments

  • UrbiJr
    UrbiJr over 1 year

    Here is the guest VM network config:
    Guest VM network configuration

    And here is the host's network config:
    Host network configuration

    The fact is that from the host, internet works perfectly. But from the guest I can't access Internet, nor ping the network hosts.

    My home network is behind a NAT, so from what I read on the internet the VM guest should appear with the same host's IP address on the gateway page, in fact:
    (I post this link in a comment because I can't add more than 2 links...)

    But I don't know why it's like the guest VM isn't connected to the bridge. Or the bridge is blocking its port. I don't know.

    ifconfig from VM guest:

    enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.3  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::23cd:b37e:da10:e228  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:6b:30:a4  txqueuelen 1000  (Ethernet)
        RX packets 124050  bytes 94769617 (94.7 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 61781  bytes 4156338 (4.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Loopback locale)
        RX packets 37824  bytes 2318361 (2.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 37824  bytes 2318361 (2.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    

    ipconfig from the host:

    Scheda Ethernet Bridge di rete:
    
    Suffisso DNS specifico per connessione: homenet.telecomitalia.it
    Indirizzo IPv6 locale rispetto al collegamento . : fe80::8df:11b2:77fb:fd3b%44
    Indirizzo IPv4. . . . . . . . . . . . : 192.168.1.3
    Subnet mask . . . . . . . . . . . . . : 255.255.255.0
    Gateway predefinito . . . . . . . . . : 192.168.1.1
    

    Any suggestions please? This is very important...

    • UrbiJr
      UrbiJr over 7 years
      i.stack.imgur.com/sxXb1.png (I can't access the gateway page from the guest VM)
    • Daniel B
      Daniel B over 7 years
      You're trying to bridge a wireless connection. This isn't possible without "MAC NAT". VirtualBox may be able to do it, but not with the virtual switch in the way.
    • UrbiJr
      UrbiJr over 7 years
      So what I have to do?
  • UrbiJr
    UrbiJr over 7 years
    now it works. But what I don't understand is that actually this is the previous network configuration I had... And that the following day stopped working. Let's see if this happens again, hoping not... For the moment, thank you