1. Gyanastra
  2. Computer Networks
  3. IPv4 Addressing
  4. Network ID and Host ID Structure
Free lesson, no account needed 5 min read 36 practice questions after it
Asked in past papers8 times
  • GATE CSE20142012201020082006
  • ISRO2017
  • UGC NET20182017

Computer Networks · IPv4 Addressing

Network ID and Host ID Structure

Overview

An IPv4 address is split into two logical parts: a Network ID that identifies the network and a Host ID that identifies a specific host within that network.
This structure is what allows a packet to be routed first to the correct destination network and then to the correct destination host, which is the basis of all communication between processes on different computers.

Key concepts

  • IP address structure: An IP address consists of two parts — a Network ID and a Host ID. The Network ID is used to reach the target network; the Host ID is used to reach the target host within that network.
  • Host: A host is a computer, such as a PC at home or a Google server.
  • Process: Within a host there are many processes; for example, an open web browser is one process, and the web server program on the Google machine is another process.
  • Casting: The ways of sending a packet from one host to another host are also called casting.
  • Subnetting: Dividing a big network into many small networks.

How it works

  1. The main responsibility of computer networks is to enable communication between two processes, which may be on the same computer or on different computers.
  2. Consider a user in India connected to a network (say the Airtel network in some region of India). The user's computer is a host on that network, and inside the host a process is running — the web browser.
  3. The user types www.google.com in the browser. Google's network is somewhere in California, US. Inside Google's network, one server is the host, and the web server program on it is the process the user wants to connect to.
  4. The goal is therefore: from the process at home, connect to the process at Google to get the web page.
  5. The request must first reach the destination network, and only after reaching the destination network can it reach the destination host.
  6. To identify the network and the host, the user has supplied only the domain name www.google.com — nothing else.
  7. Therefore the domain name must be converted into numbers so that the network and then the host can be identified. A service is needed that converts the domain name into an IP address.

Formulas

IP address=Network ID+Host ID\text{IP address} = \text{Network ID} + \text{Host ID}

  • Network ID: identifies and reaches the target network.
  • Host ID: identifies and reaches the target host within that network.

Worked examples

Reaching a web server from a home PC:

  • Source side: user in India on the Airtel network; the user's computer is the host, and the web browser inside it is the process.
  • Destination side: Google's network in California, US; one server in that network is the host, and the web server program on it is the process.
  • The user supplies only the domain name www.google.com, so the domain name must be converted into an IP address by a service.
  • The resulting IP address is read in two parts: the Network ID takes the request to the destination network (Google's network), and the Host ID then takes it to the destination host (the Google server) running the target process.

Revision summary

  • An IP address always has exactly two parts: Network ID + Host ID.
  • The Network ID reaches the network; the Host ID reaches the host inside that network — in that order.
  • A host is a computer; a process is a program running inside a host (browser, web server).
    Do not confuse the two.
  • The user supplies only a domain name; a service must convert it into an IP address before the network and host can be identified.
  • Sending a packet from one host to another is called casting.
  • Subnetting means dividing a big network into many small networks.

Previous-year exam insights

  • Classful IPv4 first-octet ranges and default masks: Class A 1–126 (mask 255.0.0.0, 272^{7} networks, 2242^{24}−2 hosts), Class B 128–191 (mask 255.255.0.0, 2142^{14} networks, 2162^{16}−2 hosts), Class C 192–223 (mask 255.255.255.0, 2212^{21} networks, 282^{8}−2 hosts), Class D 224–239 multicast, Class E 240–255 reserved; 127.x.x.x is loopback.
    Asked inGATE 2012ISRO 2017
  • Two hosts are on the same network iff (IP1 AND mask) == (IP2 AND mask);
    if the two hosts use different masks, each host compares using its own mask, so the relation need not be symmetric.
    Asked inGATE 2010GATE 2006
  • Special IPv4 addresses: 0.0.0.0 is used as the source address by a host that does not yet know its own address (e.g. while booting/DHCP); 255.255.255.255 is limited broadcast; all-0s host ID is the network address and all-1s host ID is the directed broadcast, so neither can be assigned to a host.
    Asked inUGC NET 2017
  • A k-bit field yields 2k2^{k} values;
    usable host addresses in a subnet with h host bits = 2h−22^{h} - 2, and usable networks in classful addressing = 2network bits2^{\text{network bits}} (minus reserved cases).
    Asked inGATE 2012GATE 2014
  • Wrap-around time for identifiers = total number of distinct IDs / IDs generated per second;
    with a globally unique IPv4 address plus a counter, the ID space is 2total bits2^{\text{total bits}} and the per-host rate is the number of IDs generated per second.
    Asked inGATE 2014
  • The network part of an address is found by ANDing the address with the netmask;
    a valid netmask has contiguous 1s followed by contiguous 0s (e.g. 255.255.255.128 = /25, 255.255.255.192 = /26, 255.255.255.224 = /27).
    Asked inGATE 2010GATE 2006
Pages 1–2 of 2