[NTLUG:Discuss] simple portforwarding firewall
Jay Urish
j at yourlinuxguru.com
Fri Jun 21 14:39:04 CDT 2002
Hey yall;
I need a shove in the right direction..
I am trying to forward all requests to port 80 on a clean side box from the
internet through a iptables firewall..
The following script is not working..
I am looking for 4 -5 lines to do this..
What am I missing? I have been to a pile of netfilter sites and that is
where I got what I have.
I need another set off eyes to look this over and catch my goof.
----
#This is a cheesey script by j at yourlinuxguru.com
#feel free to modify it at your own risk.
#I need to set default rules first
#!/bin/sh
# Flush current settings
iptables -P INPUT ACCEPT
iptables -F INPUT
iptables -P OUTPUT ACCEPT
iptables -F OUTPUT
iptables -F FORWARD
iptables -t nat -F
#I need to load a module
/sbin/modprobe iptable_nat
#I am enabling ip forwarding right here
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A PREROUTING -t nat -p tcp -d 63.64.250.206 --dport 80 -j DNAT
--to 192.168.2.30:80
#Now I make sure packets can forward
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
More information about the Discuss
mailing list