Proxmox Bridge and Nat Interfaces Example

Article 118 in Networking

<< Back
2021-01-27 05:46:00 from bugfish
Proxmox Bridge and Nat Interfaces Example
Networking / Proxmox
Last Review on: 2022-08-06 18:05:11 | Hits: 501

This script is for a proxmox host to set up 2 bridges.

1 provides static ip 4 and 6 to vservers
1 provides NAT routed connection


Start of /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp1s0f0

This Bridge is for vServer with an OWN ipv4 or ipv6 address.

auto vmbr0
iface vmbr0 inet static
        address         YOURIPV4FORHOST
        netmask         YOUURSUBNET
        gateway         YOURGATEWAY
        bridge_ports   YOURMAINNETWORKADAPTER
        bridge_stp      off
        bridge_fd       0

iface vmbr0 inet6 static
        address V6ADDRESS
        netmask V6GATEWAY

        up ip -6 route add V6GATEWAY dev vmbr0
        up ip -6 route add default via V6GATEWAY dev vmbr0
        down ip -6 route del default via V6GATEWAY dev vmbr0
        down ip -6 route del V6GATEWAY dev vmbr0

Bridge for NAT Clients to connect to and get Internet Connection. Will not be reachable with static ip from outside, you will need to setup port forwarding.
But this will last to have your vservers have internet without own ipv4

auto vmbr1
iface vmbr1 inet static
        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 '' -o vmbr0 -j MASQUERADE
    post-down iptables -t nat -D POSTROUTING -s '' -o vmbr0 -j MASQUERADE

This code will setup all adapters you need to configure proxmox hosts.

I do not guarantee the reliability of the information given here, the code described on this page is executed at your own risk and in the event of damage or other unforeseeable consequences I am in no way responsible or liable.


Currently 2 Upvotes!

captcha image
System - 2022-08-17 03:19:16
Thanks for visiting my page and have a nice day!
Staff may be in trouble!
Switch: 0 | Arrive: 2
This Website is using Session Cookies for Site Functionality and AWStats.