Bobcares

For every $500 you spend, we will provide you with a $500 credit on your account*

BLACK FRIDAY SPECIAL

*The maximum is $4000 in credits, Offer valid till November 30th, 2024, New Customers Only, Credit will be applied after purchase and expires after six (6) months

For every $500 you spend, we will provide you with a $500 credit on your account*

BLACK FRIDAY SPECIAL

*The maximum is $4000 in credits, Offer valid till November 30th, 2024, New Customers Only, Credit will be applied after purchase and expires after six (6) months

Create Private Network Bridge on Proxmox VE 6 with NAT

by | May 14, 2021

Wondering how to Create Private Network Bridge on Proxmox? We can help you.

Proxmox is a great platform to create virtual machines and containers.

We can use it to easily migrate instances to other connected nodes.

As part of our Server Management Services, we assist our customers with several Promox queries.

Today, let us discuss Private Network Bridge on Proxmox VE 6 with NAT

 

Create Private Network Bridge on Proxmox

In Proxmox virtualization infrastructure, we can do the network configuration in two ways:

  • Via the CLI (manually editing network configuration files)
  • From an intuitive graphical user interface.

We can choose either method. However, the choice depends on our Linux administration expertise.

Create Virtual Network Bridge on Proxmox With NAT

For the CLI method, we edit /etc/network/interfaces configuration files directly:

$ sudo vim /etc/network/interfaces

We create a virtual network bridge based on the below network parameters:

  • Network: 192.168.48.0
  • Network mask: 255.255.255.0
  • Proxmox host IP: 192.168.48.1

Then we print current active network interfaces on the server:

$ sudo ip -f inet a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
inet 192.168.58.236/26 brd 195.201.58.255 scope global enp4s0
valid_lft forever preferred_lft forever

On the other hand, we create a virtual bridge named vmbr1:

auto vmbr1
iface vmbr1 inet static
address 192.168.48.1
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0

Here, we can see that there is no physical interface that links to the bridge.

Configure NAT (Masquerading)

Masquerading allows VMs in a private network to access the external networks. It is possible by using the host IP address for outgoing traffic.

iptables rewrite each outgoing packet to appear as originating from the host. In addition, it rewrites the responses accordingly to route to the original sender.

Moving ahead, we will modify the above network configurations to add routing for internet connectivity.

Since primary interface enp4s0 connects to the physical switch and has internet connectivity, we route traffic coming from vmbr1 through it.

auto vmbr1
iface vmbr1 inet static
address 192.168.48.1
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s ‘192.168.48.0/24’ -o enp4s0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s ‘192.168.48.0/24’ -o enp4s0 -j MASQUERADE

Here, enp4s0 can replace with a VLAN interface or another Linux bridge.

Bring up the bridge interface

We can validate those network configurations by manually bringing up the bridge interface.

$ sudo ifup vmbr1
Waiting for vmbr1 to get ready (MAXWAIT is 2 seconds).

Then we check the bridge IP information:

$ ip address show dev vmbr1
3: vmbr1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
link/ether 16:cf:7e:23:de:1e brd ff:ff:ff:ff:ff:ff
inet 192.168.48.1/24 brd 192.168.50.255 scope global vmbr1
valid_lft forever preferred_lft forever
inet6 fe80::14cf:7eff:fe23:de1e/64 scope link
valid_lft forever preferred_lft forever

From the output, we can see that the IP address on the vmbr1 is correct.

Then we should be able to restart the networking service without any failures:

$ sudo systemctl restart networking

Eventually, we confirm the status is active:

$ systemctl status networking.service
● networking.service – Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
Active: active (exited) since Fri 2021-05-07 19:27:34 CEST; 29s ago
Docs: man:interfaces(5)
Process: 27355 ExecStart=/sbin/ifup -a –read-environment (code=exited, status=0/SUCCESS)
Main PID: 27355 (code=exited, status=0/SUCCESS)

May 07 19:27:29 proxmox systemd[1]: Starting Raise network interfaces…
May 07 19:27:34 proxmox ifup[27355]: Waiting for DAD… Done
May 07 19:27:34 proxmox ifup[27355]: Waiting for vmbr1 to get ready (MAXWAIT is 2 seconds).
May 07 19:27:34 proxmox systemd[1]: Started Raise network interfaces.

Once we create a Virtual machine on the bridge, it will behave as if it directly connects to the physical network.

The network, in turn, sees each virtual machine as having its own MAC, even though there is only one network cable connecting all of these VMs to the network.

[Need help with the procedures? We are here for you]

 

Conclusion

In short, we saw an effective method our Support Techs employ to create a Private Network Bridge on Proxmox.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.