iptables port forward
hello, quick question: i want to port forward those that enter at x:80 to internal address y:7865, how can i do that with iptables?
iptables -t nat -I PREROUTING 4 -i eth0 -d x -p tcp --dport 80 -j DNAT --to y when/how do i specify port 7865?
thank you,
tomas bonnedahl
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Hi there Tomas!
: iptables -t nat -I PREROUTING 4 -i eth0 -d x -p tcp --dport 80 \
: -j DNAT --to y when/how do i specify port 7865?
This should do the trick:
iptables -t nat -I PREROUTING 4 -i eth0 -d $PUB_IP -p tcp --dport 80 \
-j DNAT --to-destination $PRIV_IP:7865Check out Oskar Andreeason's tutorial on this very matter.
http://iptables-tutorial.frozentux.net/iptables-tutorial.html#DNATTARGET
Ciao for now,
-Martin
Signature · 5 lines
Martin A. Brown --- SecurePipe, Inc. --- [email protected] _______________________________________________ LARTC mailing list / [email protected] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
thank you martin.. i haven't tried it yet but i trust you ;)
best,
tomas
Quoted 10 lines · Martin A. Brown
Hi there Tomas!
: iptables -t nat -I PREROUTING 4 -i eth0 -d x -p tcp --dport 80 \
: -j DNAT --to y when/how do i specify port 7865?This should do the trick:
iptables -t nat -I PREROUTING 4 -i eth0 -d $PUB_IP -p tcp --dport 80 \ -j DNAT --to-destination $PRIV_IP:7865
Quoted 14 lines
Check out Oskar Andreeason's tutorial on this very matter.
http://iptables-tutorial.frozentux.net/iptables-tutorial.html#DNATTARGET
Ciao for now,
-Martin
Signature · 5 lines
Martin A. Brown --- SecurePipe, Inc. --- [email protected] _______________________________________________ LARTC mailing list / [email protected] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/