Comprehensive theory, key formulas, diagrams, and memory aids for Computer Networks.
A computer network is a collection of computers and other devices connected together so that they can share data, software and hardware resources. The Internet itself is the largest network of all, interconnecting billions of devices worldwide. Networks enable email, web browsing, file sharing, online banking, video conferencing and countless other services that have become part of daily life. A network exists because sharing is cheaper and more convenient than duplicating resources on every machine.
Networks are built from hardware components and software rules. The hardware includes network interface cards (NIC), cables, switches, routers and modems. The software rules, called protocols, define how devices communicate, for example how a message is formatted, addressed and checked for errors. Protocols such as TCP/IP, HTTP and FTP make it possible for devices of different makes and operating systems to exchange data reliably.
This chapter explains network advantages and types, the topologies used to connect devices, the transmission media over which signals travel, important network devices, addressing through IP addresses and MAC addresses, the layered reference models, and the protocols that operate at each layer. Network questions in the board examination include definitions, protocol-to-purpose matching, identifying topologies from diagrams, and choosing the right medium for a given scenario.
Networking offers several practical benefits. Resource sharing allows multiple users to share expensive hardware such as printers, scanners and storage. Data sharing lets authorised users access files from anywhere on the network. Communication becomes fast through email, chat and video calls. Networks also provide reliability through redundant paths, and they enable centralised backup and security management so data can be protected in one place. In examinations, these advantages are often asked as one-mark definition or benefit questions.
Networks are classified by their geographic span.
PAN < 10 m (Bluetooth, personal)
LAN building (Ethernet, Wi-Fi)
MAN city (cable operators, campus)
WAN world (Internet)
Topology refers to the arrangement of computers and the connecting cables in a network. The main topologies are:
# A simple adjacency matrix for a mesh network of 4 nodes
nodes = ["A", "B", "C", "D"]
adjacency = [[0, 1, 1, 1],
[1, 0, 1, 1],
[1, 1, 0, 1],
[1, 1, 1, 0]]
for i in range(len(nodes)):
for j in range(len(nodes)):
if adjacency[i][j]:
print(nodes[i], "-", nodes[j])
Transmission media is the physical path over which data travels between devices. It is divided into guided media (cables) and unguided media (wireless).
def choose_medium(distance, speed, budget):
if distance > 100 and speed > 1000:
return "Optical fibre"
elif budget < 5000:
return "Twisted pair"
else:
return "Coaxial cable"
Several hardware devices build and connect networks. Modem (modulator-demodulator) converts digital signals to analogue and back for transmission over telephone lines. Ethernet Card (NIC) provides the physical interface for a computer to join a LAN. Switch connects computers within a LAN and forwards data intelligently to the correct destination based on MAC addresses. Router connects different networks and forwards data between them based on IP addresses; home broadband routers connect the home LAN to the Internet. Repeater regenerates weak signals to extend the distance, and Gateway connects networks that use different protocols.
Every device on a network needs an address so that data reaches the correct destination.
ipv4 = "192.168.1.10"
octets = ipv4.split(".")
print("Octets:", octets) # ['192', '168', '1', '10']
print("Length:", len(octets)) # 4
Communication between devices is broken into layers so that each layer handles one aspect of the process. The OSI (Open Systems Interconnection) reference model has seven layers: Physical, Data Link, Network, Transport, Session, Presentation and Application. The TCP/IP model condenses this into four layers: Network Interface (Link), Internet, Transport and Application.
Each layer serves the layer above and uses the layer below. At the sending end, data moves down the layers being wrapped in headers (encapsulation); at the receiving end, it moves up with headers removed (decapsulation). This layered design makes protocols modular and easier to design and maintain.
| Layer | Function | Example Protocols |
|---|---|---|
| Application | User-facing services | HTTP, FTP, SMTP, DNS |
| Transport | End-to-end delivery, error control | TCP, UDP |
| Internet / Network | Addressing and routing | IP, ICMP |
| Link / Network Interface | Physical frames, MAC addresses | Ethernet, Wi-Fi |
A protocol is a set of rules that governs communication between devices. Key protocols include:
def describe_protocol(protocol):
table = {
"TCP": "reliable connection-oriented",
"UDP": "fast connectionless",
"HTTP": "web page transfer",
"FTP": "file transfer",
"SMTP": "send email",
"DNS": "name to IP resolution",
}
return table.get(protocol, "unknown")
print(describe_protocol("DNS"))
| Network | Coverage | Example |
|---|---|---|
| PAN | Few metres | Bluetooth devices |
| LAN | Building / campus | School computer lab |
| MAN | City | City cable network |
| WAN | Country / world | Internet |
| Medium | Speed | Distance | Cost | Interference Immunity |
|---|---|---|---|---|
| Twisted Pair | Low | Short | Low | Low |
| Coaxial | Medium | Medium | Medium | Medium |
| Optical Fibre | Very High | Long | High | Very High |
flowchart TD
A[Computer Networks] --> B[Advantages]
B --> B1[Resource sharing]
B --> B2[Data sharing and communication]
A --> C[Types]
C --> C1[PAN LAN MAN WAN]
A --> D[Topologies]
D --> D1[Star Bus Ring Mesh]
A --> E[Transmission Media]
E --> E1[Guided: twisted, coaxial, fibre]
E --> E2[Unguided: radio waves]
A --> F[Network Devices]
F --> F1[Modem Switch Router Repeater]
A --> G[Addressing]
G --> G1[IP address IPv4 IPv6]
G --> G2[MAC address]
A --> H[Models and Protocols]
H --> H1[OSI 7 layers]
H --> H2[TCP IP model]
H --> H3[HTTP FTP SMTP DNS]
Computer networks connect devices to share resources, data and communication across any distance. Their types span from personal area networks to the global Internet, and their topologies trade cost against reliability. Signals travel through guided media like twisted pair and optical fibre or through unguided radio waves, carried by devices from modems to routers. Logical IP addresses and physical MAC addresses identify every node, while layered models such as OSI and TCP/IP organise the complex process of communication into manageable functions. Protocols define the exact rules by which all this happens. Together these concepts explain how data moves from one machine to another. The next chapter examines the security aspects of networking, protecting this valuable data from the threats that travel along the same wires and waves.