LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-13-2010, 07:31 PM   #1
sang_froid
Member
 
Registered: Oct 2006
Posts: 179

Rep: Reputation: 15
iptables question


Hi,
I am not clearly getting the following two Iptables rules...can anyone shed some light on it ?

Thank you

Quote:

-A POSTROUTING -s 192.168.4.6 -p tcp -m tcp --dport 9111 -j SNAT --to-source 202.152.251.6

-A POSTROUTING -s 192.168.5.0/255.255.255.0 -j MASQUERADE
 
Old 05-13-2010, 07:34 PM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
-A POSTROUTING -s 192.168.4.6 -p tcp -m tcp --dport 9111 -j SNAT --to-source 202.152.251.6
This rule says: If this is a TCP packet, with source address 192.168.4.6, and destination port 9111, change the source address to 202.152.251.6.

Quote:
-A POSTROUTING -s 192.168.5.0/255.255.255.0 -j MASQUERADE
This rule says: If this packet has a source address within the 192.168.5.0/255.255.255.0 netblock, change the source address to whatever the primary IP of the outbound interface is.
 
Old 05-13-2010, 08:19 PM   #3
IRIGHTI
Member
 
Registered: Oct 2003
Distribution: Slackware64 13.1 x86_64, Ubuntu 10.04 x86_64
Posts: 121

Rep: Reputation: 15
I don't believe your first rule is necessary, and it looks to be detrimental considering you didn't specify an interface. Then again I may be missing something.
 
Old 05-14-2010, 04:21 AM   #4
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by IRIGHTI View Post
Then again I may be missing something.
You probably are, since the OP gave two rules and no context. It seems to be an odd thing to want to do, but I'm not sure that you can say much more than that if you do not know anything about the network set-up and nothing about the rest of the iptables ruleset.
 
Old 05-14-2010, 09:12 AM   #5
sang_froid
Member
 
Registered: Oct 2006
Posts: 179

Original Poster
Rep: Reputation: 15
Thank you for the reply. I also don't know why the first rule has been kept.

In that case, the second rule bascially does NATTING...am i correct ?
 
Old 05-14-2010, 10:01 AM   #6
HasC
Member
 
Registered: Oct 2009
Location: South America - Paraguay
Distribution: Debian 5 - Slackware 13.1 - Arch - Some others linuxes/*BSDs through KVM and Xen
Posts: 329

Rep: Reputation: 55
Perhaps the first rule it's for some sort of server listening on 192.168.4.6:9111
 
Old 05-14-2010, 03:16 PM   #7
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by sang_froid View Post
In that case, the second rule bascially does NATTING...am i correct ?
They both do NAT.
 
  


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
iptables Question wh1terabb1t Linux - Networking 1 05-16-2008 06:03 PM
iptables question cashton2k Linux - Security 8 12-01-2005 08:43 AM
Question on IPTABLES brokenflea Linux - Networking 3 02-10-2004 09:53 PM
IPtables Question jacovds Linux - Security 10 11-17-2003 09:46 AM
iptables question Texicle Slackware 7 01-19-2003 12:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:36 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
Open Source Consulting | Domain Registration