A couple questions on a VM server

Discussions related to using VirtualBox on Windows hosts.
Post Reply
ceponatia
Posts: 3
Joined: 22. May 2022, 18:37

A couple questions on a VM server

Post by ceponatia »

Hi! I've been playing around with Ubuntu Server in VirtualBox on Windows 11 for a couple days and have figured out a lot on my own but I'm wondering if there are more efficient ways to do what I'm trying to do. I read the networking guide on this forum but I've read elsewhere that Ubuntu no longer uses etc network interfaces so I'm unsure how to follow the rest of what that guide is saying. Nonetheless I have managed to jury rig the VM to do what I need but as I mentioned I want to know if I can do it better!

I'm hoping to use the VM as an Internet-facing server to play with cloud storage and streaming. As a test, forwarded "the internet protocol" (forum won't let me write the protocol name because it thinks it's an address) through VirtualBox to port 8000 on my desktop, then forwarded 8000 through my router, so I know that route is feasible. But what I really want to do is figure out if I can assign a "virtual IP" or MAC address to my VM that my router can see. From the network tutorial I mentioned above, it looks like this is possible, but since I don't have the files mentioned in the guide I don't know how to do it. I'm not a complete Linux noob but when it comes to networking on Linux I definitely am. :)

I should also mention I'm using a non-GUI version of Ubuntu so a lot of the solutions I've found online which involve using apps to manage network configuration don't work for me. I'm sure there's a CLI application which can do this, I simply haven't found out what it's called yet.

Thanks for any help!
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: A couple questions on a VM server

Post by scottgus1 »

ceponatia wrote:I read the networking guide on this forum
I'm not certain what you were reading, but this tutorial will help show what each Virtualbox network type will do: Virtualbox Networks: In Pictures
ceponatia wrote:I've read elsewhere that Ubuntu no longer uses etc network interfaces
Not sure what an 'etc' network interface is, or if that was runaway autocorrect. The VM OS uses whatever network adapter Virtualbox provides for it. You can use 'ip address' or 'ifconfig' inside the VM OS's Terminal to see the adapter (probably 'eth0' or 'enp0s3' something like that).
ceponatia wrote:forwarded "the internet protocol" (forum won't let me write the protocol name because it thinks it's an address) through VirtualBox to port 8000 on my desktop, then forwarded 8000 through my router,
That you're forwarding a port through Virtualbox tells me you're possibly using Virtualbox's NAT or NAT Network for the VM. As the Pictures tutorial shows, these types put a virtual 'router' between the VM and your physical LAN. Such port forwarding does work. You forward through NAT or NAT Network, then you'd forward through the physical LAN router to point at the host PC's IP address (not the VM's IP address). Traffic coming from the physical router to the host on the port set in NAT or NAT Network will get forwarded to the VM. Of course, the host itself can't have something listening on the same port that NAT or NAT Network are forwarding, or unusual things will happen.
ceponatia wrote:f I can assign a "virtual IP" or MAC address to my VM that my router can see.
Each VM network adapter does have its own unique MAC address. But you would use Bridged to expose that MAC address ut on the physical LAN for the router to see. Bridged puts the VM independently on the LAN, with no port forwarding through Virtualbox necessary. The VM OS can also get an IP address from the LAN, or you can set a compatible static IP address in the VM OS. Set the physical router to forward directly to the VM's network name, MAC address, or IP address.
ceponatia
Posts: 3
Joined: 22. May 2022, 18:37

Re: A couple questions on a VM server

Post by ceponatia »

I'm not certain what you were reading
I can't post links because my account is only a day old but it's in the General > HowTos and Tutorials section of the forum.
Not sure what an 'etc' network interface is, or if that was runaway autocorrect.
That was supposed to have forward slashes in between each word, as in it's a filename on Linux, but the same "can't post URLs" rule considered it to be a web address so I had to take the slashes out to post it. Could have formatted it better for sure lol.
Each VM network adapter does have its own unique MAC address. But you would use Bridged to expose that MAC address ut on the physical LAN for the router to see.
I think an important note I forgot to put in my original post is that this is on WiFi and I only have one NIC. I read in the link you posted that bridged networking doesn't always work on WiFi, and that seems to be the case with me. I originally had it set to bridged and just tried it again, and my router doesn't see the VM traffic as separate even though it has Internet access. I can switch to Ethernet in the future but it's not an option immediately, so maybe I'll just have to put this project off for no.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: A couple questions on a VM server

Post by scottgus1 »

ceponatia wrote:it's a filename on Linux
I've heard tell that Linux has every device in the computer 'aliased' as a file on the disk. But whether it still does that isn't an influence on whether the VM OS gets network & internet.
ceponatia wrote:this is on WiFi and I only have one NIC. I read in the link you posted that bridged networking doesn't always work on WiFi, and that seems to be the case with me. I originally had it set to bridged and just tried it again, and my router doesn't see the VM traffic as separate even though it has Internet access.
OK, so you'll have to keep using NAT & port forwarding. Your setup is essentially two routers in a row. First router (the physical router) forwards to the second router (Virtualbox NAT in the host PC), which then forwards to the VM.
ceponatia
Posts: 3
Joined: 22. May 2022, 18:37

Re: A couple questions on a VM server

Post by ceponatia »

Okay, this is how I got it to work as well, thank you for confirming it's the way to do it for now! Load off my mind. :)
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: A couple questions on a VM server

Post by scottgus1 »

Awesome! Glad you got it working. Gotta love it when a plan comes together, eh? :D
Post Reply