Network
Data communication: exchange of data between 2 devices via some form of transmission medium such as wire cable
- delivery, accuracy, timeliness, jitter (variation in packet arrival time)
A network is two or more computers/devices connected together for the purpose of communication
Advantages:
- File sharing
- hardware sharing (printer)
- communication (email, chat, video)
- roaming access
- Centralized maintenance and updates
- Centralized security
- user monitoring
- Different access levels
Disadvantages
- cost
- additional resources to manage network
- spread of malware
- hacking
Local Area Network (LAN)
- geographically confined to one building or site
Wide Area Network (WAN)
- network spread over a wide geographical area
Internetwork/internet
- 2 or more networks (LAN or WAN) are connected
Network Types
- Internet
- global system of interconnected computer networks that use the internet protocol suite (TCP/IP) to communicate between networks and devices
- Intranet
- private computer network used within an organisation to facilitate communication, collaboration and access to company resources
- restricted to authorized users within the organisation
OSI model (Please Do Not Throw Sausage Pizza Away)

**Physical layer; carry bit stream over physical medium **
- representation of bits: bits encoded into electrical/optical signals
- Digital signals use discrete voltages (0V for 0 and 5V for 1)
- Analog signals are continuous waveforms that represent data as continuously varying voltage, current or EM field
- data rate: transmission rate (bits sent per second) is defined by physical layer
- synchronization of bits:sender and receiver must not only use the same bit rate but must also be synchronized to prevent data loss or corruption
- Line configuration: connection of devices to the media (point to point or multipoint)
- Point to point: dedicated link between 2 devices; entire capacity of the link is reserved for transmission between the 2 devices
- Multipoint: more than two devices share a single link
- Physical topology: defines how devices are connected to make a network
- **Mesh **topology
- Each device/node has a dedicated point-to-point link to every other node
- **Star **topology
- Each device/node has a dedicated point-to-point link to the central controller
- **Bus **topology
- Multipoint connection
- Long cable acts as backbone to link to all devices
- Devices are connected to bus cable by** drop lines **and taps
- **Ring **topology
- Each device has dedicated point-to-point connection with 2 other devices on either side of it
- Signal passed along ring in one direction from device to device unitl it reaches destination
- Repeater regenerates the bits and passes them along
- **Mesh **topology
- Transmission mode: simplex, half-duplex, full-duplex
- Transmission media
- Wired transmission
- Twisted pair cable: ethernet LANS
- Coaxial cable: cable TV, older networks
- Fiber Optic: transmit data at high speed over long distance
- Wireless transmission
- Radio waves: wifi and mobile networks
- Microwaves: satellite and long distance comms
- Infrared: short range comms (tv remote)
- Simplex: unidirectional communication (keyboards, monitors)
- **Half-duplex: **each device can both transmit and receive, but not at the same time (walkie-talkies)
- Full-duplex (both devices can transmit and receive simultaneously)
- Wired transmission
- Transmission media
Data link layer:
- split into 2 sublayers
- **LLC (Logical Link Control): **interface with network layer, handles error checking and flow control
- MAC (Media Access Control): handles channel access and physical addressing
- MAC address: 6 byte hardware address
- **first 3 bytes: **OUI (organizationally unique identifier - identifies manufacturer)
- last 3 bytes: device-specific identifier
- MAC address: 6 byte hardware address
- Direct communication between two devices on the same local network
- Frame
- Header with MAC address of source and destination
- Payload (actual data)
- Trailer with error-checking info
- Flow control: prevents overwhelming the receiver if rate data absorbed < rate data produced
- **Error control: **detect and retransmit damaged or lost frames
- Parity bits: detect single-bit errors
- checksums: summing values to detect corrupted ata
- CRC (Cyclic Redundancy Check): detect errors caused by noise or interference
- **Access control: **data link protocols determine which device has control over the link
- Media Access Control (MAC) to avoid collisions
- Career Sense Multiple Access with Collision Detection / Avoidance
- CSMA/CD: ethernet: devices listen before transmitting and **detect **collisions
- **CSMA/CA: **wireless networks: avoid collisions by waiting for clear signal
- If frames are distributed to different systems on the same network, the data link layer
- Physical addressing
- adds a header to the frame to define the sender and/or receiver of the frame
- If frame is intended for system outside the sender’s network, receiver address is the address of the connecting device that connects the network to the next one
**Network layer **
- Responsible for source-to-destination delivery of a packet
- Logical addressing
- If a packet passes network boundary, network layer adds a header that includes the logical addresses of sender and receiver
- Routing
- When independent networks or linked are connected together, connecting devices (routers or switches) route or switch the packets to final destination
**Transport layer **
- Process-to-process delivery of the message (process is an application program running on the host)
- Ensures whole message arrives intact and in order: error and flow control at the source-to-destination level
- **Service-point addressing **
- Computers often run several programs at the same time; source-to-destination delivery must be from a specific process on one computer to specific process on another
- Transport layer header contains Service-point address (or port address)
- Segmentation and reassembly
- message is divided into transmittable segments, each containing a sequence number, and reassembled at the transport layer
- Connection control
- Connectionless transport layer treats each segment as an independent packet and delivers it to the transport layer at dest. machine
- Connection-oriented transport layer makes connection with transport layer at destination machine first before delivering the packets, then terminate the connection
- Flow control (performed end to end)
- Error control: (process to process)
Session layer
- provides ability for presentation entities to organise communication for multiple communication sessions taking place at the same time
- Session initiation and teardown
- Token management: communication mode (simplex, half or full duplex)
- Session-connection to transport-connection (connection-oriented transfer): map between transport layer connections and the sessions taking place
Presentation layer
- responsible for the way data is presented to the application
- negotiates the form of data to be transferred (transfer syntax)
- presentation layer can provide compression, encryption, translation
Application layer
- Defining services at user-end
- Identification of services provided
- Defining Quality of Service (QoS) parameters for the application
- Defining security mechanisms (access control, authentication)
- Synchronisation of communication applications (connection-oriented)
Encapsulation: flow of data from application to physical layer


End-to-end data flow
At host A
- At host A, application decides it needs to communicate with host B
- Data passed down to presentation layer, which does required **transformations **(compression, encryption, translation), before passing down data to session layer
- Session layer **initiates **the communication session and passes data to transport layer
- (transport layer) Data is segmented and header(containing sequence number and acknowledgment number) is added to each segment -> passed down to network layer
- Network layer puts data into packets and headers are added to the packets -> packets sent to data link layer
- Data link layer puts data into frames and adds header and trailer to each frame
- Frames are sent down to physical layer where they are dealt with as raw bits -> transferred through physical channel to the router
At router
- Router reads up to network layer header to route data (partial decapsulation)
At host B
- raw bits are elevated as frames into data link layer
- header and trailer are read by data link layer and removed -> elevated to network layer as packets
- header of packet is read to determine if it is correct destination -> header is removed and data is elevated to transport layer as segments
- header of each segment read to determine sequence number and to arrange segments -> header is removed and data is elevated to session layer
- session layer: determines if this is the end of this session -> requests to end session if so, else session layer waits for more data
- data passed to presentation layer: decompression, decryption or translation
- data is transferred to application and received by user
TCP/IP
- Protocol suite: set of protocols organised in different layers

Benefits of layering
- Modularity: each layer focuses on a specific function (routing, encryption, data formatting), making the system easier to design, understand and troubleshoot
- Interopertability: standardize layer functions and interfaces: devices and software from different vendors can work together as long as they follow the same protocols for each layer
- Flexibility and abstraction: changes or improvements can be made in one layer without affecting other layers
- Simplified troubleshooting: network issues can be diagnosed layer by layer
- Standardization: common language and framework
**TCP/IP Physical layer **
- Unit of communication is a single bit
- Communication is between two nodes (either a computer or router)
**TCP/IP Data Link Layer **
- Unit of communication is a frame
- Encapsulates the data received from the network layer with an added header and trailer (optional)
**TCP/IP Network layer **
Select the best path for data to travel from source to destination (routing)- Leading protocol is Internet Protocol (IP)
- supporting protocols: Internet Control Message Protocol (ICMP), Address Resolution Protocol (ARP), Reverse Address Resolution Protocol (RARP)
**TCP/IP Transport Layer **
- Give the source and destination ability to have end-to-end conversation
- Transmission Control Protocol (TCP) and User Datagram Protocol (UDP)
**TCP/IP Application layer **
- Take data from applications and deliver to transport layer and collect data from transport layer and deliver to the correct applications
- Protocols: HTTP (Hypertext transfer protocol), FTP (FIle transfer protocol), SMTP (Simple mail transfer protocol), Post office protocol 3 (POP3), Telnet, Domain Name Service (DNS)
Mode of data transfer: Circuit switching vs Packet switching
Circuit Switching
- Connection-oriented: connection needs to be established before the start of transmitting data
- Data moves across the same path throughout the entire communication
- E.g. early telephone systems
- NEVER implemented at network layer
Packet switching
- Connectionless: no connection is established before start of transmission of data
- Data is fragmented into smaller, more manageable chunks called packets
- packets are individually addressed and sent to intended destination
- receiving computer waits for all packets and reassembles packets into original message before delivering message to upper level
- Network layer in the Internet is packet-switched
- Routing of packets
- Packet creation: data is encapsulated into an IP packet: IP header contains source and destination IP address
- Routing decision: consult routing table: if destination is on same local network, send packet directly (direct delivery), else forwards the packet to default gateway (usually a router) - indirect delivery
- if size of data > max size of data carried in frame (Maximum Transmission Unit MTU), packet is fragmented into smaller units before being passed to data link layer
- At the router, the header of each packet is validated and the routing table is consulted to determine the next hop to send the packet toward the destination. Fragmentation of packets into smaller units.
- At destination, the header of the packet is validated, data is extracted from each fragment and stored.
- When all fragments have arrived, data is reassembled and delivered to upper layer (transport layer)
- Network layer sets reassembly timer: if timer expired, all data fragments destroyed and datagram needs to be resent
Explain the difference between circuit switching and packet switching [2]
Circuit Switching - Establishes a dedicated communication path (circuit) between
two nodes before transmitting data. Data is transmitted in a **continuous **stream.
Packet Switching - Data is broken into smaller packets, each of which takes the best
path available and travels independently to the destination where they are
reassembled.
Advantages
| Circuit Switching | Packet switching |
|---|---|
| Provides a consistent and reliable connection with a fixed bandwidth | More efficient use of network resources since packets can be routed based on current network load |
| Data arrives in order and does not need to be reassembled | More secure as it is harder to intercept data since different packets can take different paths to destination |
Disadvantages
Protocol: a set of rules, standards, or procedures that govern how data is transmitted, received and interpreted between devices in a communication network
Features
- standardized to ensure compatibility and interoperability between different systems, devices or software
- define how data is formatted and organised during transmission
- specify how devices initiate, maintain and terminate communication
- detection and correction of errors
IP
- Source and destination IP addresses are placed in IP header as the packet moves down the TCP/IP stack
- Network layer checks if destination is on same local network or different network, based on comparing destination IP address with subnet mask to source IP address with subnet mask
- If destination is on the same subnet, packet is sent directly to destination host (direct delivery
- Else packet is sent via default gateway or router to reach correct network (indirect delivery)
- if size of data > max size of data carried in frame (Maximum Transmission Unit MTU), packet is fragmented into smaller units before being passed to data link layer
- MAC address of next hop/destination device (host/router) is obtained before passing packet to data link layer
- MAC address resolution uses destination IP address using ARP
IP address
IPv4: 32 bit, logical address
2 parts: prefix defines the network, suffix defines host
Classful addressing scheme
Class A
- Network portion: 8 bits (first octet)
- First bit is always 0
- 2^7 or 128 possible network numbers
- 0.0.0.0 is reserved for default route or special addressing
- 127.0.0.0 is reserved and used for** loopback **
- n usable addresses: 128 - 2 = 126
- Host portion : 24 bits
- 2^24 possible combinations
- All host bits are 0 for **network **address e.g. 10.0.0.0
- All host bits are 1 for **broadcast **address e.g. 10.255.255.255
- n usable addresses: 2^24 - 2
Class B
- Network portion: 16 bits
- First 2 bits always 102
- usable network numbers is 2
- Host portion: 16 bits
- Possible combinations: 2
- All host bits are 0 for **network **address e.g. 172.16.0.0
- All host bits are 1 for **broadcast **address e.g. 172.16.255.255
- usable host addresses 2^16 - 2
Class C
- Network portion: 24 bits
- First 3 bits always 1102
- Usable network numbers is 2
- Host portion: 8 bits
- 2^8 combinations
- All host bits are 0: **network **address e..g 192.168.1.0
- All host bits are 1: **broadcast **address e.g. 192.168.1.255
Class D
- First 4 bits: 1110
- 224.0.0.0 to 239.255.255.255
- Used for multicasting - send data to selected group of devices
- Not used for regular host address
- for video conferencing, streaming media, routing
Class E
- First 4 bits: 1111
- 240.0.0.0 to 255.255.255.255
- Not used
- 255.255.255.255 is a limited broadcast address to send to all hosts on local network
Different types of address:
- Network address
- Identifies entire network segment and is not assigned to any device
- Used my routers/devices to determine where to route packets (routing table)
- First address in any subnet
- Broadcast address
- Send a message to all hosts on the network at once
- Last address in subnet
- Multicasting - send data to a selected group (multicast group) of devices
Broadcast vs multicast:
Broadcast sends data to every device on the network, while multicast sends data to a specific group of devices on the network (multicast group)
Classful Addressing Scheme
Two-level addressing: each address contains 2 parts:
- netid: defines network (n bits)
- hostid: defines particular host connected to the network (32-n) bits
- Given any IP address, we are able to find:
- Class of IP address and the value of n
- Number of address in the block N = 2
- First address: keep n leftmost bits and set (32-n) rightmost bits to all 0s
- Last address: keep n leftmost bits and set (32-n) rightmost bits to all 1s
Finding network address
- Find the class of IP address
- Find network mask of class
- Use logical AND to find network address
201.24.67.32
- Find class of ip address: class B
- Network mask of class B is 255.255.0.0
- Network address is 201.24.67.32 AND 255.255.0.0 -> 201.24.0.0
Limitations
- IP addresses in fixed sizes (class A to C) either too large or too small for most orgs -> IP address wastage and issues with scaling
- Routing tables grew large and inefficient
- Rapid IPv4 exhaustion: classful structure wasted address space, speeds up exhaustion
- Not flexible, cannot tailor address block size to network size
** Strategies to overcome limitations**
- Subnetting
- Dividing larger networks into smaller, more manageable subnetworks
- resolves issue of insufficient network addresses in classful addressing scheme, without abandoning classful addressing scheme
- single network prefix to be used for multiple networks
- organise networks and reduce broadcast traffic
- Variable length subnet masking (VLSM)
- Network address translation (NAT)
- Private IP address range
- Classless inter-domain routing
- Transition to IPv6 ( long term )
IPv6: 128 bit, written in hex
Zero compression of IPv6 addresses:



ARP: Address Resolution Protocol
- map between logical protocol address (IP address) and hardware address (MAC address)
- Steps
- Look in ARP cache - if found - no future resolution - ip-hardware address is stored in ARP cache for 2 min (max 10min)
If not found, ARP request broadcast is initiated: all nodes in local network receive copy of ARP request, destination node that has the IP address contained in destination protocol address responds with its hardware addressTypes