I've got a ubuntu server (11.04) installation with routing using iptables running, it all works well, even port forwarding.
Now what I would like to do is enable the "port forwarding" rules on the internal network.
i.e. I have a https-webserver on a internal box at 10.255.72.3:444, I can reach this using https://<domain>:444 perfectly from the outside
And I can reach a Win7 (RDP) machine with <domain>:33891 (translates to 10.255.72.21:3389).
I would like to be able to reach both the https-server and rdp from the inside network using the same addresses, https://<domain>:444 and <domain>:33891.
I know there's a way to accomplish this. I remember on a old opensuse-installation, this was the default behavior.
I installed the new openSUSE to test but they've "disabled" it now.
My setup:
eth0 - Internet
eth1 - 10.255.71.0/24
eth2 - Internal 10.255.72.0/24 (IP: 10.255.72.254)
I've got things working so that I can access the Internet and 10.255.71.0-network from the internal 10.255.72.0.
My ip-tables config:
Code:
# Generated by iptables-save v1.4.10 on Sun Jun 26 10:09:30 2011
*nat
:PREROUTING ACCEPT [21:1994]
:INPUT ACCEPT [17:1685]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -i eth0 -p tcp -m tcp --dport 3389 -j DNAT --to-destination 10.255.72.2
-A PREROUTING -i eth0 -p tcp -m tcp --dport 22 -j DNAT --to-destination 10.255.72.3
-A PREROUTING -p tcp -m tcp --dport 222 -j DNAT --to-destination 10.255.72.254:22
-A PREROUTING -p tcp -m tcp --dport 444 -j DNAT --to-destination 10.255.72.3
-A PREROUTING -p tcp -m tcp --dport 33891 -j DNAT --to-destination 10.255.72.3:3389
-A POSTROUTING -o eth0 -j MASQUERADE
-A POSTROUTING -o eth1 -j MASQUERADE
COMMIT
# Completed on Sun Jun 26 10:09:30 2011
# Generated by iptables-save v1.4.10 on Sun Jun 26 10:09:30 2011
*filter
:INPUT ACCEPT [870:75617]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [468:51729]
-A FORWARD -s 10.255.72.0/24 -i eth2 -j ACCEPT
-A FORWARD -d 10.255.72.0/24 -i eth0 -j ACCEPT
-A FORWARD -d 10.255.72.0/24 -i eth1 -j ACCEPT
COMMIT
# Completed on Sun Jun 26 10:09:30 2011
The weird thing about this setup is that I can access the SSH on the router using <domain>:222, both from the outside AND inside! This is the behavior i want on the other port-forwards to.
CORRECTION Nope I cannot, I can however reach it with 10.255.72.254:222 from the inside.
Any help appreciated!