VirtualBox: Guest gets no IP in bridged mode

5,546

2 possibilities here:

  1. You are trying to bridge to a WIFI adapter. That will not work because Virtualbox doesn't know it is wifi so it can't do WIFI authentication. NAT works in that case, because the host handles the WIFI connection and the NAT happens after that has been taken care of. You can still use your VM as a server while using NAT by setting up port-forwarding on the VirtualBox network configuration. Consult the VirtualBox manual on how to do that.

  2. If you are bridging to a normal LAN interface (not Wifi) it may be required to explicitly tell the VM that the connection is always connected. (The guest can't always tell if the cable is connected.) You can do this in the network settings panel of the VM configuration

Share:
5,546
3lokh
Author by

3lokh

.Net Application Developer

Updated on September 18, 2022

Comments

  • 3lokh
    3lokh over 1 year
    • Host OS: Mac
    • Guest OS:Cent OS
    • Virutalbox: Version 6.0.10 r132072 (Qt5.6.3)

    When I put the VM to bridged mode then the Guest VM won't have any ipv4 enter image description here

    The network to which the host machine is attached have a DHCP server from where host gets its DHCP ip.

    I'm trying to achieve is to access the website hosted on a webserver on guest VM from my Host VM. In the NAT mode I was not able to and that is why I switched to Bridge mode where both VM and Host is connected to same network.

  • Niloct
    Niloct over 4 years
    I changed the network to NAT and then the virtual machine got an IP which is not from my LAN subnet, is it possible to make it get a LAN IP so I can use its web service ?
  • Tonny
    Tonny over 4 years
    @Niloct I already explained that you will have to setup port-forwarding when using NAT. The ONLY way to get a normal LAN ip-address is to use bridged networking (which can’t be used with WiFi on the host.)
  • Niloct
    Niloct over 4 years
    Thanks for your patience. I actually don't need the host to access the VM, only network between VMs so the goal shifted a bit, but now both VMs get 10.0.2.15 and they are unaware of each other.
  • Niloct
    Niloct over 4 years
    Ah I did it :) Creating a named NAT small network for 10.0.0.0/8 and assigning the name to each VM did the trick. The other VM is a owasp VM image and it's complaining about the "serious security issue" running on NAT but that's a side effect not too important I guess.