LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-26-2010, 12:58 AM   #1
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Rep: Reputation: 45
IPTABLES Three way Hand shack ?


Hi,
I need a rule for my IPTABLE for three way hand shack method. Example in a datail.

Code:
1-Host A sends a TCP SYNchronize packet to Host B

2-Host B receives A's SYN

3-Host B sends a SYNchronize-ACKnowledgement

4-Host A receives B's SYN-ACK

5-Host A sends ACKnowledge

6-Host B receives ACK. 
  TCP socket connection is ESTABLISHED
well by this step a normal user can understand how two computers communicate each others.Please can u help me that how can I write a rule using iptables for three way Hand shack.

thanks
mypass
 
Old 11-26-2010, 01:31 AM   #2
kaushalpatel1982
Member
 
Registered: Aug 2007
Location: INDIA
Distribution: CentOS, RHEL, Fedora, Debian, Ubuntu, LinuxMint, Kali Linux, Raspbian
Posts: 166

Rep: Reputation: 10
iptables -A INPUT -s A -d B --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -s B -d A --state NEW,ESTABLISHED,RELATED -j ACCEPT
 
Old 11-26-2010, 02:53 AM   #3
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Original Poster
Rep: Reputation: 45
Thanks "kaushalpatel" for the reply. Well can we break the IP table in more comprehensive way like as following



Code:
PC A to PB B
1- # iptables -A INPUT -sA -dB -m state --state NEW -j ACCEPT i.e PC A  connect to PC B.

2- # iptables -A INPUT -sB -dA -m state --state RELETED -j APPEPT i.ePC B send Sync and Acknow to PC A.

3- # iptables -A INPUT -sA -dB -m state --state ESTABLISH -J accept i.e connection establish

PC B to PB A

4- # iptables -A INPUT -sB -dA -m state --state NEW -j ACCEPT    

5- # iptables -A INPUT -sA -dB -m state --state RELETED -j APPEPT

6- # iptables -A INPUT -sB -dA -m state --state ESTABLISH -J accept

is it correct  ?
 
0 members found this post helpful.
Old 11-26-2010, 01:16 PM   #4
kaushalpatel1982
Member
 
Registered: Aug 2007
Location: INDIA
Distribution: CentOS, RHEL, Fedora, Debian, Ubuntu, LinuxMint, Kali Linux, Raspbian
Posts: 166

Rep: Reputation: 10
FYI, Number of rules will add delay in the packet transitions. It also add headache for management when the scenarios is wide. In linux I follow the rule "KISS".
 
Old 11-28-2010, 10:01 AM   #5
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Thumbs down

OP, I do hope you clean up the spelling in your commands in post #3 before you use try to use them.
 
Old 11-28-2010, 11:28 AM   #6
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
gardenair, you might want to read up on the RELATED match, because it doesn't do what you seem to think it does. In fact, the RELATED match isn't even necessary for what you have outlined. Example:
Code:
iptables -A FORWARD -m state --state ESTABLISHED -j ACCEPT
iptables -A FORWARD -s $HOST_A -d $HOST_B -m state --state NEW -j ACCEPT
 
  


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
LXer: Linux Training and Laptops Go Hand in Hand at LinuxCertified LXer Syndicated Linux News 0 01-31-2006 12:01 PM
iptables v1.2.9: Unknown arg `/sbin/iptables' Try `iptables -h' or 'iptables --help' Niceman2005 Linux - Security 4 12-29-2005 08:20 PM
httpd out of hand belorion Linux - Software 4 06-21-2004 03:46 PM
USB problems: Memorex USB stick 256MB and PSX to USB adapter by Radio Shack Knuckles T15 Linux - Hardware 1 05-19-2004 06:58 PM
ppp by hand isajera Linux - General 3 11-12-2001 01:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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