Computer Networks and Internet Basics (9hrs) · Computer Fundamentals & Emerging Technologies

Internet Protocol (IP) Address

Watch lectures

Internet Protocol (IP) Address

1. Definition

An IP address is a logical, hierarchical address assigned to every interface on a TCP/IP network so that packets can be routed from source to destination. It is a Layer-3 (network layer) address, unlike the flat, physical MAC address of Layer 2. IPv4 addresses are 32 bits long, written as four decimal octets separated by dots (dotted-decimal notation), each octet ranging from 0 to 255 — for example 192.168.10.130.

IPv4address=networkpart+hostpart,32bits=4×8bitsIPv4 address = network part + host part, 32 bits = 4 × 8 bits

The network part identifies the network and is used by routers; the host part identifies the specific device inside that network.

Basis MAC address IP address
Layer 2 (data link) 3 (network)
Size 48 bits 32 bits (IPv4) / 128 bits (IPv6)
Nature Flat, burned into the NIC Hierarchical, logical
Assignment By the manufacturer By the administrator or DHCP
Changeable Normally fixed Changes with the network
Scope Works within one LAN Works across the whole internet

2. Classes (legacy addressing) and Default Masks

Class First octet Default mask Network bits Hosts per network Purpose
A 1-126 255.0.0.0 (/8) 8 16,777,214 Very large networks
B 128-191 255.255.0.0 (/16) 16 65,534 Medium networks
C 192-223 255.255.255.0 (/24) 24 254 Small networks
D 224-239 — — — Multicast groups
E 240-255 — — — Experimental/reserved

Classful addressing wasted addresses, so modern networks use classless addressing — CIDR (Classless Inter-Domain Routing), written as a prefix: 200.10.20.0/22. Subnetting divides one network into smaller subnets using a subnet mask; the formula is:

numberofsubnets=2n,usablehosts=2h−2number of subnets = 2^{n}, usable hosts = 2^{h} - 2

where nn = borrowed host bits and hh = remaining host bits (the −2 removes the network and broadcast addresses).

3. Special Addresses You Must Know

Address Meaning
127.0.0.0/8 Loopback — the machine talking to itself (127.0.0.1 = localhost)
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 Private (RFC 1918) ranges — used inside LANs, not routed on the internet
169.254.0.0/16 APIPA / link-local — self-assigned when DHCP fails
0.0.0.0 "This host" / default route (0.0.0.0/0 = any destination)
255.255.255.255 Limited broadcast — everyone on the local network
Network address Host bits all 0 — identifies the subnet itself (e.g. 192.168.10.0)
Directed broadcast Host bits all 1 — everyone in that subnet (e.g. 192.168.10.255 for /24)
224.0.0.0 - 239.255.255.255 Multicast groups (used by routing protocols, IPTV)

NAT (Network Address Translation) lets thousands of private addresses share one public IP, which is why private ranges are so widely used at home and in offices.

4. Worked Subnetting Example — 192.168.10.130/26

  • Mask: /26 = 255.255.255.192 → block size = 256 − 192 = 64
  • Subnets: .0, .64, .128, .192 (each with 2⁶ − 2 = 62 usable hosts)
  • The address .130 lies in the block starting at .128, so:
    • Network address = 192.168.10.128
    • First usable host = 192.168.10.129
    • Last usable host = 192.168.10.190
    • Broadcast address = 192.168.10.191
    • Usable hosts = 190 − 129 + 1 = 62 ✓

5. How Addresses Are Assigned

Static (manually configured — needed for servers, routers, printers) or dynamic through DHCP, which uses the DORA exchange: Discover → Offer → Request → Acknowledge, along with the subnet mask, default gateway, DNS server and a lease time. A host also needs the default gateway address (the router that leads outside its subnet), the DNS server address, and the subnet mask to know which addresses are local.

6. IPv4 vs IPv6

Basis IPv4 IPv6
Size 32 bits 128 bits
Address space ~4.3 × 10⁹ ~3.4 × 10³⁸
Notation Dotted decimal (192.168.1.1) Hex colon-separated (2001:0db8::1428:57ab)
Header 20-60 bytes, variable 40 bytes, fixed
Broadcast Yes No — uses multicast/anycast only
Configuration Manual or DHCP Manual, DHCPv6 or SLAAC (auto-configuration)
Security IPsec optional IPsec built into the design
NAT Heavily used to conserve addresses Not needed — enough addresses for every device
Address types Unicast, multicast, broadcast Global unicast (2000::/3), link-local (fe80::/10), unique local (fc00::/7), multicast (ff00::/8)
Compression — Consecutive zero groups replaced by :: (once only)

Examples: IPv4 192.168.1.10; IPv6 2001:0db8:0000:0000:0000:ff00:0042:8329 → compressed 2001:db8::ff00:42:8329.

7. Exam Points

  • Define an IP address; differentiate it from a MAC address — 5 marks, almost certain.
  • Explain the classes of IPv4 addresses with their default masks and host counts — 5-7 marks, very frequent.
  • Define private addresses, loopback and APIPA — 3-5 marks.
  • Numerical: for a given IP/mask, find the network address, broadcast address, host range and number of usable hosts — 5 marks, very frequent.
  • Explain subnetting and give the formulas for subnets and hosts; what is CIDR? — 5 marks.
  • Compare IPv4 and IPv6 (size, notation, header, NAT, security) — 5 marks, frequent.
  • Explain DHCP and the DORA process — 5 marks.
  • Explain NAT and why it is needed — 3-5 marks.
Student FinanceWeb Platform

Pocketly — Personal Finance for Students

Keep your hostel and college expenses under control. Track accounts, log spending in seconds, and stay within your monthly budget.

← All Computer Fundamentals & Emerging Technologies modules