LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 03: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, 05:01 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
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, 06: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



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 10:25 AM
Basic question regarding squid nd iptables Net_Spy Linux - Newbie 1 09-25-2010 12:31 AM
Basic iptables help manueljose Linux - Security 3 01-03-2006 09:16 AM
iptables basic question Fordor Linux - Networking 5 10-12-2005 05:30 PM
very basic question about labels in iptables celadoreuk Linux - Networking 0 10-05-2004 10:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:03 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