Page 1 of 1

User + Peer port should bypass npm. Solution for those with VLAN

Posted: Thu Sep 24, 2026 2:19 pm
by proxmoxer
Those that use a vlan (vmbr1) got a simple way to bypass npm for peer and user port.

You need to bypass npm with user port because cluster violations should be based on user connecting to cluster not on your local internal ip, as if you use the local ip one bad user can ban everyone from a cluster.


cp /etc/network/interfaces /etc/network/interfaces.bak

Example config that solves the problem (of course ips will be different from yours)

Code: Select all

# this network interface was autogenerated ;) then processed by gadget78 deploy script
# Please do NOT modify this file directly, unless you know what you're doing.
#
source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

iface nic2 inet manual

auto vmbr0
iface vmbr0 inet static
        address 192.168.1.3/24
        gateway 192.168.1.1
        bridge-ports nic2
        bridge-stp off
        bridge-fd 0
        

        # Forward traffic
        post-up iptables -t nat -A OUTPUT -d 192.168.1.3 -p tcp --dport 80 -j DNAT --to-destination 192.168.2.1:80
        post-up iptables -t nat -A OUTPUT -d 192.168.1.3 -p tcp --dport 443 -j DNAT --to-destination 192.168.2.1:443
        post-up iptables -t nat -A OUTPUT -d 192.168.1.3 -p tcp --dport 53 -j DNAT --to-destination 192.168.2.1:53
        post-up iptables -t nat -A OUTPUT -d 192.168.1.3 -p udp --dport 53 -j DNAT --to-destination 192.168.2.1:53

        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to-destination 192.168.2.1:80
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 443 -j DNAT --to-destination 192.168.2.1:443
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 81 -j DNAT --to-destination 192.168.2.1:81
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 53 -j DNAT --to-destination 192.168.2.1:53
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 53 -j DNAT --to-destination 192.168.2.1:53
        post-up iptables -t nat -A PREROUTING -i vmbr0 -d 192.168.1.3 -p tcp --dport 80 -j DNAT --to-destination 192.168.2.1:80
        post-up iptables -t nat -A PREROUTING -i vmbr0 -d 192.168.1.3 -p tcp --dport 443 -j DNAT --to-destination 192.168.2.1:443
        post-up iptables -t nat -A PREROUTING -i vmbr0 -d 192.168.1.3 -p tcp --dport 53 -j DNAT --to-destination 192.168.2.1:53
        post-up iptables -t nat -A PREROUTING -i vmbr0 -d 192.168.1.3 -p udp --dport 53 -j DNAT --to-destination 192.168.2.1:53
        post-up iptables -t nat -A PREROUTING -i vmbr1 -d 192.168.1.3 -p tcp --dport 80 -j DNAT --to-destination 192.168.2.1:80
        post-up iptables -t nat -A PREROUTING -i vmbr1 -d 192.168.1.3 -p tcp --dport 443 -j DNAT --to-destination 192.168.2.1:443
        post-up iptables -t nat -A PREROUTING -i vmbr1 -d 192.168.1.3 -p tcp --dport 53 -j DNAT --to-destination 192.168.2.1:53
        post-up iptables -t nat -A PREROUTING -i vmbr1 -d 192.168.1.3 -p udp --dport 53 -j DNAT --to-destination 192.168.2.1:53

        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30111:30113 -j DNAT --to-destination 192.168.2.101
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30111:30113 -j DNAT --to-destination 192.168.2.101
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30211:30213 -j DNAT --to-destination 192.168.2.102
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30211:30213 -j DNAT --to-destination 192.168.2.102
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30311:30313 -j DNAT --to-destination 192.168.2.103
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30311:30313 -j DNAT --to-destination 192.168.2.103
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30411:30413 -j DNAT --to-destination 192.168.2.104
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30411:30413 -j DNAT --to-destination 192.168.2.104
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30511:30513 -j DNAT --to-destination 192.168.2.105
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30511:30513 -j DNAT --to-destination 192.168.2.105
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30611:30613 -j DNAT --to-destination 192.168.2.106
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30611:30613 -j DNAT --to-destination 192.168.2.106
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30711:30713 -j DNAT --to-destination 192.168.2.107
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30711:30713 -j DNAT --to-destination 192.168.2.107
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30811:30813 -j DNAT --to-destination 192.168.2.108
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30811:30813 -j DNAT --to-destination 192.168.2.108
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30911:30913 -j DNAT --to-destination 192.168.2.109
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30911:30913 -j DNAT --to-destination 192.168.2.109
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31011:31013 -j DNAT --to-destination 192.168.2.110
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31011:31013 -j DNAT --to-destination 192.168.2.110
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31111:31113 -j DNAT --to-destination 192.168.2.111
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31111:31113 -j DNAT --to-destination 192.168.2.111
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31211:31213 -j DNAT --to-destination 192.168.2.112
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31211:31213 -j DNAT --to-destination 192.168.2.112
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31311:31313 -j DNAT --to-destination 192.168.2.113
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31311:31313 -j DNAT --to-destination 192.168.2.113
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31411:31413 -j DNAT --to-destination 192.168.2.114
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31411:31413 -j DNAT --to-destination 192.168.2.114
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31511:31513 -j DNAT --to-destination 192.168.2.115
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31511:31513 -j DNAT --to-destination 192.168.2.115
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31611:31613 -j DNAT --to-destination 192.168.2.116
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31611:31613 -j DNAT --to-destination 192.168.2.116
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31711:31713 -j DNAT --to-destination 192.168.2.117
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31711:31713 -j DNAT --to-destination 192.168.2.117
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31811:31813 -j DNAT --to-destination 192.168.2.118
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31811:31813 -j DNAT --to-destination 192.168.2.118
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31911:31913 -j DNAT --to-destination 192.168.2.119
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31911:31913 -j DNAT --to-destination 192.168.2.119
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32011:32013 -j DNAT --to-destination 192.168.2.120
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32011:32013 -j DNAT --to-destination 192.168.2.120
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32111:32113 -j DNAT --to-destination 192.168.2.121
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32111:32113 -j DNAT --to-destination 192.168.2.121
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32211:32213 -j DNAT --to-destination 192.168.2.122
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32211:32213 -j DNAT --to-destination 192.168.2.122
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32311:32313 -j DNAT --to-destination 192.168.2.123
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32311:32313 -j DNAT --to-destination 192.168.2.123
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32411:32413 -j DNAT --to-destination 192.168.2.124
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32411:32413 -j DNAT --to-destination 192.168.2.124
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32511:32513 -j DNAT --to-destination 192.168.2.125
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32511:32513 -j DNAT --to-destination 192.168.2.125
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32611:32613 -j DNAT --to-destination 192.168.2.126
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32611:32613 -j DNAT --to-destination 192.168.2.126
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32711:32713 -j DNAT --to-destination 192.168.2.127
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32711:32713 -j DNAT --to-destination 192.168.2.127
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32811:32813 -j DNAT --to-destination 192.168.2.128
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32811:32813 -j DNAT --to-destination 192.168.2.128
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32911:32913 -j DNAT --to-destination 192.168.2.129
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32911:32913 -j DNAT --to-destination 192.168.2.129
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 33011:33013 -j DNAT --to-destination 192.168.2.130
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 33011:33013 -j DNAT --to-destination 192.168.2.130

        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30121:30123 -j DNAT --to-destination 192.168.2.101
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30121:30123 -j DNAT --to-destination 192.168.2.101
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30221:30223 -j DNAT --to-destination 192.168.2.102
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30221:30223 -j DNAT --to-destination 192.168.2.102
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30321:30323 -j DNAT --to-destination 192.168.2.103
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30321:30323 -j DNAT --to-destination 192.168.2.103
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30421:30423 -j DNAT --to-destination 192.168.2.104
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30421:30423 -j DNAT --to-destination 192.168.2.104
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30521:30523 -j DNAT --to-destination 192.168.2.105
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30521:30523 -j DNAT --to-destination 192.168.2.105
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30621:30623 -j DNAT --to-destination 192.168.2.106
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30621:30623 -j DNAT --to-destination 192.168.2.106
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30721:30723 -j DNAT --to-destination 192.168.2.107
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30721:30723 -j DNAT --to-destination 192.168.2.107
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30821:30823 -j DNAT --to-destination 192.168.2.108
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30821:30823 -j DNAT --to-destination 192.168.2.108
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30921:30923 -j DNAT --to-destination 192.168.2.109
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30921:30923 -j DNAT --to-destination 192.168.2.109
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31021:31023 -j DNAT --to-destination 192.168.2.110
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31021:31023 -j DNAT --to-destination 192.168.2.110
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31121:31123 -j DNAT --to-destination 192.168.2.111
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31121:31123 -j DNAT --to-destination 192.168.2.111
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31221:31223 -j DNAT --to-destination 192.168.2.112
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31221:31223 -j DNAT --to-destination 192.168.2.112
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31321:31323 -j DNAT --to-destination 192.168.2.113
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31321:31323 -j DNAT --to-destination 192.168.2.113
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31421:31423 -j DNAT --to-destination 192.168.2.114
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31421:31423 -j DNAT --to-destination 192.168.2.114
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31521:31523 -j DNAT --to-destination 192.168.2.115
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31521:31523 -j DNAT --to-destination 192.168.2.115
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31621:31623 -j DNAT --to-destination 192.168.2.116
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31621:31623 -j DNAT --to-destination 192.168.2.116
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31721:31723 -j DNAT --to-destination 192.168.2.117
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31721:31723 -j DNAT --to-destination 192.168.2.117
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31821:31823 -j DNAT --to-destination 192.168.2.118
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31821:31823 -j DNAT --to-destination 192.168.2.118
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 31921:31923 -j DNAT --to-destination 192.168.2.119
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 31921:31923 -j DNAT --to-destination 192.168.2.119
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32021:32023 -j DNAT --to-destination 192.168.2.120
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32021:32023 -j DNAT --to-destination 192.168.2.120
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32121:32123 -j DNAT --to-destination 192.168.2.121
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32121:32123 -j DNAT --to-destination 192.168.2.121
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32221:32223 -j DNAT --to-destination 192.168.2.122
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32221:32223 -j DNAT --to-destination 192.168.2.122
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32321:32323 -j DNAT --to-destination 192.168.2.123
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32321:32323 -j DNAT --to-destination 192.168.2.123
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32421:32423 -j DNAT --to-destination 192.168.2.124
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32421:32423 -j DNAT --to-destination 192.168.2.124
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32521:32523 -j DNAT --to-destination 192.168.2.125
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32521:32523 -j DNAT --to-destination 192.168.2.125
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32621:32623 -j DNAT --to-destination 192.168.2.126
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32621:32623 -j DNAT --to-destination 192.168.2.126
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32721:32723 -j DNAT --to-destination 192.168.2.127
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32721:32723 -j DNAT --to-destination 192.168.2.127
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32821:32823 -j DNAT --to-destination 192.168.2.128
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32821:32823 -j DNAT --to-destination 192.168.2.128
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32921:32923 -j DNAT --to-destination 192.168.2.129
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 32921:32923 -j DNAT --to-destination 192.168.2.129
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 33021:33023 -j DNAT --to-destination 192.168.2.130
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 33021:33023 -j DNAT --to-destination 192.168.2.130

        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30110:39970 -j DNAT --to-destination 192.168.2.1
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30110:39970 -j DNAT --to-destination 192.168.2.1

        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 30110:39970 -j DNAT --to-destination 192.168.2.1
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp --dport 30110:39970 -j DNAT --to-destination 192.168.2.1

        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30111:30113 -j DNAT --to-destination 192.168.2.101
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30111:30113 -j DNAT --to-destination 192.168.2.101
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30211:30213 -j DNAT --to-destination 192.168.2.102
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30211:30213 -j DNAT --to-destination 192.168.2.102
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30311:30313 -j DNAT --to-destination 192.168.2.103
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30311:30313 -j DNAT --to-destination 192.168.2.103
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30411:30413 -j DNAT --to-destination 192.168.2.104
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30411:30413 -j DNAT --to-destination 192.168.2.104
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30511:30513 -j DNAT --to-destination 192.168.2.105
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30511:30513 -j DNAT --to-destination 192.168.2.105
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30611:30613 -j DNAT --to-destination 192.168.2.106
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30611:30613 -j DNAT --to-destination 192.168.2.106
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30711:30713 -j DNAT --to-destination 192.168.2.107
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30711:30713 -j DNAT --to-destination 192.168.2.107
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30811:30813 -j DNAT --to-destination 192.168.2.108
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30811:30813 -j DNAT --to-destination 192.168.2.108
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30911:30913 -j DNAT --to-destination 192.168.2.109
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30911:30913 -j DNAT --to-destination 192.168.2.109
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31011:31013 -j DNAT --to-destination 192.168.2.110
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31011:31013 -j DNAT --to-destination 192.168.2.110
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31111:31113 -j DNAT --to-destination 192.168.2.111
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31111:31113 -j DNAT --to-destination 192.168.2.111
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31211:31213 -j DNAT --to-destination 192.168.2.112
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31211:31213 -j DNAT --to-destination 192.168.2.112
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31311:31313 -j DNAT --to-destination 192.168.2.113
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31311:31313 -j DNAT --to-destination 192.168.2.113
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31411:31413 -j DNAT --to-destination 192.168.2.114
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31411:31413 -j DNAT --to-destination 192.168.2.114
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31511:31513 -j DNAT --to-destination 192.168.2.115
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31511:31513 -j DNAT --to-destination 192.168.2.115
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31611:31613 -j DNAT --to-destination 192.168.2.116
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31611:31613 -j DNAT --to-destination 192.168.2.116
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31711:31713 -j DNAT --to-destination 192.168.2.117
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31711:31713 -j DNAT --to-destination 192.168.2.117
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31811:31813 -j DNAT --to-destination 192.168.2.118
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31811:31813 -j DNAT --to-destination 192.168.2.118
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31911:31913 -j DNAT --to-destination 192.168.2.119
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31911:31913 -j DNAT --to-destination 192.168.2.119
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32011:32013 -j DNAT --to-destination 192.168.2.120
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32011:32013 -j DNAT --to-destination 192.168.2.120
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32111:32113 -j DNAT --to-destination 192.168.2.121
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32111:32113 -j DNAT --to-destination 192.168.2.121
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32211:32213 -j DNAT --to-destination 192.168.2.122
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32211:32213 -j DNAT --to-destination 192.168.2.122
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32311:32313 -j DNAT --to-destination 192.168.2.123
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32311:32313 -j DNAT --to-destination 192.168.2.123
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32411:32413 -j DNAT --to-destination 192.168.2.124
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32411:32413 -j DNAT --to-destination 192.168.2.124
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32511:32513 -j DNAT --to-destination 192.168.2.125
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32511:32513 -j DNAT --to-destination 192.168.2.125
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32611:32613 -j DNAT --to-destination 192.168.2.126
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32611:32613 -j DNAT --to-destination 192.168.2.126
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32711:32713 -j DNAT --to-destination 192.168.2.127
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32711:32713 -j DNAT --to-destination 192.168.2.127
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32811:32813 -j DNAT --to-destination 192.168.2.128
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32811:32813 -j DNAT --to-destination 192.168.2.128
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32911:32913 -j DNAT --to-destination 192.168.2.129
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32911:32913 -j DNAT --to-destination 192.168.2.129
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 33011:33013 -j DNAT --to-destination 192.168.2.130
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 33011:33013 -j DNAT --to-destination 192.168.2.130

        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30121:30123 -j DNAT --to-destination 192.168.2.101
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30121:30123 -j DNAT --to-destination 192.168.2.101
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30221:30223 -j DNAT --to-destination 192.168.2.102
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30221:30223 -j DNAT --to-destination 192.168.2.102
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30321:30323 -j DNAT --to-destination 192.168.2.103
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30321:30323 -j DNAT --to-destination 192.168.2.103
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30421:30423 -j DNAT --to-destination 192.168.2.104
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30421:30423 -j DNAT --to-destination 192.168.2.104
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30521:30523 -j DNAT --to-destination 192.168.2.105
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30521:30523 -j DNAT --to-destination 192.168.2.105
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30621:30623 -j DNAT --to-destination 192.168.2.106
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30621:30623 -j DNAT --to-destination 192.168.2.106
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30721:30723 -j DNAT --to-destination 192.168.2.107
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30721:30723 -j DNAT --to-destination 192.168.2.107
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30821:30823 -j DNAT --to-destination 192.168.2.108
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30821:30823 -j DNAT --to-destination 192.168.2.108
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30921:30923 -j DNAT --to-destination 192.168.2.109
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30921:30923 -j DNAT --to-destination 192.168.2.109
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31021:31023 -j DNAT --to-destination 192.168.2.110
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31021:31023 -j DNAT --to-destination 192.168.2.110
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31121:31123 -j DNAT --to-destination 192.168.2.111
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31121:31123 -j DNAT --to-destination 192.168.2.111
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31221:31223 -j DNAT --to-destination 192.168.2.112
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31221:31223 -j DNAT --to-destination 192.168.2.112
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31321:31323 -j DNAT --to-destination 192.168.2.113
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31321:31323 -j DNAT --to-destination 192.168.2.113
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31421:31423 -j DNAT --to-destination 192.168.2.114
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31421:31423 -j DNAT --to-destination 192.168.2.114
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31521:31523 -j DNAT --to-destination 192.168.2.115
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31521:31523 -j DNAT --to-destination 192.168.2.115
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31621:31623 -j DNAT --to-destination 192.168.2.116
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31621:31623 -j DNAT --to-destination 192.168.2.116
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31721:31723 -j DNAT --to-destination 192.168.2.117
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31721:31723 -j DNAT --to-destination 192.168.2.117
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31821:31823 -j DNAT --to-destination 192.168.2.118
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31821:31823 -j DNAT --to-destination 192.168.2.118
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 31921:31923 -j DNAT --to-destination 192.168.2.119
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 31921:31923 -j DNAT --to-destination 192.168.2.119
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32021:32023 -j DNAT --to-destination 192.168.2.120
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32021:32023 -j DNAT --to-destination 192.168.2.120
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32121:32123 -j DNAT --to-destination 192.168.2.121
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32121:32123 -j DNAT --to-destination 192.168.2.121
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32221:32223 -j DNAT --to-destination 192.168.2.122
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32221:32223 -j DNAT --to-destination 192.168.2.122
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32321:32323 -j DNAT --to-destination 192.168.2.123
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32321:32323 -j DNAT --to-destination 192.168.2.123
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32421:32423 -j DNAT --to-destination 192.168.2.124
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32421:32423 -j DNAT --to-destination 192.168.2.124
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32521:32523 -j DNAT --to-destination 192.168.2.125
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32521:32523 -j DNAT --to-destination 192.168.2.125
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32621:32623 -j DNAT --to-destination 192.168.2.126
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32621:32623 -j DNAT --to-destination 192.168.2.126
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32721:32723 -j DNAT --to-destination 192.168.2.127
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32721:32723 -j DNAT --to-destination 192.168.2.127
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32821:32823 -j DNAT --to-destination 192.168.2.128
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32821:32823 -j DNAT --to-destination 192.168.2.128
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32921:32923 -j DNAT --to-destination 192.168.2.129
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 32921:32923 -j DNAT --to-destination 192.168.2.129
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 33021:33023 -j DNAT --to-destination 192.168.2.130
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 33021:33023 -j DNAT --to-destination 192.168.2.130

        post-up iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -d 192.168.2.1/32 -p tcp --dport 80 -j MASQUERADE
        post-up iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -d 192.168.2.1/32 -p tcp --dport 443 -j MASQUERADE
        post-up iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -d 192.168.2.1/32 -p tcp --dport 53 -j MASQUERADE
        post-up iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -d 192.168.2.1/32 -p udp --dport 53 -j MASQUERADE
        post-up iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -d 192.168.2.1/32 -p tcp --dport 30110:39970 -j MASQUERADE
        post-up iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -d 192.168.2.1/32 -p udp --dport 30110:39970 -j MASQUERADE
        post-up iptables -t nat -A POSTROUTING -s 192.168.1.3/32 -d 192.168.2.1/32 -p tcp --dport 80 -j MASQUERADE
        post-up iptables -t nat -A POSTROUTING -s 192.168.1.3/32 -d 192.168.2.1/32 -p tcp --dport 443 -j MASQUERADE
        post-up iptables -t nat -A POSTROUTING -s 192.168.1.3/32 -d 192.168.2.1/32 -p tcp --dport 53 -j MASQUERADE
        post-up iptables -t nat -A POSTROUTING -s 192.168.1.3/32 -d 192.168.2.1/32 -p udp --dport 53 -j MASQUERADE

        # Clean up rules on interface shutdown
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 30110:39970 -j DNAT --to-destination 192.168.2.1
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 30110:39970 -j DNAT --to-destination 192.168.2.1
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to-destination 192.168.2.1:80
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 81 -j DNAT --to-destination 192.168.2.1:81
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 53 -j DNAT --to-destination 192.168.2.1:53
        pre-down iptables -t nat -D PREROUTING -i vmbr0 -p udp --dport 53 -j DNAT --to-destination 192.168.2.1:53
        pre-down iptables -t nat -D POSTROUTING -d 192.168.2.1/32 -p tcp --dport 30110:39970 -j MASQUERADE
        pre-down iptables -t nat -D POSTROUTING -d 192.168.2.1/32 -p udp --dport 30110:39970 -j MASQUERADE
        pre-down iptables -t nat -D POSTROUTING -d 192.168.2.1/32 -p tcp --dport 80 -j MASQUERADE
        pre-down iptables -t nat -D POSTROUTING -d 192.168.2.1/32 -p tcp --dport 81 -j MASQUERADE
        pre-down iptables -t nat -D POSTROUTING -d 192.168.2.1/32 -p tcp --dport 53 -j MASQUERADE
        pre-down iptables -t nat -D POSTROUTING -d 192.168.2.1/32 -p udp --dport 53 -j MASQUERADE



auto vmbr1
iface vmbr1 inet static
        address 192.168.2.254/24
        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.2.0/24' -o vmbr0 -j MASQUERADE
post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1

post-down iptables -t nat -D POSTROUTING -s '192.168.2.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1