RE: Port Forwarding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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



[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux