Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to know how a network packet travels through different layers, i.e. from the physical layer to the presentation layer in Linux systems.

Are there any detailed articles or books on this topic with code?

share|improve this question
    
Ummm... sorry to be harsh but.. something is wrong - you failed to google, yet you answered and upvoted hotei's answer on OSI?! OSI is the key to understanding the different layers...you should not have to worry about the layers - let the network layer take care of it for you, OSI layer 4... –  t0mm13b Sep 28 '10 at 21:22

3 Answers 3

The OSI layer model isn't how networking is actually programmed. You might check this book if you're interested in C code samples:

http://www.amazon.com/Unix-Network-Programming-Sockets-Networking/dp/0131411551/ref=sr_1_1?s=gateway&ie=UTF8&qid=1285699272&sr=8-1

share|improve this answer
    
Thanks for suggestion. Let me check the book. –  ranjit Sep 28 '10 at 18:46
    
This book is not what I exactly wanted. It is mostly on tcp/ip. I want codes for other layers also. –  ranjit Sep 28 '10 at 18:58
    
By other layers you mean ...? –  hotei Sep 28 '10 at 20:39

not cheap, but one of the definite classics. Richad Stevens: "TCP/IP Illustrated Vol.1 The Protocols". Very thorough, covers of course also UDP, ICMP, etc. pp.

If your're into programming, there's also "TCP/IP Illustrated Vol. 2 The Implementation" by Gary Wright.

share|improve this answer
7 Application
6 Presentation
5 Session
4 Transport
3 Network
2 Data
1 Physical

TCP / IP combines certain layers

7-5 Application
4   Transport
3   Internetwork
2-1 Network Access

Conceptually the OSI model looks like this

7 Application---- ------------- Application
6 Presentation--- ------------- Presentation
5 Session-------- ------------- Session
4 Transport------ ------------- Transport
3 Network-------- ---Network--- Network
2 Data----------- ---Data------ Data
1 Physical------- ---Physical-- Physical

Each send layer appears to communicate transparently to the corresponding receive layer. In routed networks (middle column) the same is true.

As a packet descends from 7 to 1 each layer attaches header information that the layer below sees as a Protocol Data Unit. As the packet ascends the the model each layer removes the header.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.