Forward ports to OpenVPN clients in Centos

1)

iptables -A FORWARD -p tcp -i eth0 -d client_ip_address --dport port_number -j ACCEPT

2)

iptables -t nat -A PREROUTING -p tcp -d server_public_ip_address --dport port_number -j DNAT --to-destination client_ip_address:port_number

for OpenVz

1)

iptables -t nat -A PREROUTING -p tcp --dport port_number -i venet0 -j DNAT --to-destination client_ip_address

2)

iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE

3)

iptables -I FORWARD -p tcp -i venet0 -d client_ip_address --dport port_number -j ACCEPT
Categories: OpenVPN Tags: , , , ,
%d bloggers like this: