A computer network is two or more devices connected so they can share data. Your phone on Wi-Fi, your college computer lab and the whole internet are all networks. They differ in size, but they work on the same basic ideas.
This page explains those ideas in plain words: IP addresses, switches and routers, LAN, MAN and WAN, DNS and protocols. There is one diagram of a home network that ties it all together. No coding knowledge is needed.
What is a network? The postal system analogy
Think of how India Post delivers a letter.
| Postal system | Computer network |
|---|---|
| The letter | The data you send (a message, a photo, a web page) |
| The house address and PIN code | The IP address |
| The local post office | The router |
| Sorting the letter by PIN code | Routing: choosing the next hop |
| The rules for writing an address | Protocols |
| Looking up a friend's address in your contacts | DNS |
Large data is broken into small pieces called packets. Each packet carries the sender's and receiver's IP addresses, travels on its own, and is put back together at the other end, just as a large parcel might be sent in several boxes.
Why we build networks
- Share resources: one printer or one internet connection for the whole lab.
- Share data: send files, messages and emails.
- Use remote services: websites, online banking, UPI payments and cloud storage all run on servers you reach over a network. Renting such servers over the internet is called cloud computing.
- Work together: video calls, shared documents and online exams.
IP address basics
Every device on a network needs an address so data can reach it. That address is the IP address (Internet Protocol address).
IPv4 example: 192.168.1.10
4 numbers, each from 0 to 255, separated by dots
(each number is 8 bits, so 32 bits in total)
IPv6 example: 2001:db8::1
written in hexadecimal; 128 bits in total
IPv4 allows about 4.3 billion addresses, which is not enough for every phone and laptop on Earth. IPv6 was created to fix that, and many mobile networks already use it. If the "8 bits" and "32 bits" parts are new to you, read binary number system explained.
Private and public IP addresses
- A private IP works only inside your local network. Home routers usually give out addresses such as
192.168.1.xor192.168.0.x. - A public IP is the address the rest of the internet sees. Your whole home usually shares one public IP, and the router keeps track of which reply belongs to which device. This is called NAT (Network Address Translation).
MAC address
Each network card also has a MAC address, such as 3C:52:82:4A:1B:7F, set by the manufacturer. The MAC address is used inside a local network. The IP address is used to reach devices across networks.
Ports
One computer runs many programs that use the network. A port number tells the computer which program the data is for. Web servers usually listen on port 80 (HTTP) and 443 (HTTPS). Think of the IP address as the building and the port as the flat number.
Network devices
| Device | What it does | Analogy |
|---|---|---|
| Network card (NIC) | Lets a device connect, by cable or Wi-Fi | The front door of a house |
| Switch | Connects devices in the same local network and sends data only to the device it is meant for | A building's intercom that rings only the right flat |
| Router | Connects different networks and picks the path for each packet | The post office that sends letters to other cities |
| Wi-Fi access point | Lets wireless devices join the network | A doorway without a door |
| Modem / ONT | Connects your home to the internet provider's line (fibre, cable or phone line) | The road from your colony to the main highway |
Your home "Wi-Fi router" is usually a router, a switch, a Wi-Fi access point and sometimes a modem, all in one box.
The one diagram: a home network
The Internet (WAN)
|
Internet provider (ISP)
|
Fibre line / modem (ONT)
|
+----------------+----------------+
| Home Wi-Fi router |
| public IP: (given by ISP) |
| private IP: 192.168.1.1 |
+-------+----------+----------+---+
| | |
Laptop Phone Smart TV
192.168.1.10 192.168.1.11 192.168.1.12
<-------------------- Home LAN ---------------------->
When you open a website on the laptop:
- The laptop asks DNS for the website's IP address.
- It sends packets to the router at
192.168.1.1. - The router replaces the private address with the public one (NAT) and sends the packets to the internet provider.
- Routers across the internet pass the packets along, hop by hop, until they reach the website's server.
- The server's reply comes back the same way, and the router hands it to the laptop.
Our how websites work guide follows this same journey from the browser's side.
LAN, MAN and WAN
Networks are grouped by the area they cover.
| Type | Full form | Area | Example | Typical owner |
|---|---|---|---|---|
| PAN | Personal Area Network | A few metres | Phone connected to Bluetooth earbuds | You |
| LAN | Local Area Network | A room, home, lab or building | College computer lab, office floor, home Wi-Fi | One person or organisation |
| MAN | Metropolitan Area Network | A city | A cable or fibre network linking offices across Hyderabad | A company or city body |
| WAN | Wide Area Network | States, countries, the world | A bank linking all its branches; the internet | Telecom companies, large firms |
LANs are fast and cheap to run. WANs cover huge distances and rely on telecom companies' links, including undersea cables.
DNS: the internet's contacts list
People remember names like example.com. Computers need IP addresses. DNS (Domain Name System) connects the two.
You type: example.com
DNS lookup: "What is the IP of example.com?"
DNS replies: an IP address, for example 93.184.215.14
Browser: connects to that IP address
The exact address can change over time; the point is that DNS does the lookup so you never have to remember numbers. Your device also remembers recent answers for a while, so repeat visits are faster.
Protocols: the rules of the network
A protocol is an agreed set of rules for sending data. Some you will hear often:
| Protocol | What it is for |
|---|---|
| IP | Addressing and routing packets between networks |
| TCP | Reliable delivery: checks that every packet arrives, in order, and resends lost ones |
| UDP | Fast delivery without those checks; used in video calls, live streaming and online games |
| HTTP / HTTPS | Fetching web pages and calling APIs; HTTPS adds encryption |
| DNS | Turning names into IP addresses |
| DHCP | Giving devices an IP address automatically when they join a network |
| SMTP, IMAP | Sending and receiving email |
TCP and UDP are a favourite interview pair. Read TCP vs UDP for the full comparison.
The layer idea in one line
Networking is split into layers, each with one job. The TCP/IP model has four: Application (HTTP, DNS), Transport (TCP, UDP), Internet (IP) and Link (Ethernet, Wi-Fi). The OSI model splits the same work into seven layers and is the one most often asked in exams.
Try it on your own computer
These commands work in Command Prompt on Windows, or Terminal on Linux and macOS:
ipconfig (Windows) shows your device's IP address
ip addr (Linux) shows your device's IP address
ping example.com checks if a server replies, and how fast
nslookup example.com asks DNS for the IP address of a name
tracert example.com (Windows) lists the routers between you and the server
traceroute example.com (Linux/macOS)
Your results will differ from anyone else's, because they depend on your network. Try them at home and in your college lab and compare the private IP addresses you see.
Quick revision
- A network is devices connected to share data.
- An IP address identifies a device; a port identifies a program on it.
- A switch connects devices in one LAN; a router connects networks.
- LAN is a home or building, MAN a city, WAN a country or the world.
- DNS turns names into IP addresses.
- TCP is reliable, UDP is fast.
To test yourself, go through our computer networks interview questions for freshers. For how the computer itself manages the network card and every other device, read what is an operating system.
Frequently Asked Questions
What is a computer network in simple words?
What is an IP address?
What is the difference between LAN, MAN and WAN?
What does a router do?
What is DNS?
What is the difference between a switch and a router?
Want to Build Your Career in Java Full Stack with AI?
Join CodeBegun and train with working industry engineers — Explore the Java Full Stack program

