dimikot / vzfirewall

vzfirewall is an extremely simple tool to configure opened ports and hosts for incoming connections in OpenVZ environment
GNU Lesser General Public License v2.1
15 stars 6 forks source link

external rules port forwarding #8

Open marl-scot opened 9 years ago

marl-scot commented 9 years ago

Hi I am trying to work out how to ether include an external rules file after updating vzfirewall or (better) a way to include port forwardings in the guest.conf FIREWALL directive? I use rules like the following to forward ports from the hardware nodes IP to guests. iptables -t nat -A PREROUTING -p tcp -d HWnodeIP --dport 222 -i eth0 -j DNAT --to-destination GuestPrivateIP:22

thanks marl

jnorell commented 8 years ago

Just use custom rules in either /etc/vz/conf/0.conf or in the container's /etc/vz/conf/ctid.conf file. The latter can use $THIS as a placeholder for your GuestPrivateIP, but HWnodeIP will have to be hard-coded in either file.