SkillPilotAI

What is a network: LAN, WAN, MAN and topologies

A network is two or more devices connected to share data and resources (files, printers, internet). Every later topic, from OSI to DNS, builds on these basics: the parts of a network, the two communication models, network sizes and topologies.

1.1 Why is it used?

  • Without a network every device is alone: to print from the laptop you copy the file to a pen drive and carry it to the printer.
  • Connect the laptop, phone, smart TV and printer to one Wi-Fi router and the print job travels as a packet: laptop -> router -> printer.
  • The same router lets the phone's video play on the TV and lets every device share one internet connection.
  • Definition: when two or more devices connect to share data and resources, it is a network.
Your first network: a print job
  1. 1.Laptop 192.168.1.10 clicks Print

  2. 2.The file is split into packets and sent over Wi-Fi

  3. 3.Wi-Fi router 192.168.1.1 receives the packets

  4. 4.The router forwards them to Printer 192.168.1.20

  5. 5.The printer prints: no pen drive needed

The same path carries the phone's video to the Smart TV (192.168.1.11 -> router -> 192.168.1.12)

1.2 The 4 basic parts of a network

PartWhat it isExamples
NodesThe devices that send and receive dataLaptop, phone, server, printer
MediumWhat the data travels throughCable, fiber, Wi-Fi
Networking devicesForward data to the correct deviceSwitch, router, access point
ProtocolsRules for how data is sent and received (a common language)TCP, IP, HTTP, DNS

1.3 Client-server vs peer-to-peer

  • Client-server: your phone (client) sends a request to Flipkart's server and the server sends the response back.
  • A server is a powerful machine that serves thousands of clients at once; all data stays in one central place.
  • Peer-to-peer (P2P): no central server; every device is both client and server (e.g. sending a photo with Nearby Share).
  • P2P is simple and cheap, but in a big network security and management become hard.
PointClient-serverPeer-to-peer
Central serverYesNo
Role of a deviceClient only asks, server only servesEvery device does both
DataCentral, easy to back up and secureSpread across peers
ScaleThousands of clients (add servers)Small groups; hard to manage when big
ExampleOpening Flipkart, GmailNearby Share, BitTorrent

1.4 Network types by size: PAN, LAN, MAN, WAN

  • LAN: network inside a building, office or campus; PCs and printer on one switch; very high speed, very low latency; a router is needed to reach the internet.
  • MAN: LANs of two offices in one city (Delhi and Noida) joined by high-speed city fiber; e.g. a city cable network or linked college campuses.
  • WAN: Delhi office to Mumbai office over ISP and internet links; covers cities, countries, the world. The internet is the biggest WAN.
  • WAN latency is much higher than LAN latency: longer distance and many routers on the way.
  • PAN: a few meters around you, e.g. phone + Bluetooth earbuds or a smartwatch.
TypeCoversExampleSpeed / latency
PANA few meters around youPhone + Bluetooth earbudsShort range, low power
LANA building or campusHome Wi-Fi, office networkHigh speed, ~0.1 ms latency
MANA cityCity fiber, cable TV networkHigh speed, low latency
WANCities and countriesThe internet, Delhi-Mumbai linkHigher latency (~30 ms), higher cost
LAN -> MAN -> WAN: Delhi to Mumbai
  1. 1.Delhi office LAN (LAN 1)

  2. 2.City fiber MAN joins Delhi and Noida (LAN 2)

  3. 3.Data leaves the city over ISP links

  4. 4.Internet (WAN) carries it across the country

  5. 5.Mumbai office LAN (LAN 3) receives it, latency ~30 ms

One line to remember: PAN around you, LAN in a building, MAN in a city, WAN between cities and countries

1.5 Topologies

  • Topology = the shape in which devices are connected.
  • Star: every device connects to one central switch. One cable cut disconnects only that device; but if the switch goes down, the whole network goes down.
  • Mesh: every device connects to many others; if one link fails, data takes an alternate route (R1 -> R3 -> R2). Used in the internet core and data centers; expensive (many cables and ports).
  • Bus: all devices share one main cable; cut it and everything stops.
  • Ring: data goes around in a circle.
  • Hybrid: what you see today, star inside an office and mesh between offices.
TopologyShapeStrengthWeakness
BusOne main cableCheap, simpleCable cut = all stop
RingCircleOrdered data flowOne break can disturb the ring
StarAll on one switchOne cable cut affects one device; most common todaySwitch down = all down
MeshMany pathsReliable, alternate routesCostly cabling and ports
HybridStar inside, mesh between sitesBalance of cost and reliabilityMore complex design

1.6 Bandwidth vs latency

  • Bandwidth: how much data per second (Mbps), like the number of lanes on a highway.
  • Latency: how long one packet takes to reach its destination (ms), like the length of the highway.
  • More lanes let more cars run together but do not make Delhi to Mumbai any shorter: more bandwidth does not reduce latency.

1.7 Practical: the laptop's IP and gateway

Lab: a small home network in Docker. Laptop 192.168.1.10, printer 192.168.1.20, router 192.168.1.1.

Terminal
ip -4 addr show eth0ip routeping -c 3 192.168.1.20ping -c 3 8.8.8.8
Output
$ ip -4 addr show eth02: eth0: <BROADCAST,MULTICAST,UP> mtu 1500    inet 192.168.1.10/24 brd 192.168.1.255$ ip routedefault via 192.168.1.1 dev eth0192.168.1.0/24 dev eth0 src 192.168.1.10
  • inet 192.168.1.10/24: the laptop's IP; /24 tells which LAN it belongs to (192.168.1.0/24).
  • default via 192.168.1.1: the way out of the LAN is the router, called the default gateway.
  • On Windows the same facts (IP, gateway, DNS) come from ipconfig /all and route print.
PowerShell
ipconfig /allroute print -4

1.8 Practical: LAN vs WAN latency

Output
$ ping -c 3 192.168.1.2064 bytes from 192.168.1.20: seq=1 time=0.121 ms64 bytes from 192.168.1.20: seq=2 time=0.115 ms3 packets transmitted, 3 received, 0% loss$ ping -c 3 8.8.8.864 bytes from 8.8.8.8: seq=0 time=31.519 ms64 bytes from 8.8.8.8: seq=1 time=32.135 ms64 bytes from 8.8.8.8: seq=2 time=23.489 ms
  • Printer (same LAN): reply in about 0.1 ms.
  • 8.8.8.8 (Google, over the internet WAN): about 30 ms, roughly 250 times slower.
  • 0% loss means every packet came back.

1.9 Common mistakes

  • Thinking Wi-Fi = internet. Wi-Fi is only the wireless medium from phone to router, part of your LAN.
  • Full Wi-Fi signal but no internet: the problem is in the WAN link between the router and the ISP.
  • Mixing up bandwidth and latency: a faster plan (more Mbps) does not lower ping to a far server.
  • Home Wi-Fi is a LAN; a YouTube video comes from a server in another city over the WAN, then into your LAN.
Connected, no internet
  1. 1.Phone -> Wi-Fi router: Wi-Fi OK, signal full (LAN works)

  2. 2.Router -> ISP link goes down (WAN broken)

  3. 3.Packets to the internet cannot leave the router

  4. 4.Phone shows: Connected, no internet

Check the WAN side (router to ISP), not the Wi-Fi

1.10 Interview tips

  • LAN vs WAN: LAN is a limited area (home, office, campus), usually one owner, high speed, low latency; WAN covers cities and countries over ISP/telecom links, higher latency and cost.
  • Name the 4 parts of a network: nodes, medium, networking devices, protocols.
  • Client-server has one central server; in P2P every device plays both roles.
  • Star is the most common topology today; mesh is used where reliability matters (internet core, data centers).
  • Bandwidth = how much per second, latency = how long; prove it with ping (0.1 ms LAN vs ~30 ms WAN).