TheHingineer

  • Computer Networks


  • CN Part-1

  • CN Part-2

  • CN Part-3

  • CN Part-4

  • CN Part-5

  •  Packet Switching and IP Fragmentation in Computer Networks

     Packet Switching kya hoti hai?

    • Packet Switching ek modern digital network communication method hai jisme continuous data message ko chote-chote blocks mein break kiya jaata hai jinhe Packets kehte hain.

    • Traditional Circuit Switching (jaise puraane landline telephone) mein baat shuru karne se pehle dedicated physical path reserve karna padta tha jo call khatam hone tak lock rehta tha. Chahe koi kuch na bole, line busy rehti thi.

    • Packet Switching mein koi dedicated line lock nahi hoti. Alag-alag users ke packets ek hi shared physical cable par dynamically travel karte hain (Statistical Multiplexing). Isse network utilization 10x improve hota hai.

     Circuit Switching vs Packet Switching

    Property Circuit Switching Packet Switching
    Dedicated Path Yes (End-to-end dedicated circuit reserved). No (Packets shared transmission links use karte hain).
    Bandwidth Wastage High (Idle communication time mein line waste hoti hai). Minimal (Bandwidth on-demand share hoti hai).
    Call Setup Delay Setup delay required before transmission starts. No setup delay (Packets turant send ho jaate hain).
    Packet Dropping Zero packets dropped (Bandwidth guaranteed). Packets drop ho sakte hain agar router buffer full ho jaye.

     What is IP Fragmentation?

    • Har physical network technology (Ethernet, Wi-Fi, Token Ring, Cellular) ka ek maximum packet size hota hai jise wo carry kar sakti hai. Is physical limit ko MTU (Maximum Transmission Unit) kehte hain.

    • Example: Standard Ethernet ka MTU 1500 Bytes hota hai.

    • Jab koi router ek aisa IP packet receive karta hai jiska size agle outgoing link ke MTU se bada hai, toh router us packet ko aage forward nahi kar sakta. Router us bade datagram ko chote-chote pieces mein divide kar deta hai — isi process ko IP Fragmentation kehte hain.

    • Reassembly: In sabhi fragmented packets ko destination host par wapas jod kar original packet banaya jaata hai.

     IPv4 Header Fields Used in Fragmentation

    IPv4 header mein fragmentation ko manage karne ke liye 3 specific fields hoti hain:

    Field Name Size Role aur Function
    Identification (ID) 16 bits Source host dwara assign kiya gaya unique number. Ek hi original packet ke sabhi fragments ka ID number same hota hai, taaki destination unhe pehchan sake.
    Flags 3 bits – Bit 0: Reserved (always 0)
    – Bit 1 (DF – Don’t Fragment): Agar 1 hai, toh router packet ko fragment nahi kar sakta (drop karke ICMP error bhejega).
    – Bit 2 (MF – More Fragments): Agar 1 hai, iska matlab yeh last fragment nahi hai, aage aur fragments aa rahe hain. Agar 0 hai, iska matlab yeh aakhiri (last) fragment hai.
    Fragment Offset 13 bits Batata hai ki yeh particular fragment original datagram ke data mein kahan se shuru hota hai. Iski value 8-byte blocks mein measure hoti hai (Offset = Data Byte Number / 8).

    Step-by-Step Numerical Example (Exam Favorite!):

    Maan lijiye ek IP packet ka Total Length 4000 Bytes hai (20-byte IP Header + 3980 bytes Data), aur router ke outgoing link ka MTU 1500 Bytes hai:

    • Har fragment mein 20-byte ka IP Header lagega, isliye maximum data per fragment = 1500 - 20 = 1480 Bytes (jo 8 se divisible hai: 1480 / 8 = 185).

    • Fragment 1: Data = 1480 Bytes (Bytes 0 to 1479).
      Total Length = 1500, MF = 1, Offset = 0 / 8 = 0.

    • Fragment 2: Data = 1480 Bytes (Bytes 1480 to 2959).
      Total Length = 1500, MF = 1, Offset = 1480 / 8 = 185.

    • Fragment 3: Remaining Data = 3980 - 2960 = 1020 Bytes (Bytes 2960 to 3979).
      Total Length = 1020 + 20 = 1040 Bytes, MF = 0 (Last fragment!), Offset = 2960 / 8 = 370.

     Summary Table

    Concept Summary Punchline
    Packet Switching Store-and-forward routing of independent packets over shared physical links.
    MTU Maximum Transmission Unit (Ethernet standard = 1500 bytes).
    Fragmentation Managed by ID, DF/MF Flags, aur 8-byte Fragment Offset. Reassembled at Destination Host.
    Scroll to Top