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.
- Step 1
1.Laptop 192.168.1.10 clicks Print
- Step 2
2.The file is split into packets and sent over Wi-Fi
- Step 3
3.Wi-Fi router 192.168.1.1 receives the packets
- Step 4
4.The router forwards them to Printer 192.168.1.20
- Step 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
| Part | What it is | Examples |
|---|---|---|
| Nodes | The devices that send and receive data | Laptop, phone, server, printer |
| Medium | What the data travels through | Cable, fiber, Wi-Fi |
| Networking devices | Forward data to the correct device | Switch, router, access point |
| Protocols | Rules 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.
| Point | Client-server | Peer-to-peer |
|---|---|---|
| Central server | Yes | No |
| Role of a device | Client only asks, server only serves | Every device does both |
| Data | Central, easy to back up and secure | Spread across peers |
| Scale | Thousands of clients (add servers) | Small groups; hard to manage when big |
| Example | Opening Flipkart, Gmail | Nearby 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.
| Type | Covers | Example | Speed / latency |
|---|---|---|---|
| PAN | A few meters around you | Phone + Bluetooth earbuds | Short range, low power |
| LAN | A building or campus | Home Wi-Fi, office network | High speed, ~0.1 ms latency |
| MAN | A city | City fiber, cable TV network | High speed, low latency |
| WAN | Cities and countries | The internet, Delhi-Mumbai link | Higher latency (~30 ms), higher cost |
- Step 1
1.Delhi office LAN (LAN 1)
- Step 2
2.City fiber MAN joins Delhi and Noida (LAN 2)
- Step 3
3.Data leaves the city over ISP links
- Step 4
4.Internet (WAN) carries it across the country
- Step 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.
| Topology | Shape | Strength | Weakness |
|---|---|---|---|
| Bus | One main cable | Cheap, simple | Cable cut = all stop |
| Ring | Circle | Ordered data flow | One break can disturb the ring |
| Star | All on one switch | One cable cut affects one device; most common today | Switch down = all down |
| Mesh | Many paths | Reliable, alternate routes | Costly cabling and ports |
| Hybrid | Star inside, mesh between sites | Balance of cost and reliability | More 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.
ip -4 addr show eth0ip routeping -c 3 192.168.1.20ping -c 3 8.8.8.8$ 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.
ipconfig /allroute print -41.8 Practical: LAN vs WAN latency
$ 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.
- Step 1
1.Phone -> Wi-Fi router: Wi-Fi OK, signal full (LAN works)
- Step 2
2.Router -> ISP link goes down (WAN broken)
- Step 3
3.Packets to the internet cannot leave the router
- Step 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).