Can iptables REDIRECT traffic to a range of ports in one command?
Hi Guys,
I would like to intercept traffic to a range of ports, say port 2000-3000 to one port locally, say port 3333. I am wondering if there is a simple way to do it, like specify a range in iptables instead of writing a script to speficy for each port?
Thanks,
Grace
_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN Premium http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
Quoted 7 lines · Grace Li
I would like to intercept traffic to a range of ports, say port 2000-3000 to one port locally, say port 3333. I am wondering if there is a simple way to do it, like specify a range in iptables instead of writing a script to speficy for each port?
From the manual:
--destination-port [!] port[:port]
Destination port or port range specification. The flag --dport is a convenient alias for this option.
Regards
Henrik
this is what you look for;
10.0.0.1 is the ip of destination machine
iptables -t nat -A PREROUTING -p tcp -d 10.0.0.1 --dport 2000:3000 -j DNAT --to 10.0.0.1:3333
Signature · 1 line
Ozgur Akan