I have a OpenVPN acces server running on a cent OS 6 x32 VPS. I followed instructions from
thisthread to forward 777 port to client machine (Windows 8). What was done:
1. Client has static internal ip 172.27.208.2
2. Web-server runs on a client on 777 port.
3. Opened 777 port on client firewall
4. Checked that webserver is accessible from client on internal address
http://172.27.208.2:777/index.html
5. Added iptables rules on server:
IPT=which iptables
SYSCTL=which sysctl
ext_if="venet0" # The ethernet adapter for the ext_ip (xxx.xxx.xxx.xxx) of the OpenVPN AS
int_if="as0t1" # The tun-adapter for client with vpn ip 172.27.208.2
int_ip="172.27.208.2" # static IP address in internal VPN network
$SYSCTL -w net.ipv4.ip_forward = 1 # Enable IP forwarding
$IPT -t nat -A PREROUTING -p tcp -i $ext_if --dport 777 -j DNAT --to $int_ip:777
$IPT -A FORWARD -p tcp -i $ext_if -o $int_if -d $int_ip --dport 777 -m state --state NEW -j ACCEPT
$IPT -A FORWARD -i $ext_if -o $int_if -d $int_ip -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -A FORWARD -i $int_if -s $int_ip -o $ext_if -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -t nat -A POSTROUTING -j MASQUERADE -o $int_if
As a result I'm unable to access webserver from http://ext_ip:777/index.html.
Also if I run
curl --interface as0t1 http://172.27.208.2:777/index.html
on a server I get no response.
What am I missing/doing wrong?
Thanks.