Problem: <br> Computer A (Internal Win2k)——-: IP: 10.0.0.1<br> Computer B (Linux Box)————: IP: 22.214.171.124<br> Computer C (General Internet pc)–: IP: 126.96.36.199<br> <br> Computer B has 1 network card. It is on the same LAN as Computer A and has external Internet Access.<br> Computer B can access both Computer A and Computer C.<br> <br> ——————————————————————————-<br> There is a Webserver on Computer A → 10.0.0.1:80<br> Computer C (general internet) cannot access the above Webserver on Computer A.<br> <br> We want to use Computer B to forward all traffic from Computer C to Computer A.<br>
iptables firewall can be used to forward such connections.<br> <br> The Setup:<br>
Going from Scratch: iptables -F # Flush rules from iptables <br> iptables -t nat -F # Flush rules from nat table in iptables <br> iptables -t nat -A PREROUTING -p tcp -d 188.8.131.52 –dport 80 -j DNAT –to 10.0.0.1:80 iptables -t nat -A POSTROUTING -d 10.0.0.1 -j MASQUERADE
If Computer C types http://184.108.40.206 into their Internet, they will see the Webserver on Computer A (10.0.0.1).
This Works. Will get around to perhaps explaining it later.
Look at the complete Iptables_Firewall