Networking - Guest OS on Host network with own IP (not host)?

This is for discussing general topics about how to use VirtualBox.
Post Reply
mbellot
Posts: 2
Joined: 30. Jan 2024, 02:52

Networking - Guest OS on Host network with own IP (not host)?

Post by mbellot »

Greetings,

As outlined in the title, is it possible for a Virtualbox guest to be on the Host network as if it were another PC on the network with its own unique IP address, access to the internet and able to be accessed by any other PC on the local subnet?

I've tried the various connection types, bridged seems the closest except the guest shares the same IP address as the host.

The only solution I have found so far is to disable the network adapter in Vbox settings and use a USB WiFi adapter in the guest. Not really the solution I want since (ideally) I might want multiple guests running simultaneously, each with their own unique IP address on the local network.

Overly simplified drawing attached.
VBox-Network.JPG
VBox-Network.JPG (37.74 KiB) Viewed 3486 times
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Networking - Guest OS on Host network with own IP (not host)?

Post by scottgus1 »

Bridged is what you want: Virtualbox Networks: In Pictures: Bridged Adapter

However, this:
mbellot wrote: 30. Jan 2024, 03:11 bridged seems the closest except the guest shares the same IP address as the host.
indicates something is not set correctly.

Bridged VMs exist uniquely on the LAN, and when everything is by default, the VM gets a unique IP address from the network router just like the host and other LAN devices do.

A static IP address in the VM that is the same as the host's, or copying the host's MAC address into the VM's MAC address can cause identical IP addresses on the host and the VM. Neither of these are correct setups. Though an IP address can be static, care should be taken not to duplicate existing IP addresses, and the VM's MAC address should not be the same as the host's.

If neither of these solve your VM's IP address problem on Bridged, please provide the following:
  1. Right-click the VM in the main Virtualbox window's VM list, choose Show in Explorer/Finder/File Manager. Zip the VM's .vbox file (not the .vbox-prev file), and post the zip file, using the forum's Attachments tab. (Configure your host OS to show all extensions if the folder that opens does not show a .vbox file.)
     
  2. Start the VM from full normal shutdown, not save-state.
     
  3. In both host and VM OS's, run the correct command from the following in the Command Prompt or Terminal:

    Windows:
    ipconfig /all
    route print

    Linux:
    ifconfig or ip address
    route -n or ip route

    Mac OS:
    ifconfig
    netstat -rn

    Post the outputs, label which is which.
     
  4. In both host and VM OS's, ping 8.8.8.8. Post the outputs, label which is which.
     
  5. Shut down the VM from within the VM's OS if possible. If not possible, close the Virtualbox window for the VM with the Power Off option set.
     
  6. Right-click the VM in the main Virtualbox window's VM list, choose Show in Explorer/Finder/File Manager. In the "Logs" subfolder, zip the VM's "vbox.log", and post the zip file, using the forum's Attachments tab. (Configure your host OS to show all extensions so you can find the "vbox.log", not "vbox.log.1", etc.)
mbellot
Posts: 2
Joined: 30. Jan 2024, 02:52

Re: Networking - Guest OS on Host network with own IP (not host)?

Post by mbellot »

Scott,

Thank you for the very detailed response.

Unfortunately, this was a complete screw-up on my part.

I verified the behavior you described with a different VM first (bridged network did indeed get a unique local IP address from the router, not the same as the host).

I then loaded up the "problem" VM and found that my old eyes had tripped me up. The host IP is x.x.x.104, the guest VM in bridged mode had picked up x.x.x.184. The 8 looked like a 0 and so I incorrectly assumed the guest had picked up the host IP address somehow.

Again, many thanks for your time, help and detailed explanation. Sorry for the wild goose chase. :oops:
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Networking - Guest OS on Host network with own IP (not host)?

Post by scottgus1 »

Hey, no problem! Knowledge is power. So now you can help a friend one day who has identical IP address problems, and you'll go, "I remember something I heard once about what might cause that..." :D
Post Reply