Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
iptables multiple --dports ?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
njcwotx
Guru
Guru


Joined: 25 Feb 2005
Posts: 564
Location: Texas

PostPosted: Tue Feb 11, 2014 5:30 pm    Post subject: iptables multiple --dports ? Reply with quote

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.
Sometimes sipping.
Sometimes gulping.
Always thirsting.
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Tue Feb 11, 2014 7:06 pm    Post subject: Reply with quote

Code:
man iptables-extensions

And search for multiport.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum