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?
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?
The OSI layer model isn't how networking is actually programmed. You might check this book if you're interested in C code samples:
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.
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.