Skip to contentSkip to conversation

Port Forwarding

DISCUSSION Jason Mallory 2 participants 2 messages Oct 27, 2003 – Oct 28, 2003

lore
Share & tools
lore
#0 lore raw

I am tring to do a simple port forwarding from the Internet to a mcahine on my LAN. This has proven IMPOSSIBE! No matter how I try to forward ports, its not working. I am thinking about just setting up a simple Windows XP box and doing it that way after trying for 12 hours and 5 different configuration methods. Any last suggestions before I switch?

#1 lore raw
Quoted 2 lines

I am tring to do a simple port forwarding from the Internet to a mcahine on my LAN. This has proven IMPOSSIBE! No matter

Sure it's possible. But you didn't tell us what you have already done !

For http (make sure your routing tables are correct) :
----------------
if_inet="eth0"
if_lan="eth1"
ip_webserver="192.168.1.100"

echo 0 > /proc/sys/net/ipv4/ip_forward

iptables -P FORWARD DROP
iptables -A FORWARD -m state --state RELATED,ESTABLISHED \
-j ACCEPT
iptables -A FORWARD -i $if_inet -o $if_lan -p tcp --dport 80 \
-j ACCEPT
iptables -t nat -A PREROUTING -i if_inet -p tcp --dport 80 \
-j DNAT --to-destination $ip_webserver

echo 1 > /proc/sys/net/ipv4/ip_forward
----------------

Gr,
Rob