Learning Objectives

By the end of this chapter, you will be able to:

  • Define an IP address and state why every internet device needs one.
  • Compare IPv4 and IPv6 by length, format, and scale and justify the move to IPv6.
  • Classify addresses by reach and by assignment into public versus private and static versus dynamic.
  • Explain DNS as a layered lookup and trace a BS 2081 query for a .np domain.
  • Read a domain and a URL into its parts and price them in NPR.

Why a name without a number cannot deliver money

On 2081-10-03 Shanti Saving Cooperative launches shanti.com.np for its member portal. A member in Sunwal types shanti.com.np and expects her balance. Her phone has no idea where that name lives. Routers do not route names. They route numbers. The phone must turn the name into a number, send its request to that number, and get the page back. The number is the IP address. The directory that translates names to numbers is the Domain Name System. Get either wrong and the portal is invisible even though the fibre is fine.

Framework 1: Addresses that route packets

Every device on the internet carries an IP address, a numeric label that tells routers where to forward its packets. Without it the device cannot send or receive. Two versions coexist.

  • IPv4 uses 32 bits. Written as four decimal numbers 0 to 255 joined by dots, such as 202.70.64.10. Each octet is 8 bits, so 256 values per position. 256.1.1.1 is invalid because 256 exceeds 255. Roughly 4.3 billion addresses exist, which is 2 to the 32. The pool felt large in 1983 and small after phones and POS devices multiplied.
  • IPv6 uses 128 bits. Written as eight groups of hex digits joined by colons, such as 2001:0db8:85a3:0000:0000:8a2e:0370:7334. The space is about 3.4 times 10 to the 38 addresses, which is 2 to the 128. Enough for sensors, phones, and every teller PC without rationing.
Aspect IPv4 IPv6
Length 32 bits 128 bits
Format Four decimals 0 to 255, dots Eight hex groups, colons
Example 202.70.64.10 2001:0db8:85a3::0370:7334
Pool About 4.3 billion About 3.4 times 10 to the 38
Deployment Still dominant for many sites Growing for mobile and IoT, dual stack common

Dual stack means a device speaks both. A branch firewall in Nepal today often runs dual stack so it can reach any customer regardless of which version the member phone prefers.

Framework 2: Two splits that decide cost and control

One IP number can mean opposite things depending on where it is seen and how it is assigned. Group the splits so a budget decision does not confuse them.

A. Reach: public versus private

  • Public IP is reachable on the internet and issued to you by your ISP or host. The portal server for shanti.com.np holds a public address such as 203.0.113.25. Anyone can route to it.
  • Private IP lives inside a branch LAN and is not directly reachable from outside, such as 192.168.1.10 or 10.0.0.5. The router shares one public address among many private devices using NAT. A teller PC at 192.168.1.12 reaches the internet through the router public address, but no outsider dials the private number directly.

Private ranges exist so every branch can number its LAN without buying a global pool for each desk.

B. Assignment: static versus dynamic

  • Static IP is fixed and does not change. Use it for servers, CCTV that managers reach from head office, and any service that members or branches must find at a stable number. ISPs charge a premium for static blocks.
  • Dynamic IP is assigned by DHCP and may change at lease renewal. This suits most phones and branch PCs because they initiate requests and do not need to be found by number.

A cooperative portal needs a static public address so DNS always points to the same host. Teller PCs need dynamic private addresses so the branch does not pay for numbers it never publishes.

Self-check

Framework 3: DNS as a layered lookup

Humans remember names. Routers forward numbers. DNS is the global system that maps a name to the number. It is not one server. It is a hierarchy with caches at each step to avoid repeat lookups.

When a phone asks for www.shanti.com.np the chain runs like this.

  1. Check local cache. The phone and the branch resolver remember recent answers.
  2. Ask the recursive resolver run by the ISP. Nepali ISPs such as Nepal Telecom and WorldLink run resolvers for their users.
  3. The resolver walks the hierarchy: root, then .np registry, then the authoritative server for shanti.com.np, which returns 203.0.113.25.
  4. The phone opens a TCP connection to that address and requests the page.
sequenceDiagram
  participant B as Browser on phone
  participant R as ISP resolver
  participant A as Authoritative for shanti.com.np
  participant W as Portal at 203.0.113.25
  B->>R: What is IP of www.shanti.com.np?
  R->>A: Query www.shanti.com.np
  A-->>R: 203.0.113.25
  R-->>B: 203.0.113.25 cached
  B->>W: GET page for member portal
  W-->>B: HTML plus TLS certificate

Caching saves time. The first lookup may take tens of milliseconds. The next for the same name reuses the cached answer until its time to live expires.

Reading a domain and a URL

Read both from right to left for authority, then left to right for path.

  • TLD: .np is the country code for Nepal. Generic codes include .com and .org.
  • Second level: shanti is the registered name. In shanti.com.np the commercial category is com.np.
  • Subdomain: www or mail.
  • For www.shanti.com.np: .np is the TLD, com.np is the category, shanti is the registrant, www is the host.

A URL is the full address with protocol and path.

https://www.shanti.com.np/members/login.html

  • https is the protocol.
  • www.shanti.com.np is the domain that DNS resolves.
  • /members/login.html is the path to the resource on that server.

A domain owns the site. A URL points to a page on the site.

Nepal context

.np country code domains are administered by Mercantile Communications. Registration for individuals and organisations under .com.np has long been offered free with documents, while a .com from a commercial registrar typically costs about Rs 1,800 a year and bundles privacy and DNS hosting. Many ISPs assign dynamic public addresses to home users by DHCP and static blocks to businesses that need a stable server, and most large ISPs now run dual stack to support IPv6 alongside IPv4.

If a .np site is unreachable but its IP still responds, DNS is suspect. If the IP does not respond, the IP assignment or the host is suspect. Group A and B above separate those calls so the branch does not pay an ISP visit for a registry error.

Nepal worked example: the first publish of shanti.com.np on BS 2081-10-03

Shanti holds a domain shanti.com.np at zero annual fee through Mercantile with renewal on documents, plus an optional shanticoop.com at Rs 1,800 a year that the board defers. The portal host is a VPS with a static public IPv4 203.0.113.25 at Rs 2,500 a month billed annually as Rs 30,000. The VPS also carries an IPv6 address for future mobile users at no extra charge.

DNS setup on 2081-10-03: an A record points shanti.com.np to 203.0.113.25. A CNAME points www.shanti.com.np to shanti.com.np. Time to live is set to 3600 seconds, which is one hour. Global propagation completes within that hour. Testing from a Sunwal phone: first lookup to the ISP resolver walks root to .np to the authoritative server and returns 203.0.113.25 in about 70 ms. Second lookup is cached and returns in about 8 ms. Each member that loads five portal pages triggers at most one fresh DNS query per hour, so 200 daily visitors cause at most 200 fresh lookups per day, negligible traffic.

Cost proof: portal host Rs 30,000 plus FTTH Rs 46,800 uncapped plus domain Rs 0 in year one equals Rs 76,800. Adding the global .com later would lift year two to Rs 48,600 for connectivity plus Rs 30,000 for host plus Rs 1,800 for the extra name, total Rs 80,400.

Security note: the branch LAN uses 192.168.10.x private addresses behind NAT. No teller PC is directly reachable from the internet. The portal server alone holds the static public address and a firewall that exposes only 80 and 443.

Summary

  • IP addresses route packets. IPv4 is 32 bits written in four decimals, about 4.3 billion numbers. IPv6 is 128 bits written in hex groups, enough for massive scale. Dual stack carries the transition.
  • Addresses split by reach into public for the internet and private for a LAN behind NAT, and by assignment into static for servers and dynamic via DHCP for desks and phones.
  • DNS translates names to numbers through a layered lookup with caches, from local cache to ISP resolver to authoritative server.
  • A domain is the name that DNS resolves. A URL adds protocol and path to point to a specific page. Nepal .np names are managed by Mercantile, with .com.np often free on proof and global alternatives paid.

Key Takeaways

  • Routers read numbers. Humans read names. DNS bridges them. When a site fails, ask first whether the name resolved, then whether the number answered.
  • Keep private numbers private. Publish only the static public address that DNS points to and guard it with a firewall.
  • IPv6 removes the scarcity that forced NAT tricks, but NAT remains useful as a local privacy barrier.

Discussion Questions

  1. A member can open google.com but not shanti.com.np on the same phone. Which DNS step is suspect and what single query command would prove it.
  2. Why does a branch assign dynamic private addresses to tellers but insist on a static public address for its portal.
  3. A phone caches a wrong IP for an hour due to a typo in an A record. How does low TTL trade freshness against load.

Exercises

Short answer

  1. Define an IP address and state why 300.12.5.1 is invalid as IPv4.
  2. Differentiate public and private addresses and give a teller LAN example for each.
  3. Identify protocol, domain, and path in https://www.nrb.org.np/about/policy.html.

Long answer

  1. Compare IPv4 and IPv6 on length, format, address space, and example. Explain why exhaustion of IPv4 forced the move to IPv6 and how dual stack helps a Nepali ISP during the transition.
  2. What is DNS. Trace the steps when a member in Sunwal types www.shanti.com.np on 2081-10-03, include ISP resolver, .np registry, authoritative server, and caching to 203.0.113.25, and split addresses by reach and assignment. Price the first year at FTTH Rs 46,800 plus VPS Rs 30,000 plus domain Rs 0, and state what changes if a .com alias at Rs 1,800 and 13 percent VAT on hosting are added.