[LUGSB] webserver and iptables

Louis Young louis at kwikpay.co.za
Sun Mar 28 08:37:16 EST 2004


Hi there

 

I'm trying to set up my firewall to allow access to my webserver. On the
firewall I have an external and an internal interface with an external and
internal ip address for my webserver. My rules are set up as follows:

 

# Set variables to store the ip addresses in

PROXY_EXT=external_firewall_ip

ONLINE_EXT=external_webserver_ip

ONLINE_INT=internal_webserver_ip

 

INT_IF=eth0

EXT_IF=eth1

 

# Set up source NAT to external interface

iptables -t nat -A POSTROUTING -o $EXT_IF -j SNAT --to $PROXY_EXT

 

# Set up destination NAT to internal interface for ONLINE

iptables -t nat -A PREROUTING -p tcp -d $ONLINE_EXT --dport 80 -i $EXT_IF -j
DNAT --to $ONLINE_INT

 

# Incoming and outgoing traffic on port 80 (HTTP) on ONLINE

iptables -I FORWARD -p tcp --dport 80 -s $ONLINE_INT -d $ONLINE_EXT -i
$INT_IF -o $EXT_IF -j ACCEPT

iptables -I FORWARD -p tcp --dport 80 -s $ONLINE_EXT -d $ONLINE_INT -i
$EXT_IF -o $INT_IF -j ACCEPT

 

When I try and access the website, all I get is a page not found error.

Any help will be highly appreciated.

 

Thanks

Louis

 




More information about the lugsb mailing list