0

I wonder if it's possible at all because i can't seem to do port 80 forwarding when webserver service is not installed.

For example, this is my vpn server where a user or machine has connected:

ppp0      Link encap:Point-to-Point Protocol  
          inet addr:192.168.1.1  P-t-P:192.168.1.2  Mask:255.255.255.255

I want to forward all web (port 80) to this connection because the websites are located on the user's machine instead.

I have used nginx to do proxy pass to 192.168.1.2 and it worked. I want to know if it's possible with iptables without installing nginx.

Thanks.

1 Answers1

1

Solved.

edit /etc/ppp/ip-up.d/somefile on the user's machine and add:

$someserver=192.168.0.123
iptables -A PREROUTING -t nat -p tcp -i $1 -m multiport --dports 80,443 -j DNAT  --to $someserver

On the vpn server:

iptables -t nat -A  PREROUTING -p tcp  -m multiport --dports 80,443 -j DNAT --to 192.168.1.2