LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-14-2014, 04:06 AM   #1
kbnuts
Member
 
Registered: Apr 2014
Posts: 45

Rep: Reputation: Disabled
Basic iptables question


Hi, I'm mondering why people set both protocol and match in rules..

eg:

-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT

surely just

-A INPUT -p tcp --dport 22 -j ACCEPT

is sufficient as you've already said you're examining the tcp protocol so don't need to then also "match" it.

Or am I missing something?
 
Old 10-14-2014, 06:01 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 5,387

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
It is as the manual says, use -m --match if you want to use extension module to test specific property (--dport 22 property for example with tcp module)

But in your example, tcp match is implicitly set with -p tcp, so you don't need to explicitly use -m tcp here
 
1 members found this post helpful.
Old 10-14-2014, 07:00 AM   #3
kbnuts
Member
 
Registered: Apr 2014
Posts: 45

Original Poster
Rep: Reputation: Disabled
Ah good, so it's not functionally needed there, it's just "good grammar".
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic iptables help GrepAwkSed Linux - Security 4 03-23-2012 11:25 AM
Basic question regarding squid nd iptables Net_Spy Linux - Newbie 1 09-25-2010 01:31 AM
Basic iptables help manueljose Linux - Security 3 01-03-2006 10:16 AM
iptables basic question Fordor Linux - Networking 5 10-12-2005 06:30 PM
very basic question about labels in iptables celadoreuk Linux - Networking 0 10-05-2004 11:50 AM


All times are GMT -5. The time now is 02:44 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration