On 06 Jan 2005
(E-Mail Removed) (Luke Robertson) wrote in
comp.os.linux.security
[news:(E-Mail Removed)]:
> I have been trying to get port forwarding working on my Linux gateway.
>
> I have a D-Link DSL604+ Router, with DMZ set to forward all traffic to
> my Linux box. From there, I want to port forward/redirect to other
> boxes - using iptables - (eg, port 3389 & 80 to a windows box).
>
> I have tried using commands like this:
> iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 80 -j DNAT --to
> 192.168.0.2:80
>
> I still haven't been able to get it to work.
What is your default policy on the FORWARD chain? If it is not set to
ACCEPT, you'll need a rule to allow packets to 192.168.0.2, 80/TCP.
iptables -A FORWARD -p tcp -d 192.168.0.2 --dport 80 -j ACCEPT (--syn -o
ethx)
If using the --syn flag, you should have a RELATED state rule in the
FORWARD chain also. ethx = network interface of the 192.168.0.x subnet.
Make sure you have ip forwarding enabled (/proc/sys/net/ipv4/ip_forward is
1)
> [root@tux iptables-1.2.11]# iptables -V
> iptables v1.2.7a
Do a "which iptables". You probably have 1.2.7a in /usr/sbin and 1.2.11 in
/usr/local/sbin.
--
Thaddaeus Kong
Some things are true, even if you choose not to believe them.