LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-20-2017, 08:07 PM   #1
schnappi
Member
 
Registered: Apr 2017
Posts: 52

Rep: Reputation: 3
Is this a valid iptables rule?


Code:
-A INPUT -i lo -p tcp --dport 80 --dport 443 -j ACCEPT
Wondering if can include two ports in the same rule and if an interface (-i lo) can be specified in addition to a protocol (-p tcp).
 
Old 06-20-2017, 09:34 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,767

Rep: Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209
Quote:
Originally Posted by schnappi View Post
Code:
-A INPUT -i lo -p tcp --dport 80 --dport 443 -j ACCEPT
Wondering if can include two ports in the same rule and if an interface (-i lo) can be specified in addition to a protocol (-p tcp).
Not that way, but that's exactly what "--dports" does.
Code:
-A INPUT -i lo -p tcp -m multiport --dports 80,443 -j ACCEPT
You have to specify the "multiport" module to make "--dports" available.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables rule amartlk Linux - Security 1 01-25-2012 01:55 AM
iptables: rule with RETURN target just after a rule with ACCEPT target Nerox Linux - Networking 6 09-04-2011 03:33 PM
[SOLVED] IPtables rule szboardstretcher Linux - Security 7 02-24-2011 07:30 PM
iptables rule help the_gripmaster Linux - Security 3 05-15-2007 07:19 AM
What is it doing this iptables rule?? lanczer Linux - Security 1 02-24-2006 11:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration