IPv4

Diagram

Pasted image 20240906085955.png

Question

  1. Why each device has to be uniquely identified at the network layer?
  2. IPv4 Packet exploration
    1. Ver - Version - 4bits - Just hold the version number of the address which is 4.
    2. IHL - Internet Header Length - 4bits - Length of the IP header. It provides a value from 20 to 60. So 20 is the minimum header length and 60 is the maximum using the option filed on the header. The minimum value for this field is 5 and the maximum is 15. To get the actual value of the header, we have multiply the field value with 4.
    3. Type of service: - 8bits - Low Delay, High Throughput, Reliability.
      • Low Delay: Prioritizes reducing the time it takes for a packet to be transmitted. This is important for real-time applications like VoIP or online gaming.
      • High Throughput: Prioritizes maximizing the amount of data transferred over the network. This is useful for applications like file transfers or video streaming.
      • Reliability: Prioritizes ensuring that the data reaches its destination without errors, which can involve mechanisms like error checking or retransmission. This is important for applications like financial transactions or file transfers where accuracy is critical.
    4. Total Length: Length of header + Data (16 bits), which has a minimum value 20 bytes and the maximum is 65,535 bytes.
    5. Identification - 16bits - This is basically a unique identification number of a single datagram. [[Network Layer_ IP Addressing#Identification in Details]]
    6. Flags - 3 flags of 1 bit each : reserved bit (must be zero), do not fragment flag, more fragments flag (same order).
      1. **Reserved bit (0th)**The reserved bit has no operational impact today and must always be set to 0. However, its existence is essential for maintaining flexibility in the IPv4 protocol for potential future extensions.
      2. **Do Not Fragment (DF) Flag (1st Bit)**This flag tells the router whether it is allowed to fragment the packet. If the flag is 0 then the packet can be fragmented if needed, If set to 1, the packet will be discarded if it is too large to fit within the network's MTU, and an error message (ICMP "Fragmentation Needed") will be sent back to the sender.
      3. **More Fragments (MF) Flag (2nd Bit)**This flag indicates whether the packet is the last fragment in a fragmented series. If 1, it signals that more fragments will follow; if 0, it indicates this is the final fragment.
    7. Fragment Offset: Represents the number of Data Bytes ahead of the particular fragment in the particular Datagram. Specified in terms of number of 8 bytes, which has the maximum value of 65,528 bytes.
    8. Time to live - Datagram’s lifetime (8 bits), It prevents the datagram to loop through the network by restricting the number of Hops taken by a Packet before delivering to the Destination.
    9. Protocol: Name of the protocol to which the data is to be passed (8 bits). [[Network Layer_ IP Addressing#Protocol Explaination]]
    10. Header Checksum: 16 bits header checksum for checking errors in the datagram header.
    11. Source IP address: 32 bits IP address of the sender
    12. Destination IP address: 32 bits IP address of the receiver
    13. Option: Optional information such as source route, record route. Used by the Network administrator to check whether a path is working or not.
  3. How many parts are in IPv4?
  4. Why there is dotted decimal after every four character?
  5. Difference between subnet mask and prefix mask?
Aspect Subnet Mask (Old) Prefix Mask (New)
Format Dotted decimal (e.g., 255.255.255.0) Slash notation (e.g., /24)
Usage Context Used in older configurations (e.g., IPv4) Commonly used in modern routing protocols and network configurations
Purpose Explicitly defines which bits are for the network and host Concisely represents the number of bits in the network part
Complexity Requires knowledge of binary for interpretation Easier and more intuitive for humans to read
  1. Why are we using both subnet mask and prefix mask?
  2. What is difference between IP Address, Subnet mask, Network Address, Host Address and Broadcast Address?
Aspect IP Address Subnet Mask Network Address Host Address Broadcast Address
Definition A unique address assigned to each device in a network for communication. A 32-bit value used to divide an IP address into network and host portions. The address that represents the entire network (first address in the range). This device represents a specific device on a network. Using this address someone can send a message to all the devices in a network.
Purpose Identifies a specific device (host) within a network. Defines the portion of the IP address used for the network and the host. Identifies the network itself, used for routing. - Each host bit in this address will be 0. Identifies individual devices within a network. Sends messages to all devices in the network. Each host bit in this address will be 1.
Format (for 192.168.1.0/24 Network) Dotted decimal (e.g., 192.168.1.10) Dotted decimal (e.g., 255.255.255.0) Dotted decimal (e.g., 192.168.1.0) Addresses 192.168.10.1  through  192.168.10.254 are all host addresses) 192.168.1.255
Function Used by devices for sending and receiving data. Helps determine which part of the IP address is for the network and host. Helps routers identify the network to send data to. Used for direct communication between devices. Used for broadcast communication (e.g., ARP).
Example 192.168.1.10 255.255.255.0 192.168.1.0 192.168.1.10 192.168.1.255
In Short:
  1. ANDing the Binaries of IP Address and Subnet Mask to get the Network Address