Iptables forward

From Wiki

Jump to: navigation, search

Computer A (Internal Win2k)-------: IP:
Computer B (Linux Box)------------: IP:
Computer C (General Internet pc)--: IP:

Computer B has 1 network card. It is on the same LAN as Computer A and has external Internet Access.
Computer B can access both Computer A and Computer C.

There is a Webserver on Computer A ->
Computer C (general internet) cannot access the above Webserver on Computer A.

We want to use Computer B to forward all traffic from Computer C to Computer A.

iptables firewall can be used to forward such connections.

The Setup:

Going from Scratch:

iptables -F
# Flush rules from iptables

iptables -t nat -F # Flush rules from nat table in iptables
iptables -t nat -A PREROUTING -p tcp -d --dport 80 -j DNAT --to iptables -t nat -A POSTROUTING -d -j MASQUERADE

If Computer C types into their Internet, they will see the Webserver on Computer A (

This Works. Will get around to perhaps explaining it later.

Look at the complete Iptables_Firewall

Further Information at:

Personal tools