Internet Protocol (IP) – In Depth
The Internet Protocol (IP) is a network layer protocol responsible for addressing and routing data packets across networks. It ensures that data sent from a source device reaches the correct destination.

Version of IPv4 datagram is 4. it means we are using 4th generation addressing in internet protocol. It uses 4 bit in IPv4 datagram. |
HLEN field is a 4 bit annotation. It means by using this 4 bit we can calculate size of header in datagram. The minimum value of Header length field is 5 and maximum value of Header length field is 15. By using scaling factor of 4 we are calculate the size of Header in IPv4 datagram. The minimum size of IPv4 header is 5×4=20 Byte and the maximum size of header field is 15×4=60 Byte. |
Service type is a 8 bit field in IPv4 datagram header. starting 3 bits are denoted as precedence and next four bits are as follows:- DTRC-: D=Low delay , T=High Throughput , R=Reliability , C= Low Cost. Last 8th bit is not use in IPv4 Datagram. |
Total Length of Datagram header denotes Header size+ length of data which is 16bit numeric number. Minimum value of this field is 20 Bytes and Maximum value will be 65535 Bytes. |
Identification Number is a 16 bit field in IPv4 Datagram Header. It is used to uniquely identify each and every packet fragment which is fragmented at router MTU(Maximum transmitted unit) and group by receiver side with this unique Identification Number. |
Flags are 3 bit field and 1st bit is reserved and always be 0. Second bit is DF(Do not fragment) and last bit is More fragment. If MTU is set for router side and DF value is 0 then data is not fragment at router side and drop by router in this situation a ICMP message(Destination not reach) sent to sender side but if DF value is set to 1 then packet is allow for fragment at MTU successfully. MF 0 Denotes that this is the last fragment and if MF 1 then this is not the last fragment and more fragment is coming. |
Fragment Offset field in IPv4 datagram header is 13bit. The value of first fragment offset in receiver side is always 0. By using fragment offset we can find out how much data Byte ahead of this fragment. The scaling factor we are using in fragment offset is 8. |
Time to Live field hold 8 bit and by using TTL field we can avoid infinite looping of data packet in network. It is also known a datagram life time in network. Before reaching the destination if TTL field is 0 then that packet will be drop by router and send a ICMP message(Time exceeded) to sender. Every data packet has their own TTL field number and it will decrease hop to hop. |
Protocol field in IPv4 Header is 8bit number that defines the protocol which are using to pass that data packet in network. |
Header Checksum it is a 16 bit field use to detect error in IPv4 datagram. It is calculate on every hope in IPv4 datagram and it is calculate only header part not data part because in TCP header we already calculate Checksum for data field. |
Source IP address indicate 32 bit source address. It is denoted in four octet and each octet is 8 bit in size. |
Destination IP address indicate 32 bit destination address. It is denoted in four octet and each octet is 8 bit in size. |
Options are optional in IPv4 datagram. It is five types and indicate the path and route of packet. These are Strict Source Routing, Lose Source Routing, Record Routing, Time Stamping, Padding. Minimum size of option is 0 Byte and maximum is 40 Byte in datagram header. |
Key Features of IP
1. Connectionless
- IP does not establish a connection before sending data.
- Each packet is treated independently and may take different paths.
2. Best-Effort Delivery (Unreliable)
- IP does not guarantee delivery, order, or error correction.
- It relies on higher-layer protocols like TCP for reliability.
3. Addressing (IP Addresses)
- IP assigns unique numerical addresses to devices for identification.
- Two versions exist:
- IPv4 (32-bit, e.g.,
192.168.1.1
) - IPv6 (128-bit, e.g.,
2001:db8::ff00:42:8329
)
- IPv4 (32-bit, e.g.,
4. Routing
- Determines the best path for data packets to reach the destination.
- Uses routers to forward packets across networks.
5. Fragmentation & Reassembly
- Splits large packets into smaller fragments to fit network limits.
- Reassembles them at the destination.
Types of IP Addresses
1. IPv4 Addressing (32-bit)
- Example:
192.168.1.1
- Limited number of addresses (about 4.3 billion).
- Uses subnetting and NAT (Network Address Translation) to extend address space.
2. IPv6 Addressing (128-bit)
- Example:
2001:db8::ff00:42:8329
- Larger address space (≈ 340 undecillion addresses).
- Improved security and efficiency.
3. Private vs Public IP Addresses
Type | Description | Example |
---|---|---|
Public IP | Unique, used on the internet | 8.8.8.8 (Google DNS) |
Private IP | Used in local networks (LAN) | 192.168.1.1 , 10.0.0.1 |
4. Static vs Dynamic IP Addresses
Type | Description |
---|---|
Static IP | Fixed, manually assigned (used in servers). |
Dynamic IP | Changes over time (assigned by DHCP). |
IP Packet Structure
Each IP packet consists of a header and payload (data).
IPv4 Header Format
Field | Description |
---|---|
Version | IP version (IPv4 or IPv6). |
Header Length | Size of the header. |
Type of Service (ToS) | Defines priority of packet. |
Total Length | Size of the packet. |
Identification | Identifies packet fragments. |
Flags | Controls fragmentation. |
Fragment Offset | Helps reassemble fragmented packets. |
Time To Live (TTL) | Limits how long a packet can exist (prevents loops). |
Protocol | Specifies transport protocol (TCP = 6, UDP = 17). |
Header Checksum | Error detection for the header. |
Source IP Address | Sender’s IP address. |
Destination IP Address | Receiver’s IP address. |
IP Routing & Packet Forwarding
1. How Routing Works
- Routers forward packets between networks.
- Routing tables determine the best path to the destination.
2. Key Routing Protocols
Protocol | Description |
---|---|
RIP (Routing Information Protocol) | Uses hop count, good for small networks. |
OSPF (Open Shortest Path First) | Uses shortest path algorithm, scalable. |
BGP (Border Gateway Protocol) | Used on the internet for global routing. |
3. NAT (Network Address Translation)
- Translates private IPs to public IPs for internet access.
- Helps extend IPv4 address space.
IPv4 vs IPv6 Comparison
Feature | IPv4 | IPv6 |
---|---|---|
Address Length | 32-bit (4.3 billion addresses) | 128-bit (340 undecillion addresses) |
Address Example | 192.168.1.1 | 2001:db8::1 |
Security | Basic | Built-in (IPSec) |
Speed | Moderate | Faster (efficient header) |
Routing | Uses NAT | More efficient |
IP Communication Process (Step-by-Step Example)
Example: Sending a request to www.example.com
1️⃣ Device Requests IP Resolution
- Your computer asks DNS for the IP address of
www.example.com
. - DNS responds with
93.184.216.34
.
2️⃣ Packet is Created
- Source IP:
192.168.1.10
(your device). - Destination IP:
93.184.216.34
(web server).
3️⃣ Router Forwards the Packet
- Your router checks its routing table.
- If the destination is outside your network, it sends the packet to your ISP’s router.
4️⃣ Packet Travels Through the Internet
- Packet passes through multiple routers and networks.
- TTL decreases at each hop (prevents looping).
5️⃣ Destination Server Receives the Packet
- Server processes the request and sends a response back.
6️⃣ Response is Sent Back to You
- Packet follows the reverse path back to your computer.
- Your web browser displays the webpage.
Common Protocols That Use IP
✅ TCP (Transmission Control Protocol) – Reliable data transmission (web browsing, email).
✅ UDP (User Datagram Protocol) – Faster, connectionless (streaming, VoIP, gaming).
✅ ICMP (Internet Control Message Protocol) – Network diagnostics (ping).
✅ ARP (Address Resolution Protocol) – Translates IP to MAC addresses.
Advantages of IP
✔ Scalable – Supports global internet communication.
✔ Flexible Routing – Allows multiple paths for data transmission.
✔ Efficient – Works with different network types (wired, wireless).
Disadvantages of IP
❌ Unreliable – No built-in error correction (relies on TCP).
❌ Security Concerns – IPv4 lacks encryption (IPv6 includes IPSec).
❌ Limited IPv4 Addresses – Requires NAT to extend usability.
Conclusion
IP is the foundation of internet communication, enabling device identification, data routing, and global connectivity. With IPv6 adoption, IP is becoming more scalable, secure, and efficient.The Internet Protocol (IP) is a network layer protocol responsible for addressing and routing data packets across networks. It ensures that data sent from a source device reaches the correct destination.
Key Features of IP
1. Connectionless
- IP does not establish a connection before sending data.
- Each packet is treated independently and may take different paths.
2. Best-Effort Delivery (Unreliable)
- IP does not guarantee delivery, order, or error correction.
- It relies on higher-layer protocols like TCP for reliability.
3. Addressing (IP Addresses)
- IP assigns unique numerical addresses to devices for identification.
- Two versions exist:
- IPv4 (32-bit, e.g.,
192.168.1.1
) - IPv6 (128-bit, e.g.,
2001:db8::ff00:42:8329
)
- IPv4 (32-bit, e.g.,
4. Routing
- Determines the best path for data packets to reach the destination.
- Uses routers to forward packets across networks.
5. Fragmentation & Reassembly
- Splits large packets into smaller fragments to fit network limits.
- Reassembles them at the destination.
Types of IP Addresses
1. IPv4 Addressing (32-bit)
- Example:
192.168.1.1
- Limited number of addresses (about 4.3 billion).
- Uses subnetting and NAT (Network Address Translation) to extend address space.
2. IPv6 Addressing (128-bit)
- Example:
2001:db8::ff00:42:8329
- Larger address space (≈ 340 undecillion addresses).
- Improved security and efficiency.
3. Private vs Public IP Addresses
Type | Description | Example |
---|---|---|
Public IP | Unique, used on the internet | 8.8.8.8 (Google DNS) |
Private IP | Used in local networks (LAN) | 192.168.1.1 , 10.0.0.1 |
4. Static vs Dynamic IP Addresses
Type | Description |
---|---|
Static IP | Fixed, manually assigned (used in servers). |
Dynamic IP | Changes over time (assigned by DHCP). |
IP Packet Structure
Each IP packet consists of a header and payload (data).
IPv4 Header Format
Field | Description |
---|---|
Version | IP version (IPv4 or IPv6). |
Header Length | Size of the header. |
Type of Service (ToS) | Defines priority of packet. |
Total Length | Size of the packet. |
Identification | Identifies packet fragments. |
Flags | Controls fragmentation. |
Fragment Offset | Helps reassemble fragmented packets. |
Time To Live (TTL) | Limits how long a packet can exist (prevents loops). |
Protocol | Specifies transport protocol (TCP = 6, UDP = 17). |
Header Checksum | Error detection for the header. |
Source IP Address | Sender’s IP address. |
Destination IP Address | Receiver’s IP address. |
IP Routing & Packet Forwarding
1. How Routing Works
- Routers forward packets between networks.
- Routing tables determine the best path to the destination.
2. Key Routing Protocols
Protocol | Description |
---|---|
RIP (Routing Information Protocol) | Uses hop count, good for small networks. |
OSPF (Open Shortest Path First) | Uses shortest path algorithm, scalable. |
BGP (Border Gateway Protocol) | Used on the internet for global routing. |
3. NAT (Network Address Translation)
- Translates private IPs to public IPs for internet access.
- Helps extend IPv4 address space.
IPv4 vs IPv6 Comparison
Feature | IPv4 | IPv6 |
---|---|---|
Address Length | 32-bit (4.3 billion addresses) | 128-bit (340 undecillion addresses) |
Address Example | 192.168.1.1 | 2001:db8::1 |
Security | Basic | Built-in (IPSec) |
Speed | Moderate | Faster (efficient header) |
Routing | Uses NAT | More efficient |
IP Communication Process (Step-by-Step Example)
Example: Sending a request to www.example.com
1️⃣ Device Requests IP Resolution
- Your computer asks DNS for the IP address of
www.example.com
. - DNS responds with
93.184.216.34
.
2️⃣ Packet is Created
- Source IP:
192.168.1.10
(your device). - Destination IP:
93.184.216.34
(web server).
3️⃣ Router Forwards the Packet
- Your router checks its routing table.
- If the destination is outside your network, it sends the packet to your ISP’s router.
4️⃣ Packet Travels Through the Internet
- Packet passes through multiple routers and networks.
- TTL decreases at each hop (prevents looping).
5️⃣ Destination Server Receives the Packet
- Server processes the request and sends a response back.
6️⃣ Response is Sent Back to You
- Packet follows the reverse path back to your computer.
- Your web browser displays the webpage.
Common Protocols That Use IP
✅ TCP (Transmission Control Protocol) – Reliable data transmission (web browsing, email).
✅ UDP (User Datagram Protocol) – Faster, connectionless (streaming, VoIP, gaming).
✅ ICMP (Internet Control Message Protocol) – Network diagnostics (ping).
✅ ARP (Address Resolution Protocol) – Translates IP to MAC addresses.
Advantages of IP
✔ Scalable – Supports global internet communication.
✔ Flexible Routing – Allows multiple paths for data transmission.
✔ Efficient – Works with different network types (wired, wireless).
Disadvantages of IP
❌ Unreliable – No built-in error correction (relies on TCP).
❌ Security Concerns – IPv4 lacks encryption (IPv6 includes IPSec).
❌ Limited IPv4 Addresses – Requires NAT to extend usability.
Conclusion
IP is the foundation of internet communication, enabling device identification, data routing, and global connectivity. With IPv6 adoption, IP is becoming more scalable, secure, and efficient.