Want to do a bridge config that was not possible in ESXi - Is it possible?

EasyGoing1

New Member
Sep 24, 2023
3
0
1
I've been running ESXi on this little box that is intended to be used as a "soft firewall" but it has so much power, I decided to get it and load up the RAM and put a decent SSD in it. I've been running ESXi on it for about a year now, but when I needed to passthru a USB sound card to a Linux VM and learned that it wouldn't work in ESXi because of the way that the device communicates - and having read a forum post from someone who had the exact same problem, but then switched to Proxmox and solved his problem, I immediately exported all of my VMs to .OVF files, then I wiped out the ESXi install with Proxmox.

This is my first time ever using Proxmox.

Because of the way I wanted to use OPNsense on my hypervisor, I had to utilize PCI passthru in ESX so I could bridge two of the internal NICs inside OPNsense. And I have that configuration working now in Proxmox. The migration into Proxmox happened flawlessly like that VM was never moved, which is awesome.

BUT, here is what I would like to do, and I don't know if it's possible to do this in Proxmox:

I would like to bridge two NICs in the Proxmox environment, and then hand that bridge over to OPNsense as a single virtual NIC.

Is this possible?


Thank you,

Mike
 
I am not 100% sure I understand correctly, but it sounds like you want to use Linux Bonding which is described in our Wiki [1].

[1] https://pve.proxmox.com/wiki/Network_Configuration#sysadmin_network_bond

Hi shanreich,

I had originally written this post several days ago (before you posted your reply), but as I was about an hour into it, I accidentally hit a key combination that caused Chrome to go back to my previous page. And when I clicked forward, all of the text I wrote was gone. and when I hit the dropdown for drafts, I saw no way of recovering the text, so I completely re-wrote this post offline and just came back in to post it but this time, I see my draft ... I can't explain that, but that was rather frustrating. You might want to look into the behavior of the forum site here in those situations where the site should re-load any contents that are either in the drafts (wherever you keep those) or in the browser cache for the user ... Im not sure where the text came from when I came here just now, but it was obviously there SOMEWHERE and so I'm suggesting that the site should include code to recover that text in a scenario where a user accidentally hits the back button then the forward button (or in some other way gets out of the page but then back in).

And to respond to your statement, Bonding is NOT what I am looking for, since bonding is essentially link aggregation where NICs are combined as a single NIC for the purpose of adding the bandwidth from each nic into a single nic that has the aggregate sum of the bandwidth from each individual NIC in the bond.

I am specifically wanting to BRIDGE the NICs together so that I can connect more devices into that bridge and they all share the same collision domain. In a bonded setup like you suggest, any devices that I would subsequently connect to those bonded NICs would also have to be bonded in the same way or the NICs would not be able to talk to each other (at least I think that's the case in 802.3ad, though I'm not sure about 802.1AX which replaced ad).

My desired config was like this: Since my little "soft router" hardware has 4 built-in 2.5G ethernet ports, I wanted one of those ports to be dedicated to the cable modem where that traffic is managed by an OPNSense VM and the remaining three ports would essentially act as a single switch where on that switch would be the LAN IP from OPNSense (and thus the default gateway IP for the private network) but in addition to that IP address, I also wanted the IP address of the hypervisor on that bridge so I could access it easily, and also I wanted to connect a WiFi access point to that bridge and all of the devices using it ... and also my XBox which I always hard wire to my LAN and never use Wifi for it. Finally my laptop would be hard wared to that bridge since it has a 2.5G ethernet port it would be able to utilize my gigabit Internet connection without restrictions.

So on those three bridged ports, I would have these devices connected PHYSICALLY: Laptop, Wifi AP and my XBox.

Then in the virtual environment, the hypervisor and the LAN side of OPNSense would also be connected to those bridged ports. And with any luck, everything connected to those bridged ports would have Internet access through OPNSense.

There was no way to create a config like this in ESX but I did figure out how to do it in Proxmox, which I describe in detail here - in case anyone who might be walking this path in the future finds my write up which will be in my next post here.
 
So I finally figured this out. And for anyone who might be interested in doing the same thing, I'll list the steps I did to make this work.

For some reason, the version 8 ISO of Proxmox would not work for me. It booted the installer GUI just fine, but while it was expanding the contents of the ISO to the local volume (I left everything at default settings), it would fail and say it couldn't find a command or something like that. I tried making that boot drive using *dd* on the Mac, then I tried Etcher on the Mac ... then I tried a different SD card and a different USB to SD gadget ... re-tried both of those methods, then I tried Etcher in Windows and then Rufis in dd mode in Windows, nothing worked, the install failed every time at the exact same place.

SO... I decided to install version 7 and do an in-place upgrade. Which worked fine.

When installing version 7, at the point where it asks for the local IP address, I chose the second NIC in the machine because the first NIC is plugged directly into the cable modem. I gave that NIC an address of 10.10.10.2 (because .1 will be the LAN side of OPNsense).

Once Proxmox was installed and booted, I made all of these changes via command line and I didn't use the web GUI until after the upgrade to version 8 was complete.

I started by editing the network interfaces file so that the Internet would be accessible to Debian

pico /etc/network/interfaces
auto lo
iface lo inet loopback

auto enp2s0
iface enp2s0 inet dhcp

auto vmbr0
iface vmbr0 inet static
address 10.10.11.2/24
gateway 10.10.11.1
bridge_ports enp3s0
bridge_stp off
bridge_fd 0

iface enp3s0 inet manual
iface enp4s0 inet manual
iface enp5s0 inet manual

vmbr0 was created by Proxmox and so I left that part untouched. I did, however, move the manual lines to the bottom of the file and I put the lines that establish the Internet connection to the top so that the configs that create working objects are at the top and the nics that are there for sake of existing are at the bottom.

Save this file
CTRL+X
Y
<ENTER>
Normally you would just reset the NICs to get this config working. However, in my case, resetting the NICs did give that Interface a public IP address from the cable modem, but routing wasn't working (no access to the Internet) so I rebooted and then the Internet was accessible.

reboot now

Somewhere in this config, the grub file needs to be changed so that PCI Passthru will work - may as well change it now:
pico /etc/default/grub

Changed this line to add the intel value at the end:
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"

It is necessary to fully update version 7 before upgrading to version 8. However, we need to add a line to the repo lists file so that we pull down a program that will let us confirm that the box is ready for the upgrade.

First, you edit the lists file

pico /etc/apt/sources.list

And make sure that file looks like this:

deb http://ftp.debian.org/debian bullseye main contrib
deb http://ftp.debian.org/debian bullseye-updates main contrib
# PVE pve-no-subscription repository provided by proxmox.com,
# NOT recommended for production use
deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
# security updates
deb http://security.debian.org/debian-security bullseye-security main contrib

Then we update and upgrade. Don't worry that we're doing a dist-upgrade here, this is necessary so that it pulls down the next command that we run.

apt update
apt dist-upgrade -y

The documents I read said to run this command, but I'm sure it's only necessary if you're upgrading a version 7 box that has been in a production. environment. Since this is a clean install, this step should not be necessary though it is certainly harmless and it will point anything that needs to be resolved before doing the upgrade. I think the main issue is to make sure any running VMs are stopped and backed up before the upgrade.

pve7to8 --full

Next, we need to change the repositories lists file so that we are now pulling from the Proxmox 8 repos, and the only thing we need to do for that change is replace the word `bullseye` in that file with the word `bookworm`:

sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list

Then, we update the local repo to match the upstream repo

apt update

The system is now ready for the upgrade to version 8. This next command will take some time to complete. I have a gigabit Internet connection and it took about 20 minutes or so to finish, and it will ask you some questions along the way. Basically it's going to ask you if it is OK to replace some of the config files with the upgrade version, because it determines that these config files have changed from their default after installing version 7.

When it asked about replacing the network interfaces file, I told it NO, but I said YES to all of the others, INCLUDING the grub settings file, because it keeps the changes we made, in the replacement file.

Upgrade to version 8:

apt dist-upgrade -y

You'll want to babysit the upgrade or periodically check back with it so you can respond to the prompts along the way.

When the upgrade finishes, the guides said to run this first command, but again, I think it's only necessary when upgrading a production environment and if you have errors during the upgrade. The command is harmless either way. The second command is just something I do when I commit major changes through a package manager.

apt -f install
apt autoremove

Finally, we need to remove the Internet connection from Debian because we are going to use OPNsense for Internet access. Make sure you have the OPNsense ISO file downloaded (not the IMG file - select DVD from their download page to get the ISO).

To remove the Internet from Debian:

pico /etc/network/interfaces

Replace these two lines:

auto enp2s0
iface enp2s0 inet dhcp

With this one line:

iface enp2s0 inet manual

Your NICs name might be different than mine, so don't copy and paste that step.

Next:

reboot now

Version 8 Steps

Now that the upgrade is complete, and version 8 is running, We need to create our bridge.

If you want to skip past my long-winded explanation of why this config is possible in Proxmox, scroll down to Steps.

This is the part where I really can appreciate Proxmox and how it is implemented, where it is essentially a hypervisor running on a standard installation of Debian, where Debian itself was never altered so that Proxmox would be a typical "appliance" like so many others. There is tremendous power in having done it this way in the sense that we have the flexibility of being able to work with Debian where Proxmox simply must allow whatever changes we make to Debian (within reason of course). And from what I can tell, Proxmox creates a virtual network layer in the environment which includes virtual network interface cards that we then assign to our virtual machines. Proxmox then handles all of the traffic between virtual interfaces and the hardware NIC provided to it from Debian.

This is why we are able to do what we are going to do next. In ESX, this is not possible because ESX is a fully hardened appliance which is essentially a hypervisor that is also a fully contained , custom build of an underlying *nix OS of some kind. But the user of ESX has no access to anything at the OS level and they did not design ESX so that a config like this could be done. Their answer to my problem was to use PCI passthru for all of my NICs, but that then would not have given me the ability to share that bridge with any other VMs without leveraging an external switch.

My praise of Proxmox also deserves a bit of balance. The downside to implementing the hypervisor on top of a standard install of Debian means that Proxmox is vulnerable to any weaknesses in Debian. Now Debian might not have any weaknesses and its attack surface might be impenetrable … but the unavoidable reality is that the attack surface on a default OS install like Debian is LARGE. In fact, it is significantly larger than ESX because ESX has basically stripped out all attack surfaces in the OS, leaving only the ESX virtual layers in the environment as the attack surface. This is also why ESX doesn't really ever need to be patched or updated outside of major version upgrades. The only time you typically ever do any updates to the ESX OS is when you need to add drivers for unsupported hardware.

Steps

This last part is simple and straightforward. Edit your network interfaces file and change it so it looks similar to what I have here. The ethernet port that is connected to the cable modem becomes a blind spot to Debian - BECAUSE of this config and also because we are going to assign that ethernet port to the OPNSense virtual machine using PCI passthru, which further removes that connection from Debian and thus Proxmox. After this, Proxmox can only access the Internet by using the LAN side of OPNSense as its gateway.

pico /etc/network/interfaces

Proxmox should have already created a bridge that has a single NIC in it. You will want to keep that bridge name the same so that Proxmox continues to use it without needing to change anything within the Proxmox environment. In this example, Proxmox created the name `vmbr0`.

Your file should look something like this:

auto lo
iface lo inet loopback

auto vmbr0
iface vmbr0 inet static
address 10.10.10.2/24
gateway 10.10.10.1
bridge_ports enp3s0 enp4s0 enp5s0
bridge_stp off
bridge_fd 0
bridge_maxwait 0

iface enp2s0 inet manual
iface enp3s0 inet manual
iface enp4s0 inet manual
iface enp5s0 inet manual

In this config, NIC `enp2s0 ` is the NIC connected to my cable modem directly.

Save the file
CTRL+X
Y
<ENTER>

Then reboot

reboot now

Now, for the first time, we need to open the web interface for Proxmox.

Upload the OPNSense ISO to Proxmox by expanding Storage and selecting local (NOT local-lvm).
Click on ISO Images, then click on upload and go find the ISO you downloaded and extracted. Wait for it to upload into Proxmox.

Create a new Virtual Machine for OPNSense (leave all settings at default except where noted).
Give it a name then click next
Chose the ISO you uploaded then click Next
Click next again
I set the disk size to 25 (gigs). Click Next
I gave it 2 CPU sockets with 2 cores each, click next
I gave it 4096 memory (4 gigs), click next
Check the box next to No network device, then click next
Click on Finish.

Once the VM is built, click on it and click on Hardware.

Add a PCI device and in the window that pops up, select Raw Device and also check the All Functions box.

Next, add a network device and change the model to VMWare vmxnet3.

That should be it. At this point when you install OPNSense.

Once the OPNSense install is done, STAY IN THE COMMAND LINE INTERFACE and log into it and assign the ports, with the WAN port being the PCI passthru device. If you let Proxmox create your virtual nic name, then it will be the NIC that is not called vmx0, where vmx0 will be the LAN inside OPNSense. If you don’t use default private IP addys then you will also need to change the IP address of the LAN nic and establish DHCP etc. etc.

You should have a working environment at this point.

What I find interesting about this setup, is that even though OPNSense has been given ONE virtual NIC that Proxmox understands as being the physical nic called `vmbr0`, Debian is able to access the Internet by using 10.10.10.1 as its default gateway, and it does this by sending traffic through the virtual NIC that IT created from the above bridge config and that NIC has an ip address of 10.10.10.2.

So we have three physically isolated NICs that exist at the OS level as a bridged NIC and so that NIC is a software ethernet port having its own IP address. Debian does not have any awareness of the ProxMox virtual NIC because Debian is hosting Proxmox, it's not one of Proxmox's clients …

Yet in spite of that, Proxmox still knows that any traffic coming from that bridge NIC that Debian created needs to get sent through to the virtual nic that is assigned to OPNSense and I have to imagine that it does this at layer 2, where layer 3 is being handled by OPNSense.

It's all smoke and mirrors I suppose under the hood … lol.

My only criticism of Proxmox is that it does tend to get lost when you have a config in the GUI but then you make a change in the OS config files for whatever ... ProxMox can't seem to reconcile those external changes and it gets kinda stupid after that... there are other aspects of it that could use some improvement, but overall its a great hypervisor.
 
I had originally written this post several days ago (before you posted your reply), but as I was about an hour into it, I accidentally hit a key combination that caused Chrome to go back to my previous page. And when I clicked forward, all of the text I wrote was gone. and when I hit the dropdown for drafts, I saw no way of recovering the text, so I completely re-wrote this post offline and just came back in to post it but this time, I see my draft ... I can't explain that, but that was rather frustrating. You might want to look into the behavior of the forum site here in those situations where the site should re-load any contents that are either in the drafts (wherever you keep those) or in the browser cache for the user ... Im not sure where the text came from when I came here just now, but it was obviously there SOMEWHERE and so I'm suggesting that the site should include code to recover that text in a scenario where a user accidentally hits the back button then the forward button (or in some other way gets out of the page but then back in).
This behaviour can be a bit tricky, since there are browser caches involved as well. The best is probably to do a full reload (CTRL + SHIFT + R) on the page with the text field, that usually works for me.

I see your use case now! Great that you were able to figure out the solution your own and thanks for posting the solution.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!