(E-Mail Removed) wrote:
> I am having trouble getting port forwarding to work for some ports
> through a nat'ed cisco/iptables topology.
>
> Example:
>
> [Internet] <-----> [Cisco 678 (NAT)] <-----> [Linux IPTables (NAT)]
> <-----> [Local Network]
>
> Cisco external interface is wan0-0 and ip is dynamic
> Cisco internal interface is eth0 and ip is 192.168.1.1
>
> Linux external interface is eth0 and ip is 192.168.1.2
> Linux internal interface eth1 and ip is 192.168.0.1
>
> Local Network subnet 192.168.0.0/24
>
> Preforming a port scan from the Internet against the Cisco public ip
> address yields 2 open ports:
>
> 23/telnet
> 80/http
>
> I configure the Cisco to port forward using the following NAT rule:
>
> set nat entry add 192.168.1.2 22 tcp
>
> Preforming a port scan from the Internet against the Cisco public ip
> address then yields 3 open ports:
>
> 22/ssh
> 23/telnet
> 80/http
>
> I can then configure the Linux IPTables to port forward the ssh
> connection to another internal box with:
>
> Linux external interface is eth0 and ip is 192.168.1.2
> Linux internal interface eth1 and ip is 192.168.0.1
>
> daemon /sbin/iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 22 -m
> state --state NEW,ESTABLISHED,RELATED -j ACCEPT
>
> daemon /sbin/iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 22 -j
> DNAT --to 192.168.0.15:22
>
> This works great!
>
> Now... When I try to do the same thing with say 3389/rdp, I am never
> able to scan port 3389 open on the Cisco public ip address. I have
> tried several ports (25, 110, 143, 6000) with negative results.
>
> If I scan the local network pc with these services, I am able to detect
> that they are open.
>
> Any idea as to why port 22/ssh will forward, but I can't get other
> ports like 3389/rdp to work?
Hi,
Are you doing the port scan on cisco after adding the nat entry(3389)
but without the corresponding iptables entry in Linux ???
In which case I would suggest you set nat entry for 3389(router) and
also enable the DNAT and FORWARD for 3389(Linux) just as you did before
for SSH and then try.
It should work. Why did it work with SSH even before iptables then????
That's because I presume you would have had the SSH port open on the
Linux box by default but not the others like 3389, smtp etc. A
succesful portscan must have a complete path to the destination port.
If you just put the nat entry it will scan your linux box for 3389
which will fail unless correctly DNATted.
Also from what I observe you should have a reverse entry also in the
FORWARD chain unless your policy is set to ACCEPT in which case you
dont need the FORWARD entry at all. In general it's better to use a
DROP policy in the filter table chains and allow explicitly.