impera Open Impera

IB Diploma Computer Science · Concepts of computer science

Networks

1Types of network

A network is two or more devices connected to share data and resources.

  • LAN (local area network): covers a small area such as a home, school or office; usually owned by one organisation.
  • WAN (wide area network): covers a large area, linking LANs across cities or countries, often using leased lines. The internet is the largest WAN.
  • PAN (personal area network): devices around one person, such as a phone and earbuds over Bluetooth.
  • VPN (virtual private network): an encrypted "tunnel" across a public network, so a remote user can work as if on the private network.

Two ways to organise a network:

  • Client–server: central servers provide services (files, web pages, email, logins) to clients. Easier to manage, back up and secure, but the server is a single point of failure and costs more.
  • Peer-to-peer (P2P): every device is equal and shares directly with others. Cheap and resilient, but harder to secure and manage.

Topology is the layout of connections:

  • Star: every device connects to a central switch. If one cable fails only that device is affected, but if the switch fails the network goes down. The most common LAN layout.
  • Mesh: devices connect to many others, so data has several possible routes. Very reliable (the internet's core is a partial mesh) but needs more cabling.

Star and mesh topologies

Check yourself

What is a disadvantage of a client–server network?

  • Security cannot be managed centrally

  • The server is a single point of failure

  • Files cannot be backed up centrally

  • Clients cannot access shared files

Show the answer

The server is a single point of failure

If the server goes down, its services stop.

2Network hardware and media

  • Network interface card (NIC): lets a device connect to a network; each has a unique MAC address.
  • Switch: connects devices within a LAN and forwards data only to the device it is meant for, using MAC addresses.
  • Router: connects different networks (such as a home LAN and the internet) and forwards packets towards their destination using IP addresses.
  • Wireless access point (WAP): lets devices join the network by Wi-Fi.
  • Modem: converts between digital data and the signals used on a line (such as telephone or cable).
  • Firewall: hardware or software that checks incoming and outgoing traffic against rules and blocks what is not allowed.

Transmission media:

  • Copper cable (twisted pair, Ethernet): cheap and common, but limited distance and affected by interference.
  • Fibre-optic cable: sends light pulses; very high bandwidth over long distances, immune to electrical interference, but more expensive.
  • Wireless (Wi-Fi, mobile networks): convenient and mobile, but slower and less secure, and affected by distance and walls.

Bandwidth is the amount of data that can be sent per second (bits per second); latency is the delay before data arrives.

Worked example

Download time

  1. A 2 GB file is downloaded over a 100 Mbps connection.
  2. 2 GB = 2 × 8 = 16 gigabits = 16 000 megabits (using 1 GB = 1000 MB).
  3. Time = 16 000 ÷ 100 = 160 seconds, about 2.7 minutes (ignoring overheads).
Check yourself

Which device connects a home network to the internet and forwards packets using IP addresses?

  • A router

  • A switch

  • A network interface card

  • A wireless access point

Show the answer

A router

Switches work within a LAN using MAC addresses.

3Protocols and layers

A protocol is an agreed set of rules for communication, so devices made by different companies can understand each other.

The TCP/IP model splits networking into four layers, each with its own job and protocols:

  • Application layer: what programs use. HTTP and HTTPS (web), SMTP and IMAP (email), FTP (file transfer), DNS (looking up addresses).
  • Transport layer: TCP splits data into numbered segments, checks they all arrive, and resends any lost ones (reliable). UDP is faster but does not check (used for live video, games, calls). Port numbers identify the program, such as 80 for HTTP and 443 for HTTPS.
  • Internet (network) layer: IP adds the source and destination IP addresses and routes packets across networks.
  • Link layer: sends frames over the physical connection, using MAC addresses (Ethernet, Wi-Fi).

As data goes down the layers on the sender, each layer adds a header: this is encapsulation. The receiver strips the headers off in reverse. The more detailed OSI model has seven layers that map onto these four.

The TCP/IP model: each layer wraps the data in its own header

Check yourself

Which transport protocol checks that every segment arrives and resends lost ones?

  • TCP

  • UDP

  • IP

  • HTTP

Show the answer

TCP

UDP is faster but unreliable.

4Addresses and packet switching

  • An IPv4 address is 32 bits, written as four numbers 0–255, such as 192.168.1.10. That allows about 4.3 billion addresses ($2^{32}$), which is not enough.
  • An IPv6 address is 128 bits, written in hexadecimal, giving about $3.4 \times 10^{38}$ addresses.
  • A MAC address is 48 bits, fixed to the network card, and used within a local network.
  • DHCP automatically gives each device an IP address when it joins a network. NAT lets many devices in a home share one public IP address.
  • DNS (Domain Name System) translates names such as www.example.org into IP addresses, like a phone book.

Packet switching: data is broken into small packets, each with a header (source, destination, sequence number). Packets may take different routes through the network and are reassembled in order at the destination. This uses the network efficiently and routes around failures. (Old telephone networks used circuit switching, reserving one path for the whole call.)

Check yourself

What does DNS do?

  • Encrypts web traffic between client and server

  • Assigns MAC addresses to network devices

  • Translates domain names into IP addresses

  • Splits data into packets for transmission

Show the answer

Translates domain names into IP addresses

It works like a phone book for the internet.

5Network security

Threats:

  • Malware: viruses (attach to files and spread when run), worms (spread by themselves across networks), trojans (disguised as useful software), ransomware (encrypts files and demands payment) and spyware.
  • Phishing: fake emails or websites that trick people into giving passwords or details. Social engineering in general manipulates people rather than technology.
  • Denial-of-service (DoS / DDoS) attacks flood a server with traffic so real users cannot reach it.
  • Interception of unencrypted data, for example on public Wi-Fi.

Defences:

  • Firewalls, antivirus software and keeping systems updated (patching known flaws).
  • Strong authentication: long passwords, and multi-factor authentication (MFA), which needs something you know plus something you have (a phone) or are (a fingerprint).
  • Encryption: scrambling data so only someone with the key can read it.
  • Symmetric encryption uses the same key to encrypt and decrypt: fast, but the key must be shared safely.
  • Asymmetric (public-key) encryption uses a public key to encrypt and a matching private key to decrypt. HTTPS uses it to agree a symmetric key safely, then switches to fast symmetric encryption.
  • Digital certificates prove a website's identity. Digital signatures prove who sent a message and that it was not changed.
  • User training, access rights (giving people only what they need), and backups.
Check yourself

Why is multi-factor authentication more secure than a password alone?

  • It encrypts the whole hard disk, so files cannot be read

  • An attacker needs a second factor, such as the user's phone

  • It blocks all viruses before they can reach the device

  • It removes the need for passwords, so none can be stolen

Show the answer

An attacker needs a second factor, such as the user's phone

A stolen password alone is not enough.

Now test yourself

This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.

Practise in Impera