Port Forwarding stops after updating Interface Configuration

infinitydon

Renowned Member
Dec 17, 2014
3
0
66
Hi,

Am having a problem here, any time I update the PORT Forwarding on my interface config file and I restart networking, ping test fails towards the guests until I restart/shutdown the guests!

Below is my config:

Code:
auto vmbr2
iface vmbr2 inet static
    address 10.10.10.254
    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 '10.10.10.0/24' -o vmbr0 -j MASQUERADE
    post-down iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o vmbr0 -j MASQUERADE
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 1022 -j DNAT --to 10.10.10.1:22
    post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 1022 -j DNAT --to 10.10.10.1:22
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 1080 -j DNAT --to 10.10.10.1:80
    post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 1080 -j DNAT --to 10.10.10.1:80
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 2022 -j DNAT --to 10.10.10.2:22
    post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 2022 -j DNAT --to 10.10.10.2:22
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 2080 -j DNAT --to 10.10.10.2:80
    post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 2080 -j DNAT --to 10.10.10.2:80
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 2088 -j DNAT --to 10.10.10.2:8080
    post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 2088 -j DNAT --to 10.10.10.2:8080

Am running Proxmox VE 3.3-1.

Any help will appreciated because I can't keep restarting the guests.
 
Hello infinitydon

Am having a problem here, any time I update the PORT Forwarding on my interface config file and I restart networking, ping test fails towards the guests until I restart/shutdown the guests!



Any help will appreciated because I can't keep restarting the guests.

If you restart the network the bridge connections of the currently running VMs will not be reconnected since they are not defined in /etc/network/interfaces. You can do this manually by

Code:
brctl addif ...

or, in case of ovs

Code:
ovs-vsctl add-port ...


but in general a network restart is not recommended in Proxmox nodes.

Kind regards

Mr.Holmes