Iptables - Port Forwading

Jonas Schrieb jschrieb at game-sites.de
Fri Dec 14 17:40:03 CET 2001


Heiko Kattenstroth wrote:
 > iptables -t nat -A PREROUTING -p tcp --destination-port ... -i eth1
 > -j DNAT --to 192.168.1.3

sollte einfach so funktionieren ...

SOURCE           DESTINATION
x.x.x.x:xxx      1.2.3.4:5678     (so kommst rein)
x.x.x.x:xxx      192.168.1.3:5678 (so siehts nachm DNAT aus)
192.168.1.3:5678 x.x.x.x:xxx      (so gehts zurück)
1.2.3.4:5678     x.x.x.x:xxx      (so siehts nachm MASQUERADE/SNAT aus)

Also so zB funktionieren bei mir ohne Probleme direkte
licq-Verbindungen. (licq lauscht an den Ports 5000-5020):

# eingehende tcp-pakete auf port 5000-5020 zu jonas routen (fuer icq)
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 5000:5020 -j DNAT
--to jonas
# ausgehende pakete mit inet-ip versehen
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

MfG      Jonas

-- 
GeekCode Version: 3.12
GCS d- s: a17 UL++>++++$ C++(+++)>++(+) P>++ L++>++++$ W++ N
o? K? w-(--) O(?) M(?) V? PS+ PE-(--) Y+ PGP->++ t+ 5 X+ R
tv-() b+() DI? D++(+) G>++++$ e(*)>++++ h!+()>(---) r-(++) y




More information about the Linux mailing list