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
iface YOURMAINNETWORKADAPTER inet manual
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 0iface vmbr0 inet6 static
address V6ADDRESS
netmask V6GATEWAYup 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
address 192.168.137.1
netmask 255.255.255.0
network 192.168.137.0
broadcast 255.255.255.255
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.137.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.137.0/24' -o vmbr0 -j MASQUERADE
This code will setup all adapters you need to configure proxmox hosts.