Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 09-03-2005, 11:19 PM   #1
LQ Newbie
Registered: Sep 2005
Location: India
Posts: 2

Rep: Reputation: 0
Question How to capture & reorder the packets between two PC's

Hi Everybody,
For a testing purpose in my company,I have to introduce reordering,burstiness & error packets between two PC's in the network.i.e My Linux PC should activate as a switch.The packets should be captured and reorderd before forwarding to destination.How can I program to this situation with respect to OSI layers.
Please help me !

Thanks & Regards,
Old 09-04-2005, 01:22 AM   #2
Registered: Oct 2003
Posts: 568

Rep: Reputation: 30
I would use the net modules in Perl to receive them, and then based on the sequence number of the packet, reorder them, and send.
I'm curious, why would you want to do this? Depending on the number of packets being sent, you are talking about a huge lag here. Not to mention, you would also have to code the ability to negotiate with the server machine as though you were the client. This would basically be a man in the middle spoof, to reorder packets?

Functioning as a switch, a Linux machine will forward the packets as any other switch would.
It should be up to the receiving machine to reorder/request retransmission of packets.

Last edited by PenguinPwrdBox; 09-04-2005 at 01:24 AM.
Old 09-04-2005, 02:25 AM   #3
LQ Newbie
Registered: Sep 2005
Location: India
Posts: 2

Original Poster
Rep: Reputation: 0
Hi Penguin...!
Thanks for replying me. What my actual need is,I have a testing tool( software in Linux ) in my Linux PC which acts as router between two PC's. Actually it can drop,duplicate,can delay the incoming packets since it act in IP layer.Now the need is to add some options like reordering of packets, changing the fields of packets,introducing packets in bursty nature to destination. What my question is how can i capture all the incoming packets regardless of TCP,UDP,ICMP or any more with respect to Linux programming. Some told to use raw sockets,where i came to know that only a copy of packets is sent to raw sockets & we can't avoid sending packets to kernel. If i reorder the copy of packets how can i send my reorderd packets instead of kernel forwarding packets.I have to finish within this week.

Please reply me with linux programming concepts !

Thanks in advance,


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
How to Capture Raw Packets (no Decode) with PCAP kidskc Programming 1 11-02-2005 04:54 PM
reorder partition lables Rojahon Linux - Hardware 2 07-09-2005 06:29 PM
How can I use ethereal to capture packets from other computer on the same switch/hub? abefroman Linux - Security 8 05-12-2005 10:58 AM
how can i use libpcap to capture packets for the local loopback interface (lo) ? gajaykrishnan Programming 0 02-22-2005 04:03 AM
Simple sh script: rand reorder Sinope Programming 2 09-11-2004 05:24 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:43 AM.

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