Networking and Internet: Topologies, OSI, IP, Protocols and MCQs
A computer network is a group of computers and devices connected so they can share data and resources such as printers and an internet connection. The internet is the worldwide network of networks. Every computer and IT test asks about network types, topologies, the roles of hubs, switches and routers, the OSI layers, IP addresses, common protocols, email and basic security threats. Most questions test one clear fact, so learning each idea with its key word is the fastest way to score.
Asked in: PPSC, FPSC, NTS, ETEA, KPPSC, SSC, IBPS and ICS/ECAT computer
Types of networks and transmission media
Networks are classified by the area they cover. A PAN (personal area network) links devices around one person, for example a phone and earbuds over Bluetooth. A LAN (local area network) covers a room, building or campus, such as an office or a school lab. A MAN (metropolitan area network) covers a city. A WAN (wide area network) covers a country or the world; the internet is the largest WAN.
An intranet is a private network inside an organisation that uses internet technologies; an extranet extends part of an intranet to selected outsiders such as suppliers. In a client-server network, central servers provide services to clients; in a peer-to-peer network every computer is equal and shares directly.
Wired media include twisted-pair cable (the common Ethernet cable with RJ-45 connectors), coaxial cable (used for cable TV) and optical fibre, which carries data as light, gives the highest speed over long distances and is not affected by electrical interference. Wireless media include radio waves (Wi-Fi, Bluetooth), microwaves and satellite links. Data transfer speed (bandwidth) is measured in bits per second, such as Mbps and Gbps.
- PAN β LAN β MAN β WAN (smallest to largest)
- LAN: building or campus; MAN: city; WAN: country or world (internet)
- Intranet: private to an organisation; Extranet: shared with partners
- Optical fibre: light, fastest, immune to electrical interference
- Speed measured in bps (Mbps, Gbps)
Network topologies and transmission modes
Topology is the layout in which devices are connected. In a bus topology all devices share one main cable (backbone); it is cheap, but a break in the backbone stops the network. In a star topology every device connects to a central hub or switch; it is easy to manage and one cable failure affects only one device, but if the central device fails the whole network stops. Most modern LANs use a star layout.
In a ring topology each device connects to two neighbours to form a closed loop, and data travels around the ring, often controlled by a token. In a mesh topology every device has a direct link to every other device; it is the most reliable but needs the most cable. A full mesh of n devices needs n(n β 1) Γ· 2 links. A tree topology joins several star networks in a hierarchy, and a hybrid topology mixes two or more types.
Data can flow in three modes. Simplex is one way only (keyboard to computer, TV broadcast). Half-duplex is both ways but one at a time (walkie-talkie). Full-duplex is both ways at the same time (telephone call).
- Bus: one backbone; Star: central hub or switch; Ring: closed loop
- Mesh: every device linked to every other; links = n(n β 1) Γ· 2
- Tree: hierarchy of stars; Hybrid: mixture
- Simplex: one way; Half-duplex: walkie-talkie; Full-duplex: telephone
Networking devices
A network interface card (NIC) connects a computer to a network; each NIC has a unique 48-bit physical address called the MAC address. A modem (modulator-demodulator) converts digital signals from a computer into signals suitable for a telephone, cable or fibre line and back again.
A hub is a simple central device that repeats incoming data to all of its ports, so every connected device receives it. A switch is smarter: it learns the MAC addresses of connected devices and sends each frame only to the port of the intended device, reducing unnecessary traffic. A repeater regenerates a weakening signal to extend the distance of a cable. A bridge joins two LAN segments and filters traffic by MAC address.
A router connects different networks, such as a home LAN and the internet, and chooses the best path for each packet using IP addresses. A gateway connects networks that use different protocols and translates between them. An access point lets wireless devices join a wired network.
- Hub: sends to all ports; Switch: sends to the right port using MAC
- Router: connects different networks, forwards by IP address
- Repeater: boosts signal; Bridge: joins LAN segments
- Modem: modulation and demodulation; NIC: has the MAC address
- Gateway: joins networks with different protocols
OSI and TCP/IP models
The OSI (Open Systems Interconnection) reference model divides network communication into seven layers. From bottom to top: 1 Physical (bits on the medium, cables, hubs, repeaters), 2 Data Link (frames, MAC addresses, switches, bridges), 3 Network (packets, IP addresses, routing, routers), 4 Transport (end-to-end delivery, segments, TCP and UDP), 5 Session (setting up and managing sessions), 6 Presentation (data format, encryption, compression) and 7 Application (services for the user such as HTTP, FTP, SMTP and DNS).
The TCP/IP model is the practical model on which the internet runs. It is usually described with four layers: Network Access (Link), Internet, Transport and Application. Some textbooks split the lowest layer into Physical and Data Link and describe five layers.
At the Transport layer, TCP (Transmission Control Protocol) is connection-oriented and reliable: it numbers segments, acknowledges them and resends lost ones. UDP (User Datagram Protocol) is connectionless and faster but does not guarantee delivery, so it suits live video, voice calls and online games. IP (Internet Protocol) at the Internet layer addresses and routes packets.
- OSI (bottom β top): Physical, Data Link, Network, Transport, Session, Presentation, Application
- Hub: layer 1; Switch: layer 2; Router: layer 3
- TCP/IP: Network Access, Internet, Transport, Application (4 layers)
- TCP: reliable, connection-oriented; UDP: fast, connectionless
IP addresses, protocols and the web
An IP address identifies a device on a network. An IPv4 address has 32 bits, written as four decimal numbers from 0 to 255 separated by dots, such as 192.168.1.10. IPv6 addresses have 128 bits, written in hexadecimal groups separated by colons, and were introduced because IPv4 addresses were running out. In the classful scheme the first number shows the class: A (1 to 126), B (128 to 191), C (192 to 223), D (224 to 239, multicast) and E (240 to 255, experimental). 127.0.0.1 is the loopback address (localhost). The ranges 10.x.x.x, 172.16.x.x to 172.31.x.x and 192.168.x.x are private, used inside LANs.
Common protocols and their standard ports: HTTP (web pages, port 80), HTTPS (secure web using TLS encryption, port 443), FTP (file transfer, ports 20 and 21), SMTP (sending email, port 25), POP3 (downloading email, port 110), IMAP (reading email kept on the server, port 143), DNS (port 53), SSH (secure remote login, port 22) and Telnet (unsecured remote login, port 23). DHCP automatically gives IP addresses to devices.
DNS (Domain Name System) translates domain names such as www.example.com into IP addresses. A URL (Uniform Resource Locator) is the full address of a web resource, for example https://www.example.com/index.html: protocol, domain name and path. The World Wide Web is the system of linked web pages written in HTML and accessed with a browser over HTTP; it is one service that runs on the internet, not the internet itself.
- IPv4: 32 bits (4 numbers, 0 to 255); IPv6: 128 bits; MAC: 48 bits
- Class A 1 to 126; B 128 to 191; C 192 to 223; 127.0.0.1 = loopback
- HTTP 80; HTTPS 443; FTP 20/21; SMTP 25; POP3 110; IMAP 143; DNS 53; SSH 22
- DNS: domain name β IP address; DHCP: assigns IP addresses
- WWW is a service on the internet; web pages use HTML
Email and network security
An email address has the form username@domain, such as ali@example.com. SMTP sends mail from the client to the server and between servers; POP3 downloads messages to one device (often removing them from the server), while IMAP keeps them on the server and in sync across devices. CC (carbon copy) recipients are visible to everyone; BCC (blind carbon copy) recipients receive the message but their addresses are hidden from all other recipients. Attachments are files sent along with the email.
Malware is harmful software. A virus attaches itself to a file or program and spreads when that file is run or shared. A worm is a standalone program that copies itself across networks without needing a host file or user action. A Trojan horse pretends to be useful software but does harm once installed. Spyware secretly collects information, and ransomware encrypts the victim's files and demands payment to unlock them.
Phishing uses fake emails, messages or websites that imitate a trusted organisation to trick people into giving passwords, card numbers or OTP codes. Defences include a firewall, which monitors and filters incoming and outgoing traffic according to security rules; antivirus software; regular updates; strong passwords; two-factor authentication; and encryption, which turns data into unreadable ciphertext that only the holder of the key can read.
- SMTP: send; POP3: download; IMAP: keep in sync on server
- CC: visible copy; BCC: hidden copy
- Virus: needs a host file; Worm: spreads by itself over networks
- Trojan: disguised as useful; Ransomware: encrypts files for payment
- Phishing: fake messages to steal details; Firewall: filters traffic by rules
Solved examples
- A school connects the 40 computers in its lab so they can share a printer. Which type of network is this? (A) PAN (B) LAN (C) MAN (D) WAN
- The computers are all in one room of one building.
- A network covering a room, building or campus is a LAN.
- A PAN (A) covers one person's devices, a MAN (C) a city and a WAN (D) a country or the world.
Answer: (B) LAN - In an office, a central device receives data and forwards it only to the computer it is meant for, using MAC addresses. What is the device and at which OSI layer does it mainly work?
- Forwarding to a single port by MAC address is the behaviour of a switch; a hub would send to every port.
- MAC addresses belong to the Data Link layer, layer 2 of the OSI model.
Answer: A switch, at the Data Link layer (layer 2) - How many cables are needed to connect 6 computers in a full mesh topology, and how many ports does each computer need?
- Each pair of computers needs one link, so links = n(n β 1) Γ· 2 = 6 Γ 5 Γ· 2 = 15.
- Each computer connects to the other 5, so it needs 5 ports.
Answer: 15 cables; 5 ports per computer - Identify the class of each IPv4 address and say which are private: 10.4.2.1, 172.16.10.5, 192.168.1.10.
- Look at the first number: 10 is in 1 to 126 (class A), 172 is in 128 to 191 (class B), 192 is in 192 to 223 (class C).
- 10.x.x.x, 172.16.x.x to 172.31.x.x and 192.168.x.x are the private ranges, so all three addresses are private.
Answer: Class A, B and C respectively; all three are private addresses - Neha types www.example.com in her browser. Which protocol finds the server's IP address, and which protocol then delivers the web page securely?
- Computers route by IP address, so the domain name must first be translated. DNS does this.
- The browser then requests the page. When the address begins with https, HTTPS is used, which is HTTP protected by TLS encryption on port 443.
Answer: DNS resolves the name; HTTPS delivers the page - Hamza sends an email To Sara, CC Ravi and BCC Ayesha. Who can see whose address?
- To and CC addresses are visible to everyone who receives the message.
- A BCC address is hidden from all other recipients.
- So Sara and Ravi see each other but do not know Ayesha received it; Ayesha sees Sara and Ravi.
Answer: Sara and Ravi see each other only; Ayesha sees both, but her own copy is hidden from them
Exam shortcuts
- Device to layer: hub and repeater layer 1, switch and bridge layer 2, router layer 3.
- Remember OSI from the top with "All People Seem To Need Data Processing": Application, Presentation, Session, Transport, Network, Data Link, Physical.
- Mail direction: SMTP sends, POP3 and IMAP receive.
- Bit lengths: IPv4 32, MAC 48, IPv6 128.
- For mesh topology always use n(n β 1) Γ· 2 for links and n β 1 for ports per device.
Common mistakes
- Treating the internet and the World Wide Web as the same thing. The web is one service that runs on the internet, alongside email, file transfer and others.
- Saying a hub sends data only to the destination computer. That is a switch; a hub repeats data to all ports.
- Calling a worm a virus. A virus needs a host file and user action; a worm spreads on its own.
- Forgetting that 127.x.x.x is reserved for loopback, so class A in practice runs from 1 to 126.
- Thinking BCC recipients cannot see the To and CC addresses. They can; it is their own address that is hidden.
Practice MCQs
- A network that covers an entire city is called a:
A) LAN
B) PAN
C) SAN
D) MAN
Answer: D) MAN β A metropolitan area network (MAN) spans a city. A LAN covers a building or campus, a PAN covers the devices of one person, and a SAN (storage area network) is a specialised network that connects servers to shared storage, not a city-wide network. - Which device connects different networks and forwards packets using IP addresses?
A) Hub
B) Router
C) Repeater
D) Switch
Answer: B) Router β A router joins separate networks, such as a LAN and the internet, and chooses paths using IP addresses. A hub repeats data to all ports, a repeater only boosts the signal, and a switch forwards frames within a network by MAC address. - In which topology are all devices connected to a single central hub or switch?
A) Star
B) Bus
C) Ring
D) Mesh
Answer: A) Star β In a star topology every device has its own cable to a central hub or switch. A bus uses one shared backbone cable, a ring connects each device to two neighbours in a loop, and a mesh links every device directly to every other device. - How many layers does the OSI reference model have?
A) 7
B) 4
C) 5
D) 6
Answer: A) 7 β The OSI model has seven layers, from Physical to Application. Four is the usual number of layers in the TCP/IP model, five appears when some books split its lowest layer, and six would leave out one of the OSI layers. - Which protocol is used to send email from a client to a mail server?
A) POP3
B) SMTP
C) IMAP
D) FTP
Answer: B) SMTP β SMTP (Simple Mail Transfer Protocol) sends outgoing mail. POP3 and IMAP are used to receive or read mail from the server, and FTP transfers files rather than sending email. - What is the main function of DNS?
A) Assigning IP addresses automatically
B) Translating domain names into IP addresses
C) Encrypting web pages
D) Blocking viruses
Answer: B) Translating domain names into IP addresses β DNS converts names such as www.example.com into the IP addresses computers use to connect. Automatic assignment of IP addresses is done by DHCP, encryption of web traffic is done by TLS in HTTPS, and blocking viruses is the job of antivirus software and firewalls. - How many bits are in an IPv4 address?
A) 48
B) 128
C) 64
D) 32
Answer: D) 32 β An IPv4 address has 32 bits, written as four 8-bit numbers. 48 bits is the length of a MAC address, 128 bits is the length of an IPv6 address, and 64 bits matches none of these standard address types. - Which malware copies itself across a network on its own, without attaching to a host file?
A) Virus
B) Worm
C) Trojan horse
D) Spyware
Answer: B) Worm β A worm is a standalone program that spreads through networks by itself. A virus needs a host file and usually a user action to spread, a Trojan horse is disguised as useful software and does not replicate on its own, and spyware secretly gathers information rather than spreading. - A system that monitors incoming and outgoing network traffic and allows or blocks it according to security rules is a:
A) Modem
B) Hub
C) Firewall
D) Repeater
Answer: C) Firewall β A firewall filters traffic by rules to protect a computer or network. A modem converts signals for a phone, cable or fibre line, a hub repeats data to all of its ports, and a repeater regenerates a weak signal; none of them enforces security rules. - At which OSI layer do routers mainly operate?
A) Network layer
B) Data Link layer
C) Physical layer
D) Transport layer
Answer: A) Network layer β Routers work with IP addresses and routing, which belong to the Network layer (layer 3). Switches and bridges work at the Data Link layer, hubs and repeaters at the Physical layer, and TCP and UDP at the Transport layer. - An email that pretends to be from a bank and asks the user to enter a password on a fake website is an example of:
A) Phishing
B) Spam
C) Firewalling
D) Encryption
Answer: A) Phishing β Phishing uses fake messages and sites that copy a trusted organisation to steal details. Spam is unwanted bulk mail and does not by itself aim to steal passwords, firewalling is a defence that filters traffic, and encryption protects data instead of stealing it. - What is the default port number for HTTPS?
A) 80
B) 21
C) 443
D) 25
Answer: C) 443 β HTTPS, the secure version of HTTP protected by TLS, uses port 443. Port 80 is used by plain unencrypted HTTP, port 21 by the FTP control connection and port 25 by SMTP for sending mail. - To which class does the IPv4 address 172.16.10.5 belong?
A) Class A
B) Class C
C) Class D
D) Class B
Answer: D) Class B β The first number, 172, lies in the range 128 to 191, which is class B. Class A covers 1 to 126, class C covers 192 to 223, and class D covers 224 to 239 and is reserved for multicast. - How many links are needed to connect 6 devices in a full mesh topology?
A) 30
B) 6
C) 15
D) 36
Answer: C) 15 β Links = n(n β 1) Γ· 2 = 6 Γ 5 Γ· 2 = 15. 30 forgets to divide by 2 and counts each link twice, 6 is just the number of devices, and 36 is 6 Γ 6, which wrongly includes links from each device to itself. - Ali sends an email To Sara, CC Ravi and BCC Neha. Which statement is correct?
A) Neha cannot see the address of Sara
B) Sara cannot see the address of Ravi
C) Sara and Ravi cannot see that Neha received it
D) Ravi cannot see the address of Sara
Answer: C) Sara and Ravi cannot see that Neha received it β BCC hides only the BCC recipient's address, so Sara and Ravi do not know Neha got the message. Neha can still see the To and CC addresses, and the To and CC addresses of Sara and Ravi are visible to each other, so the claims that any of these addresses are hidden are wrong.
Questions
What is the difference between a hub, a switch and a router?
A hub sends incoming data to every port. A switch sends it only to the destination device using MAC addresses. A router connects different networks and forwards packets using IP addresses.
What is the difference between the internet and the World Wide Web?
The internet is the global network of networks. The World Wide Web is a service on it: a collection of linked web pages accessed with a browser over HTTP or HTTPS.
How many layers does the TCP/IP model have?
It is usually described with four layers: Network Access, Internet, Transport and Application. Some books describe five by splitting the lowest layer into Physical and Data Link. The OSI model has seven.
Which networking topics are most common in job tests?
Network types, topologies, the roles of hub, switch and router, OSI layers, IP versions and classes, protocol names and ports, email terms such as CC and BCC, and malware and phishing.