Skip to contentSkip to conversation

--sport

DISCUSSION Patrick Ahler 4 participants 5 messages Mar 5, 2003

lore
Share & tools
lore
#0 lore raw

1. Is there a way to specify a range of source ports when setting a rule. My ftp server uses ports 5000-5020 for passive but I don't want to have to write a rule for each port. (For a network firewall). The ftp server is behind the firewall.

iptables -A FORWARD -p tcp --sport 5000 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

#1 lore raw

What you need is the mport-match:

iptables -A FORWARD -p tcp -m mport --sport 5000:5020 -m state ...

Sven

Quoted 13 lines · Patrick Ahler

1. Is there a way to specify a range of source ports when setting a rule. My ftp server uses ports 5000-5020 for passive but I don't want to have to write a rule for each port. (For a network firewall). The ftp server is behind the firewall.

iptables -A FORWARD -p tcp --sport 5000 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

#2 lore raw
Quoted 3 lines · Sven Schuster

What you need is the mport-match:

iptables -A FORWARD -p tcp -m mport --sport 5000:5020 -m state ...

mport is not needed for a simple range

Signature · 3 lines
/Martin

Never argue with an idiot. They drag you down to their level, then beat you with experience.
#3 lore raw

Yes I actually recognized it _after_ posting :-)

My mistake...

Quoted 2 lines · Martin Josefsson

mport is not needed for a simple range