Joined: 25 Feb 2005
|Posted: Tue Feb 11, 2014 5:30 pm Post subject: iptables multiple --dports ?
|I have several ports to open and close from a script regularly.
Up to now, I have been doing one --dport per line, but when I attempt to give it a list of --dports, it fails.
For Example this works..
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
but this fails...
iptables -A INPUT -p tcp --dport 80,443 -j ACCEPT
the only difference is I gave it a comma separated list.
I know that the : operator can give a RANGE, but these are obviously separated by many other ports.
iptables -A INPUT -p tcp --dport 80:443 -j ACCEPT
Is there a way to give it a list of separate ports without going into multiple lines?
Drinking from the fountain of knowldege.