2. Overview
2.1. Relation to Other Protocols
The internet protocol interfaces on one side to the higher level host-to-host protocols and on the other side to the local network protocol. In this context a "local network" may be a small network in a building or a large network such as the ARPANET.
Protocol Stack
+-------------+
| Application |
+-------------+
| TCP | TCP/UDP/ICMP
+-------------+
| IP | Internet Protocol (this document)
+-------------+
| Local Net | Ethernet, WiFi, etc.
+-------------+
Relationship Diagram
+------+ +-----+ +-----+ +-----+
|Telnet| | FTP | | ... | |Voice|
+------+ +-----+ +-----+ +-----+
| | | |
+-----+ +-----+ +-----+
| TCP | | UDP | | ... |
+-----+ +-----+ +-----+
| | |
+-------------------------------+
| Internet Protocol & ICMP |
+-------------------------------+
|
+-------------------------------+
| Local Network Protocol |
+-------------------------------+
Key Protocols
- TCP (Transmission Control Protocol): Provides reliable, ordered, error-checked delivery of data
- UDP (User Datagram Protocol): Provides connectionless datagram service
- ICMP (Internet Control Message Protocol): Used for error reporting and diagnostics
- Local Network Protocols: Ethernet, Token Ring, ARPANET, etc.
2.2. Model of Operation
The model of operation for transmitting a datagram from one application program to another is illustrated by the following scenario:
Transmission Scenario
Application A (Host 1) → IP Module → Gateway → IP Module → Application B (Host 2)
Detailed Flow
-
Application sends data
- Application A prepares data to send
- Passes data to TCP or UDP
-
TCP/UDP processing
- Adds transport layer header
- Passes segment/datagram to IP
-
IP module (Source Host)
- Adds IP header with addresses
- Determines routing (direct or via gateway)
- Fragments if necessary
- Passes to local network
-
Local network transmission
- Encapsulates in network frame
- Transmits to next hop
-
Gateway processing (if needed)
- Receives IP datagram
- Checks destination address
- Determines next hop
- Decrements TTL
- May fragment further
- Forwards to next network
-
IP module (Destination Host)
- Receives IP datagram
- Checks if destination matches
- Reassembles if fragmented
- Passes to upper layer protocol
-
TCP/UDP processing
- Processes transport header
- Delivers data to application
-
Application receives data
- Application B receives the data
Datagram Journey Example
Host A Gateway 1 Gateway 2 Host B
| | | |
| 1. Send datagram | | |
|------------------->| | |
| | 2. Route & forward | |
| |------------------->| |
| | | 3. Route & forward |
| | |------------------->|
| | | | 4. Deliver
| | | |
2.3. Function Description
The purpose of the internet protocol is to move datagrams through an interconnected set of networks. This is done by passing the datagrams from one internet module to another until the destination is reached.
Core Functions
1. Addressing
- Each datagram contains source and destination addresses
- 32-bit addresses identify hosts uniquely
- Network and host portions enable hierarchical routing
2. Routing
- Selection of path through interconnected networks
- Based on destination address and routing tables
- Can be direct delivery or indirect through gateways
3. Fragmentation and Reassembly
- Large datagrams split into smaller fragments
- Necessary when MTU (Maximum Transmission Unit) varies
- Fragments reassembled at final destination only
4. Type of Service
- Indicates desired quality of service
- Parameters: precedence, delay, throughput, reliability
- Used by gateways for routing decisions
5. Time to Live
- Limits datagram lifetime in the internet
- Prevents infinite loops
- Decremented at each hop
6. Options
- Security parameters
- Source routing
- Route recording
- Timestamps
7. Header Checksum
- Protects header integrity
- Recomputed at each hop (due to TTL changes)
- Does not protect data payload
Internet Module Responsibilities
The internet modules (especially in gateways) determine that datagrams are correctly formatted, have valid addresses, and are routed toward their destinations. Key responsibilities include:
- Error Detection: Validate header checksum
- TTL Management: Decrement and check TTL
- Fragmentation: Split datagrams when needed
- Reassembly: Reconstruct original datagram at destination
- Option Processing: Handle IP options
- ICMP Generation: Report errors via ICMP
Addressing Scheme
Class A: 0NNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH
- 0.0.0.0 to 127.255.255.255
- 128 networks, 16,777,216 hosts each
Class B: 10NNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH
- 128.0.0.0 to 191.255.255.255
- 16,384 networks, 65,536 hosts each
Class C: 110NNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH
- 192.0.0.0 to 223.255.255.255
- 2,097,152 networks, 256 hosts each
Class D: 1110XXXX.XXXXXXXX.XXXXXXXX.XXXXXXXX
- 224.0.0.0 to 239.255.255.255
- Multicast
Class E: 1111XXXX.XXXXXXXX.XXXXXXXX.XXXXXXXX
- 240.0.0.0 to 255.255.255.255
- Reserved for future use
2.4. Gateways
Gateways implement internet protocol to forward datagrams between networks. A gateway is attached to two or more networks, and receives datagrams from one network and forwards them to another network.
Gateway Functions
1. Routing
- Maintain routing tables
- Determine next hop for each datagram
- May use routing protocols (RIP, OSPF, etc.)
2. Fragmentation
- May need to fragment datagrams
- Occurs when next network has smaller MTU
- Does NOT reassemble (only destination does)
3. TTL Management
- Decrement TTL by at least 1
- Discard datagram if TTL reaches 0
- Send ICMP Time Exceeded message to source
4. Error Handling
- Detect various error conditions
- Generate ICMP error messages
- Forward errors to source
5. Option Processing
- Process IP options
- Add timestamps if requested
- Handle source routing
Gateway Architecture
Network A Gateway Network B
+---------+ +----------+ +---------+
| | | | | |
| Host A |---------| Router |---------| Host B |
| | | | | |
+---------+ +----------+ +---------+
| | |
| | |
IP Module IP Module IP Module
Local Net A Both Nets Local Net B
Gateway Processing Steps
1. Receive datagram from network interface
2. Verify header checksum
3. Check if destination is local
- Yes: Deliver to host
- No: Proceed to forward
4. Decrement TTL
- If TTL = 0: Discard, send ICMP
5. Look up routing table for next hop
6. Check if fragmentation needed
- If DF flag set and fragmentation needed:
Discard, send ICMP
- Otherwise: Fragment if needed
7. Recompute header checksum
8. Forward to next network interface
Routing Table Example
| Destination Network | Next Hop | Interface | Metric |
|---|---|---|---|
| 10.0.0.0/8 | Direct | eth0 | 0 |
| 192.168.1.0/24 | Direct | eth1 | 0 |
| 0.0.0.0/0 | 10.0.0.1 | eth0 | 10 |
Gateway Responsibilities
- Do NOT reassemble fragments (only final destination does)
- Do fragment if necessary
- Must decrement TTL
- Must recompute header checksum after any modification
- Should implement ICMP for error reporting
- May use Type of Service for routing decisions
Summary
The Internet Protocol provides a connectionless, best-effort datagram delivery service. It operates between the higher-level host-to-host protocols (like TCP) and the underlying network protocols. Key features include:
- Universal addressing across interconnected networks
- Routing through gateways
- Fragmentation for different network MTUs
- Simple, stateless operation
- No reliability guarantees (handled by upper layers)
This design enables the Internet to be scalable, flexible, and robust, supporting diverse networks and applications.