Bridged network on Linux server with public IP

Discussions related to using VirtualBox on Linux hosts.
Post Reply
dcubrovic
Posts: 2
Joined: 14. Nov 2021, 12:56

Bridged network on Linux server with public IP

Post by dcubrovic »

Hello there.
I'm using rented dedicated server as my remote desktop for years.
I have used on it VirtualBox images from time to time just like I'm using it on my real desktop.
But now I need to setup VirtualBox Linux guest in bridged mode to run some software on it that does not works in NAT environment .
And if I start that Linux guest in bridged mode network became unreachable (can't even ping from that machine).
Host is Ubuntu 20.04 that runs on server with public and 2 cards (I have used enp7s0f0: for bridged and thats the valid one with public ip set)
For guests I have tried several linux images from few sources (ubuntu server, ubuntu desktop, centos few versions of each)
I found some pages with similar problems but without any help resolving this.
Is this achievable in my setup and any sugestions to make this work?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Bridged network on Linux server with public IP

Post by mpack »

Basic factoids to get out of the way:
(1) An IP is not set by the NIC. It's usually set by a DHCP server, or it's statically assigned in software. In all cases an IP is a software object, not created in hardware.

(2) Two devices can't use the same IP address on the same network. If you statically assign the same IP to two PCs, e.g. host PC and virtual PC, then things will not go well.

Typically you don't use a public IP directly. You instead create a LAN that assigns local addresses using DHCP, then you designate one device - usually a router - as a gateway for Internet access. Local IP is substituted for public IP as packets pass through the gateway, very much like NAT (in fact it is NAT).

If this isn't how your network is set up... then it should be!
dcubrovic
Posts: 2
Joined: 14. Nov 2021, 12:56

Re: Bridged network on Linux server with public IP

Post by dcubrovic »

Thanks for fast response. I'm an amateur when comes to networking.
Network is set vie netplan config file like bellow.
I did not set anything network related to virtualbox gues.
Just changed in networking tab to use bridged connection and enp7s0f0 adapter.
As i see from config enp7s0f0have disabled dhcp so perhaps that is problem.
Not sure how can I fix this without dhcp and separate IP. Perhaps bridged connection is not solution for my problem but those other types like internal and so on are totally unknown for me.

What I tring to solve that software in virtual box requires:
"Requires public IP and high - quality internet connection to work properly. NAT environment without UPnP and public IP is not supported. "
So I assume that my virtualbox shoud use that same public ip for that to work.
So I'm maybe on wrong track here looking in bridged networking. Maybe there is a better solution for this purpose?

ps I have changedip numbers to letters in config file.

network:
version: 2
renderer: networkd
ethernets:
enp7s0f0:
dhcp4: no
dhcp6: no
addresses: [a.b.c.d/26]
gateway4: e.f.g.h
nameservers:
search: [d.l.n]
addresses: [a1,a2,a3,a4,b1.b2.b3.b4]

enp7s0f1:
dhcp4: yes
mtu: 9000
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Bridged network on Linux server with public IP

Post by scottgus1 »

Try an experiment, please: Set up a new Ubuntu VM, set its network to Bridged from the beginning before you start the VM or install the OS, then install a new Ubuntu Linux OS in the VM. Does this new VM OS get a correct usable IP address that allows it to have internet?

If so, then there are configuration issues in your existing VM beyond what the Virtualbox hardware configuration can fix. Web-search network tutorials and forums.

If the new VM does not get a usable Bridged IP address, then your rented server's provider has blocked Bridged VMs from getting an IP address. You'll need to talk to them about allowing a VM to have a separate IP address on the server's LAN.
dcubrovic wrote:I need to setup VirtualBox Linux guest in bridged mode to run some software on it that does not works in NAT environment.
Lest we chase an "XY problem", can you please explain why your software does not work on NAT? What is the original problem?
Post Reply