Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .