Download as pdf or txt
Download as pdf or txt
You are on page 1of 766

FIT9137

Introduction to Computer
Architecture and Networks
Week 1: Introduction to Computer Architecture
Amin Sakzad and ABM Russel

FIT9137
Unit Topics

FIT9137 2
Some Computer
Equipment

FIT9137
FLUX: Architecture
What does CPU stand for?

1. Central Purchasing Unit

2. Central Processing Unit

3. Central Pointing Unit

4. Central Potential University

5. Central Polite University


FK2HL1
XXXXX
FIT9137 4
A Personal Computer (Apple iMac)

FIT9137 5
CPU - Intel Core i7

FIT9137 6
Hard Disk Drives

FIT9137 7
A 250 MB hard disk drive from the 1970s

http://royal.pingdom.com/2008/04/08/the-history-of-computer-data-storage-in-pictures/

FIT9137 8
RAM (memory) chip

FIT9137 9
Computer Motherboard

FIT9137 10
ENIAC

ENIAC • 20,000 vacuum tubes


(Electronic Numerical • Weighed over 30 tons
Integrator and Computer) • 1800 square feet of floor space
• Used 160KW of electrical power
• built in the mid 1940s
• one of the earliest electronic • 5000 numerical additions per second
general-purpose computer

FIT9137 11
Supercomputer

FIT9137 12
Quantum Computer

source: https://www.engineering.unsw.edu.au

FIT9137 13
Some Key People in
Computing

FIT9137
Bill Gates - Microsoft founder

FIT9137 15
Steve Jobs - Apple computer co-founder

FIT9137 16
Ken Thompson and Dennis Ritchie - receiving the 1999
US National Technology Medal for the invention of Unix

FIT9137 17
Larry Ellison - Oracle founder

FIT9137 18
Richard Stallman - Founder of the Free Software
Foundation and creator of the GNU Project

FIT9137 19
Linus Torvalds - Creator of Linux

FIT9137 20
The Computing Environment

FIT9137 21
Anatomy of a Personal Computer

FIT9137 22
Basic components of a PC
• CPU: Central Processing Unit

• Primary storage or Main Memory: Holds running


programs whilst they are being executed

• Secondary storage: Holds data and programs


permanently

• Bus: Connects, and carries signals (Control, Address,


Data) to, all components of the system

• Input/Output devices and controllers

FIT9137 23
The von Neumann Architecture
• ENIAC was the first general purpose (programmable) electronic
digital computer.

• Programming was done manually (switches and cables).

• This made the programming process cumbersome and inflexible,


in particular, the sequence of instructions was executed
independently of the results of calculations.

• Things would be a lot easier if – the program could be represented


some way in the memory of machine (along with the data), then
the computer could get its instructions from the memory, and the
program could be modified by modifying the memory…

FIT9137 24
The von Neumann Architecture
• The solution : a “stored program computer”

• John Von Neumann, Princeton mathematician, proposed a


new architecture which can be considered the architectural
ancestor of all modern computers.

• Three concepts underly the architecture:

• Program instructions and data are stored in a single


read/write store (the main memory)

• The contents of this memory is addressable by


memory location, regardless of the type of data
contained at the location

• Execution of program instructions occurs sequentially,


unless explicitly modified

FIT9137 25
How Computers Function
• Computers execute instructions.

• Rather than hardwiring the program like ENIAC, modern


stored program computers use software.

Set of instructions Main


(SOFTWARE) Data
Memory

CPU Arithmetic/Logic
Instruction Operations
Decoder/Control Unit Control
Signals

Results

FIT9137 26
The Language of Computers
• How is ‘intangible’ software communicated to ‘tangible’ hardware?

• Before computers we had for example:

• flashing lights, switches (hardware) and Morse code (software)

• With digital computers, hardware responds to electronic pulses at


2 distinct voltage levels (high and low). These are represented in
the software as  0s and 1s

• Binary number system (“base 2”)

• Binary Digit (or bit): 0 or a 1

• 8 bits = 1 ‘byte’,  eg. 0100 1001

FIT9137 27
The Language of Computers
• Series of bits used to represent various data and instructions.

• eg. 1011 could represent decimal number 11, or the instruction


‘add’

• The fact that 1011 represents ‘add’ is something (arbitrarily) defined by


the manufacturers of the processor or ‘machine’ and is therefore
machine-dependent – this is the language of the machine.

• Machine language is the lowest level programming language (closest


to the hardware)

• Higher level programming languages (assembly, C, Java, etc.) all have


to ultimately be translated into the machine language of the particular
processor

FIT9137 28
The Fetch/Execute Cycle
• Cycle

• A processor can have several states,  However,  the following are used in conventional
computers

• Fetch

• CPU  fetches instructions and data from main memory and stores it in special memory
locations (Registers).

• Decode

• CPU interprets the instruction it just fetched

• Execute

• The instruction is carried out (executed) on the data and any temporary result is stored
in a register.

• The PC advances through the program using a program counter


FIT9137 29
Interrupts
• Modern computer systems are interrupt driven.

• An interrupt is a signal to the processor to suspend its current


tasks and deal with whatever caused the interrupt.

• Interrupts can be classified broadly as:

• Program/Software

• Timer

• I/O

• Other Hardware

• Homework : do some research on Interrupts

FIT9137 30
Interrupt and Multiprocessing
• The interrupt mechanism can be used to implement one
of the key features of all modern computer systems –
multiprocessing.

• Multiprocessing is the capacity to have multiple programs


in memory and switch the processor between them –
gives the illusion of many programs running at the same
time.

• The order in which programs are executed can be


determined by factors such as priority, time-sharing, I/O-
interrupts, etc

FIT9137 31
Lecture Summary

• Some Equipment and Some Key People

• Computer Architecture

• Language of Computer

• Fetch/Execution Cycle

• Interrupts and Multiprocessing

FIT9137 32
Lab Week 2 Overview

• No scheduled Lab session in Week 1! Setup BYOD


Virtual Lab Environment.

• Introduction

• Setting up your laptop for FIT9137

• Install the FIT9137 Virtual Linux Machine

FIT9137 33
Next week: Introduction to Operating Systems

• Computer Architecture

• What operating systems are and how they are used


within the computing environment

• Manage a typical Linux system on a Virtual Machine

• A brief look at the history of the Unix O/S

FIT9137 34
FIT9137
Introduction to Computer
Architecture and Networks
Week 2: Computer Architecture and Operating Systems
Amin Sakzad and ABM Russel

FIT9137
Unit Topics

FIT9137 2
Computer Architecture
and Operating Systems

FIT9137
Today
• Computer architecture

• What operating systems are and how they are used


within the computing environment

• We will use Unix and Linux as case-studies to illustrate


how operating systems work.

• A brief look at the history of the Unix O/S.

• Major functions of an O/S

FIT9137 4
Applications
• Think about new types of applications

• Internet of Things

• Big Data Processing

• Forecasting

• Drug discovery

• Modelling and simulations

FIT9137 5
Computer Architecture

• Infrastructure architecture

• Application architecture

FIT9137 6
Infrastructure Architecture
• Application /
Programming languages

• Virtual Machine /
Operating System

• Instruction Set
Architecture (ISA) /
Microarchitecture

• Logic / Circuits

FIT9137 7
Application Architecture

• Complex hardware/networks require more complex


software architectures

• There are commonly used approaches (patterns) for


application architecture
–client/server architecture
–three-layer client/server architecture
–web services architecture
–internet and web-based application architecture

FIT9137 8
CSIRAC: Australia’s 1st digital computer

Commonwealth Scientific and Industrial Research Automatic Computer


at Museum Victoria, Melbourne

FIT9137 9
Monash Computing Museum

Monash University Caulfield

FIT9137 10
History of Operating Systems

• 1st generation (Vacuum Tube Computers, 1945)

• 2nd generation (Transistorised Computers, 1954)

• 3rd generation (Integrated Circuits Computers, 1965)

• 4th generation (Very Large Scale Intergrated Computers,


1980)

• 5th generation (Quantum Computers)

FIT9137 11
What is an Operating System (O/S)?
• A typically large piece of software that allows users of computer hardware to:

• run various sorts of software applications.

• develop their own programs.

• have the resources of the computer system managed effectively on their


behalf.

• Examples of popular Operating Systems:

• Unix/Linux

• Microsoft Windows

• Mac OS

• ….

FIT9137 12
Operating Systems
• Operating systems control the underlying computer
hardware.

• Provide an environment within which other programs can


be run.

• Can also control how the CPU and other computer Application
resources are allocated to individual users or programs. Utilities Software

Operating System

• In Unix/Linux, the kernel is the most important part of Hardware


the operating system.

• We can generally categorize the various software sitting


on top of the O/S into “Utilities” and “Application
Software”, depending on the complexity and purpose of
the software.

FIT9137 13
Operating Systems (users & files)
• Many modern operating systems (including Unix) are multi-user systems.

• more than one user can log on to the same computer


simultaneously.

• This means the operating system must provide some means of


preventing users interfering with each other.

• The operating system should provide separate file spaces for different
users (typically called “home directories”) so that files can be kept
separate and private.

• There should be some security mechanism in place that prevents users


from reading or altering the files of other users (unless permissions are
explicitly granted).

FIT9137 14
Operating Systems (processes)
• A multi-user operating system is generally also a multi-tasking
operating system

• individual users can be running more than one program


simultaneously.

• On a single-CPU machine, this is actually just an illusion - since if


there is only one physical CPU, there can only be one program
running on the CPU at any given instant.

• This illusion is achieved by rapidly switching the CPU between the


different programs in memory, in turn giving them some “time-
slices” on the CPU.  

• Unix is a multi-user, multi-tasking operating system.

FIT9137 15
History of Unix

FIT9137 16
History of Unix

Ritchie and Thompson


porting Unix to the
PDP-11

FIT9137 17
History of Unix - GNU
• Richard Stallman (often referred to by his
username rms) is the father of the Free
Software Foundation which included the
GNU (GNU’s not UNIX) project.

• Programmer/hacker at MIT from 1971 –


produced the GNU manifesto in 1985 (a
publication which advocated the creation
of a free UNIX-like O/S)

• Software licensed under the GPL (GNU


General Public License) essentially allows
use, copying and modifying of code only
if the same rights are passed on to other
recipients.

FIT9137 18
History of Unix - MINIX
• Andrew Tanenbaum (PhD UC Berkeley)
wrote a UNIX clone from scratch called
MINIX in order to support an operating
systems course he was teaching.   At the
time AT&T did not permit the teaching of
UNIX V6 internals.  Full source code for
MINIX was published as an appendix to
his textbook Operating Systems: Design
and Implementation in 1987.

• Current version (free) is MINIX  Version 3 


-   (www.minix3.org)

FIT9137 19
History of Unix - MINIX

From: torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds)


Newsgroups: comp.os.minix
Subject: What would you like to see most in minix?
Summary: small poll for my new operating system
Message-ID: 1991Aug25.205708.9541@klaava.Helsinki.FI
Date: 25 Aug 91 20:57:08 GMT
Organization: University of Helsinki
Hello everybody out there using minix – I'm doing a (free) operating system (just a hobby, won't be big and
professional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready. I'd
like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout
of the file-system (due to practical reasons among other things).
I've currently ported bash(1.08) and gcc(1.40), and things seem to work. This implies that I'll get something
practical within a few months, and I'd like to know what features most people would want. Any suggestions are
welcome, but I won't promise I'll implement them :-)
Linus (torvalds@kruuna.helsinki.fi)

PS. Yes - it's free of any minix code, and it has a multi-threaded fs.It is NOT protable (uses 386 task switching
etc), and it probably never will support anything other than AT-harddisks, as that's all I have :-(.

FIT9137 20
Unix versus Microsoft Windows
• Almost a religious debate

• Points of comparison:

• Stability

• Security

• Flexibility

• Interface

• Comparisons between the two operating systems will arise during


the course.

FIT9137 21
Unix Philosophy
• Programs are tools.

• Like any good tool, they should be specific in function, but usable for many
different purposes.

• Within limits, the output of any program should be usable as the input of
another program.

• All of the information needed by a program should either be contained in


the data stream passed to it from another program or specified on the
command line.

• The UNIX philosophy underpins much of the development of UNIX


programs and operating system utilities.

FIT9137 22
Major Functions of an O/S

• File Management

• Memory Management

• Process Management

FIT9137 23
1. File Management
• The operating system is key to the control of data on secondary storage.  Operating systems
typically operate on the concept of a file – a collection of logically related data.

• Unix takes the file concept to an extreme – everything in Unix is treated as a file. (more
about this concept later…)

• The file management system within the operating system should hide any device specific
details from the applications.

• Typical tasks of the File Management System:

• Controlling transfer of data to and from secondary storage.

• Controlling security of file access.

• Keeping track of storage space and maintaining file directories.

• Provide sharing mechanisms for files

• (Possibly) provide recovery and restoration mechanisms

FIT9137 24
2. Memory Management
• The operating system is also key to the control of data in primary storage
(main memory).

• The main memory is a finite (small, and usually more expensive) resource
that must be carefully allocated.

• Memory management is closely related to process management as the


degree of multiprogramming that can be accommodated is dependent on
allocating enough memory to all processes.

• In modern operating systems, memory allocation may be non-contiguous


(a single logical object may be spread over several disjointed memory
areas).

• A major function of modern memory management is the implementation


of virtual memory.

FIT9137 25
3. Process Management
• A process is normally defined as “a program in execution”.

• The operating system typically needs to provide the following


functionality with regard to processes:

• Creating and destroying processes

• Controlling the execution/progress of processes

• Acting on exceptional conditions arising during the execution


of processes (eg. errors, interrupts, etc)

• Allocating hardware resources (fairly) among processes

• Providing some form of inter-process communication

FIT9137 26
File Management

FIT9137
File Management
• File management systems allow users to store information in
fundamental units called 'files'.  What the file actually represents
is defined by the system and/or the user. 

• Basic file management is typically provided by O/S, while


additional file management functions may be performed by
specialised software such as DBMS.

• File system provides connection between logical file structure


and physical implementation, creating logical view for user, and
hiding physical view. 


• We will use Unix as the case study for file management in an


operating system.

FIT9137 28
O/S File Systems
• A File System is a data structure to serve a particular
application need.

• Through a file system driver, the O/S controls creation/


deletion/access.

• File systems must be mounted before they can be used


by the operating system.

• Shared File System such as NFS, SMB etc.

FIT9137 29
Popular File Systems
• Windows:

• FAT , VFAT, and FAT32, used in MS-DOS, older versions of


Windows, and removable storage devices like USB memory sticks

• NTFS (New Technology File System) used in Windows

• Unix:

• UFS (Universal File System) and VxFS (Veritas File System) used
in most UNIX flavors

• Ext (and ext2, ext3, ext4) used in Linux

• Other File Systems

FIT9137 30
File management in Unix

• The Unix kernel includes the code to manage files.

• Unix utilities provide high-level file management


functionality (eg. copy, delete, move etc) to the users.

• Applications can also access the low-level file


management services directly, through system calls
(e.g. open, read, write etc).

FIT9137 31
File management in Unix
• O/S maintains a directory structure for each device, to
facilitate location and organization of user files, and
keeps track of free space, allocating space and
reclaiming it as required.

• Provides naming, access/manipulation/storage,


security/protection functions for files and directories.

• File system interacts with I/O subsystem to pass on


requests for operations on storage devices

FIT9137 32
Files
• Like any operating system, Unix works on the concept of files, which are stored in a file
system.  But the concept of a file in Unix is more profound than in other operating systems:

• In Unix, files are simply a collection of bytes stored on the storage medium.   They can
represent any of the following types:

• Ordinary Files

• Data (e.g. a text file, program source code)

• Executables (e.g. a Unix command, a shell script, etc)

• Directories

• A directory is another type of file in Unix - a special “file” that can contain other
files and other directories.

• Special Files

• Other types of files, eg. files that represent hardware devices like hard drives.

FIT9137 33
Files - naming conventions
• Unix is case-sensitive. In general, most Unix commands are in
lowercase letters (ie. Unix does not like uppercase letters!).

• Unix filenames are generally made up of lowercase and


uppercase letters, digits, dots (.) and commas.  Using spaces (or
other “special” characters) in filenames can occasionally make
file-handling difficult, so try to avoid them if possible.

• There is no notion of a file “extension” in Unix (unlike O/S such as


Microsoft Windows).  While files can have an extension, the
extension (ie. the bit after a "dot") has no special meaning, and
does not necessarily define the type of the file or indicate how it
should be dealt with by an application.

FIT9137 34
Files - naming conventions
• In theory, any name can be used for a file or a directory (with the
exception of the “root directory” which must always be named /).
Unix is also very generous with the length of a filename.

• Try to avoid using special characters.

• However, important system files and directories are generally given


the same “standard” names on Unix systems. Examples of some
common/typical system directories include (but are not limited
to) /etc, /bin, /home, /bin, /mnt, /usr, /var, /tmp, /proc and /
lib.

• you should not modify/delete these system directories/files unless


you know what you are doing!

FIT9137 35
Files - naming conventions
• UNIX stores files on the disk in a hierarchical structure.

• The top of the hierarchy is referred to as the root directory and is always named  /

• Eg. a typical Unix file system might look like :

• which is the root directory?


directories
/ • which are the user home directories?

usr home var bin etc tmp

local bin campbell andy passwd

file1 file2

files 8

FIT9137 36
The Working Directory
• When working on a UNIX system, you are always
working within a particular directory in the file system. 
This is called either the working directory or the current
directory.

• When you first log in to the system, your working


directory is set to a directory that is unique to you as a
user; your home directory.  The home directory is the
directory which belongs to you and will contain your
files (and you have full control over these files).

FIT9137 37
FLUX: OS functions
Key OS functions are:

1. File management

2. Memory management

3. Process management

4. All of the above

5. None of the above


FK2HL1
XXXXX
FIT9137 38
Lecture Summary

• Introduction to the Operating Systems

• Major functions of OS

• History of Unix

• Unix vs Windows

• Major functions of an O/S

FIT9137 39
Lab Week 3 Overview

• Basic knowledge

• Linux environment

• Linux commands

FIT9137 40
Next week: Operating Systems Functions

• File Management (permissions)

• Memory Management

• Process Management

FIT9137 41
FIT9137
Introduction to Computer
Architecture and Networks
Week 3: Operating Systems Functions
Amin Sakzad and ABM Russel

FIT9137
Unit Topics

FIT9137 2
Today

• Major Functions of an O/S

• File Management (permissions)

• Memory Management

• Process Management

FIT9137 3
File Management

FIT9137
Ownership of files

• Files are “owned” by a user. We can check a file’s


ownership using the ls command with the long format,
eg :

$ ls  –l            !  Note : the ‘$’ (the prompt) is not part of the command!

FIT9137 5
A special file : /etc/passwd

• On Unix systems, there is a special file named


“passwd” in the directory /etc. This file holds important
information about all the users in the system. For
instance, you may find in this file entries such as :

  russel:x:1001:1002:ABM Russel:/home/russel:/bin/tcsh

 
• There is also a similar file, /etc/group, which holds
information about all the groups in the system.

FIT9137 6
More on Files
• File system is “flat” under Unix kernel (i.e. there is no real distinction
between directories and files under Unix kernel).

• a device is represented as a file.

• a program is a file.

• a directory is really also a file (!)


however, in the user interface, the user is typically presented with a
hierarchical view (eg. the folders as shown in a graphical File
Manager)

FIT9137 7
More on Files

• The kernel does not identify files by names; it uses a


unique number to identify a file called the inode number.
The stat command shows detailed info about files, eg:
$ stat /home/russel/nontes

FIT9137 8
Using Unix Commands
• The original Unix O/S only allows users to interact with
it via text commands (ie. user types in commands via a
terminal). This is known as the “Command-Line”
interface.

• Modern day Unix usually also provides a Graphical


interface, allowing user to interact via pointing-and-
clicking using devices such as a mouse. This makes it
easier for the casual user to interact with the O/S.

FIT9137 9
Using Unix Commands
• The command-line interface is still popular among advanced Unix
users, because it is generally faster & more flexible.

• A “Terminal Window” is now typically provided for this purpose, eg.


in Ubuntu, the user can activate that window via the Dash Home
menu or shortcut-key (ctr-alt-T)

FIT9137 10
Using Unix Commands
• In the command-line window, commands are typed in
by the user, eg. :

FIT9137 11
A simple command example
• In the diagram, can you identify examples of these?
• a command
• a command output
• a command prompt

FIT9137 12
File types – as shown by  ls -l
• Character  File type
  -  regular (ordinary) file
  d  directory
  b  buffered special file (e.g. a disk drive)
  c  unbuffered special file (e.g. a terminal)
  l  symbolic link
  p  pipe
  s  socket
The command ls  –l will show things such as file types, permissions, file sizes,
modification dates, etc
The file command returns the type of the content of the given file name :
$  file exercise
exercise:  ascii text

FIT9137 13
File permissions
• Three levels of permissions :
• the user
• the user’s group and
• others who have account on the system

Three kinds of permissions (for each level) :


• read, write and execute
• these have the usual meaning for ordinary files (for
directory files – x means something different – more later)

Hence 9 different combinations in total

FIT9137 14
File permissions
• A total of nine (9) binary bits representing the permissions:

user  group  others


r/- w/- x/-               r/- w/- x/-  r/- w/- x/-
◦a “-” indicates the permission is “off”, eg. rwxrw-r--
◦an example to follow shortly
 
A user can choose to restrict access to his files/directories, so that other users
may or may not access them.
A Superuser (the “root” user) has access to all files irrespective of permissions.

FIT9137 15
Using ls -l to show file permissions

9-bit pattern (rwxrwxrwx), plus a “file-type” bit


at the front (normally “-” for file, “d” for directories)

FIT9137 16
File permissions : example using ls -l

• $ ls   -l   examples

Output explanations :
• The permission mode of this file is read and write for the owner, read and write
for the group and read only for others
• There is 1 hard link
• The user-id of the file’s owner is russel
• The group-id of the file is russel
• The size of the file is 17 “blocks” – NB. block size can vary between systems
• The file was last modified on Feb 4 17:25
• The file name is nontes


The option “-l” in the command above is to request the output in long format
    There is another option, “-h”, which will make ls display sizes in “human readable” format
(eg.  8K, 555M, 4G, etc)

FIT9137 17
Change file permission (chmod)

• Syntax:  chmod  [-R]  who  [op]  [permission]  file-list


who is one of:
• u  user  owner of the file
• g  group  group to which the owner belongs
• o  other  all other users
• a  all  can be used in place of u,g,o
op is one of:
• +  add permission
• -   remove permission
• =  set permission (reset all other permissions)
permission is one or more of :   r, w, x
Note : this is typical of a Unix command – the command is given with some
option(s) & the actual operands)

FIT9137 18
chmod: Examples
You can also combine the options,
eg. chmod u+x,o+w temp

• ls -l nontes

chmod a=rw notes (set all permissions)

chmod o-w temp (set others’ permissions)

chmod u+x temp (set user’s permissions)

FIT9137 19
File access for processes
• When a process executes, it has four id’s:

• a real user-id 

• an effective user-id

• a real group-id

• an effective group-id

• these id’s determine a process’s access permissions to files/


directories.

FIT9137 20
Real versus Effective user id’s
• Real UID is the UID of the user that created THIS process – ie. the
user who executes/runs the program.

• Effective UID is used to evaluate privileges of the process to perform


a particular action.

• This distinction is useful, since it allows a normal user to sometimes


execute processes which require higher access privileges than he
has,

• eg. a build-in program may be available for everyone to execute,


but may need some super-user privileges to carry out certain
system-related tasks. So we can change the effective UID of
that process to make the O/S thinks that the super-user is
executing that program (instead of the user who actually runs
the program).

FIT9137 21
File access for processes
• When a process tries to access a file, which of the three (User,
Group, or Others) ownership permission applies

• The general rules are as follows:

• If the process’s effective user-id is same as the owner of the file


then User permissions apply

• Otherwise, if the process’s effective group-id is the same as


file’s group id then Group permissions apply

• Otherwise, Others permissions apply


In other words, what a user is permitted to do to a file depends on whether he
owns the file, his group owns the file, or neither...

FIT9137 22
setuid and setgid
• A process’ access privileges depend on who executes the process, not
on who owns the executable program itself

• This is safer in general, but not helpful in some (rare, but important) cases.

• This can be overcome using special permissions: set-user-id and set-


group-id

• When a program with setuid permission is executed, the resulting


process’s effective user-id becomes that of owner of the program (instead
of the user who executes that program).

• Similarly with setgid.

• In both cases, the real uid and gid are not affected

FIT9137 23
Example of using set-uid
• /etc/passwd file stores the encrypted passwords (plus
other info) of all registered users in the system

The command passwd (in /usr/bin) needs to be used by any


user to change his/her own password, i.e. to modify /etc/passwd.
How can this be possible when a normal user does not have
write permission to the /etc/passwd file?

Solution:  applying setuid on the passwd command

FIT9137 24
Example of using set-uid
• Let’s examine the permissions of the /usr/bin/passwd
utility:

The s instead of the usual x in the permission field of the owner


means:
when this command is run (by a normal user), the process will  be granted the
permissions corresponding to the process-owner, in this case, root

root has write access to /etc/passwd file 

this means:  users cannot directly modify the /etc/passwd file, but can change his/her own password
by using the passwd command. This is required for obvious security reasons...

FIT9137 25
Some commonly used Octal (base-8) values for
file permissions
700 ==> /* owner: rwx------ */
400 ==> /* owner: r-------- */
Values of 0-7 can be used
200 ==> /* owner: -w------- */ to indicate if a particular
100 ==> /* owner: --x------ */ bit is “on or “off”
070 ==> /* group: ---rwx--- */
040 ==> /* group: ---r----- */ This sort of “shortcut” is
020 ==> /* group: ----w---- */ commonly used in Unix
010 ==> /* group: -----x--- */ commands
007 ==> /* others: ------rwx */
004 ==> /* others: ------r-- */ a ‘1’ means the
002 ==> /* others: -------w- */ corresponding
001 ==> /* others: --------x */ bit is “on”

a ‘0’ means the


4000 ==> /* set user id on execution */ corresponding
2000 ==> /* set group id on execution */ bit is “off”

Examples :
4 0 0 (4 0 0 == 100 000 000)
chmod 400 file1 ====> r--------
chmod 764 file2 ====> rwxrw-r--
FIT9137 26
Standard Input, Output and Error
• Remember, in Unix, everything is a file…
Every time a shell is started, 3 files are opened automatically :
 stdin, stdout, stderr


File          Default Device  File Descriptor

stdin  keyboard  0

stdout  screen  1

stderr  screen  2
A process can then easily read/write to/from these “files”; this makes I/O
programming relatively easy.

FIT9137 27
Directories (Unix)

• Unix directories consist of a series of directory entries.

• Each directory entry contains at least the inode number


for the file and a character field containing the filename.

• The actual format of the directory is file-system


dependent – and is hidden from the user.

FIT9137 28
Example: directory structure (logical vs physical)

123 . \0

247 .. \0

260 b o o k \0

401 m e m o s \0
ben
401 . \0

book memos 123 .. \0

800 k d \0

kd kh mw c1 810 k h \0
825 m w \0

chap1 chap2 chap3 844 c 1 \0

260 . \0 inode filename


number
123 .. \0

566 c h a p 1 \0
567 c h a p 2 \0

590 c h a p 3 \0
38

FIT9137 29
Directory permissions (Unix)
• Read permission

• Processes can list names and subdirectories within the directory

• Write permission

• Processes can alter the directory, i.e. create and remove existing files.  Note:
write permission on a file is required to modify its contents (this is not
altering the directory so write permission on the directory does not say
anything about this) but not to remove it if the directory has write permission!

• Execute permission

• Allows a user to change into the directory (cd from the shell or chdir as a
system call).  In addition, to open a file or execute a program a user must
have execute permission on all the directories leading to the file as specified
in the file’s absolute pathname.

FIT9137 30
Links - Hard Links
• A hard link is a pointer/reference to a file - every file has at least
one hard link to it.

• The link is how the operating system associates a file name with
the address of the actual data on the storage device.

• Additional links can be created to allow sharing of files or access


through a different name.

• Hard links can be created in Unix using ln.

• A file exists until the last hard link to it is removed.   When the
last hard link is removed, the space previously used by the file is
marked for re-use.

FIT9137 31
Links – Symbolic Links

• a symbolic link (or symlink, or soft link) is a file that


contains a pointer to another file.

symlinks can exist even if the file they pointed to does not exist!
symlinks must be used if a link is to span filesystems
(sometimes referred to as partitions). Hard links cannot be used
on directories, and do not work across different filesystems.

FIT9137 32
Unix ln command examples

• Hard link (default) :


  ln ~/week3/myfile hardlink1
Soft link (using -s option) :
  ln -s ~/week3/myfile softlink1

FIT9137 33
FLUX: Links
Which statement is true about links?

A. Hardlinks still work even if the file they pointed to does


not exist

B. Symlinks still work even if the file they pointed to does


not exist

C. All of the above

D. None of the above.


FK2HL1
FIT9137 34
Memory Management

FIT9137
Memory management
• Physical main memory is finite (and expensive).
Single-processing: 1 process in memory at any one time. Easy to
implement – either it fits or it doesn't.
Multi-processing :  multiple processes in memory at the same time.

Some issues to consider :


• are they all allocated the same memory size?
• where are they located in memory, relative to one other?
• does a process need to be entirely stored in memory in order to
run? How much memory is needed in total?
• when a process finishes, what happen to it? Can we bring in
another new process(es) in its place?
Solutions : Swapping, Virtual Memory.

FIT9137 36
Swapping
• Swapping is a technique used to run more than one
process at once. It allows the computer to rapidly "swap"
its CPU between the process by loading and unloading
them into/from memory. The switching occurs sufficiently
quickly that it gives the user the illusion that the system is
multi-tasking.

• In its basic implementation, only one process is in memory,


and being executed, at any one time. This is relatively easy
to implement, but not efficient, since an entire process
needs to be swapped in/out at once.  An improvement is to
swap partial processes, at the cost of increased complexity.

FIT9137 37
Virtual Memory
• Virtual Memory is a more complicated technique used to
solve memory management problems. It allows the
computer to separate logical program addresses from
actual physical addresses, using dynamic relocation of
program addresses in memory.

• It allows programs to be divided up into small sections


stored in different parts of memory, and allows execution
of programs larger than physical memory ie. only currently
executing portion of program is in memory.

• Virtual memory may be implemented using paging and/or


segmentation.

FIT9137 38
Memory Fragmentations
• Allowing multiple processes to reside in memory creates the potential
problem of Memory Fragmentation – sections of memory locations
which are "free", but are not contiguous (ie. the free spaces,
possibly in different sizes, are scattered throughout the
memory), leading to possible memory wastage. This happens
when processes finish running and are removed from memory at
various times.

• External Fragmentation – memory which is unallocated (to


any processes) and unused.

• Internal Fragmentation – memory which is allocated (to a


process) and unused.

FIT9137 39
Example : Internal Fragmentation with fixed
partitions (but different sizes)

Initial state Final state

O/S O/S O/S O/S O/S


Process Process Process (Process 1 Process
completed,
1 1 1 allocated 5
memory freed)

Process Process Process Process


(Process 2
2 completed, 4 4 4
allocated
memory freed)

Process Process Process Process Process


3 3 3 3 3

Unusable allocated memory Partition boundary


Memory freed when a process completed running

FIT9137 40
Example : External Fragmentation with variable
sized partitions
Initial state Final state

O/S O/S O/S


Process Process Process
In this
1 1 1
example,
what is the Process
order in Process 7
which the
processes 2
arrive/finish,
in states #2
& #3?
Process Process Process
3 5 5

Process Process Process


4 4 4
Process Process
6 6

Possibly unusable unallocated memory

FIT9137 41
Memory Management – Paging

• Paging: Programs/data divided into logical sections called


PAGES and physical memory divided into areas called page
FRAMES.  A Page-Table then translates the pages to their
corresponding frames at run-time.

• Page size and Frame size are equal.

• When a program is running, its pages are brought into memory


as required – ie. only the portion being executed is in memory,
the rest stays on the hard drive. So we can now run programs
which may be larger than the available physical memory.

FIT9137 42
Memory Management – Paging

• Page size is usually hardware-dependent, and is typically in powers


of 2 (e.g. 512Bytes, 1024Bytes,  etc) to aid address translation. 
2-4KB size is common.

• Large page sizes will :

• increase internal fragmentation (ie. more likely that a frame


will have unused portion, as a process/page may not need the
entire frame), but

• reduce maintenance overhead of page tables since there are


less pages to maintain
Small page sizes will have the opposite effect.
So it's important to have the correct page size.

FIT9137 43
Memory Management – Paging

• During program execution, some program “pages” stay


in memory in page frames, the rest stay on secondary
storage (in special area, sometimes known as swap
space) until required (when they are then “swapped”
back in).

Program logical addresses are converted to the form:


             page_number : page_offset  
  e.g. a 32-bit address may use 21 bits for page # and 11 bits for offset (so total
of 221, or ~2.1million  pages).

A Page # is used as an index into the Page Table, to find the corresponding
Frame #.
Page Tables reside in memory. Each process has its own Page Table.

FIT9137 44
Example : Logical Pages versus Physical Frames

Pages Frames
……..

………. 13
Logical Physical
Address Address
Frame 1 of
14
1 30 14 30 Process A
(Page#) (Page Offset) (Frame#) (Frame Offset)

Frame 2 of
Processs A's Process A 15
Page Table
(simplified view) ……..

1 14
Frame 3 of
2 15 27
Process A
3 27 Frame 4 of
4 28 Process A 28

(Physical
Memory)

FIT9137 45
Page Table

• The O/S maintains a Page Table for each process.  A


Page table has one entry for each page of a process. If
a page table is large, it may need to be paged also.

• Apart from frame #'s, a page table will typically also


contain other data, such as whether page is in memory
or on disk, whether page has been modified, etc.

FIT9137 46
Process Table
• The O/S also maintains a Process Table for all the processes.  A
Process Table contains entries called Process Control Blocks (PCB).
Each PCB represents one process.

• A typical PCB entry contains data such as :

• process state & process ID

• program counter

• memory address of the Page Table

• resources in-used/needed

• etc

FIT9137 47
Improving Paging performance by Caching

• Data in page table is constantly accessed when the


process is running. For efficiency, special high speed
memory is provided for the “active” part of page table,
called caches,  associative memory or Translation
Lookaside Buffer (TLB).

• Each location in the caches can be searched


simultaneously rather than sequentially.

• The cache memory is small and stores only active


pages. It is searched first for page #. If not found, search
then goes to the page table in conventional memory.    

FIT9137 48
Paging with Cache
— Hit ratio = percentage of times a page is found in the cache.
Highly-dependent on the number of registers in the cache.

— Eg. If we use a 16-register cache with an 80% hit rate, 50 ns cache


access time and 750 ns memory access time, the comparative
access times would be:
Hence in this case, the
use of caching results in
With no caching : approx. 36.7%
750 + 750 = 1500 ns for every access decrease in single
memory access time

Assessing Page Table


Assessing physical Memory Frames
OR,

With caching :
0.8 * (50 + 750) + 0.2 * (50 + 750 + 750) => 950 ns for every
access

Assessing Cache memory Assessing Page Table

FIT9137 49
Page Replacement/Swapping
• If a required page is not in memory then an interrupt
called Page Fault results. This causes the required page
to be loaded (from secondary memory) into main memory,
and the page table updated. Page table indicates whether
page is in memory, using a "valid/invalid" bit entry.

• If process memory is full (all allocated frames used) some


form of page replacement policy is needed i.e. replace
current frame with new one. This is called Page
Replacing/Swapping. If evicted frame modified, a write to
disk is necessary before replacing page.

FIT9137 50
  Paging Algorithms
ie. O/S would need to keep track
of each memory access with a time-stamp

• Some common Page replacement algorithms :


Least Recently Used (LRU) page swapped out - each access time
stamped     " extra overhead.
Least Frequently Used (LFU) page swapped out - each access
adds to count, but this causes problems with new pages that have
just been brought in (which would naturally have a low frequency
count!)
First In First Out (F.I.F.O) - oldest page swapped out first; simplest
but has the disadvantage that the most heavily used page may be
replaced.

FIT9137 51
Paging Algorithm Variations
• Some algorithms use a "reference" bit which is set
when page is used, but periodically reset by system.

Not Used Recently (NUR) - modification of  LRU, that also looks
at whether page has been modified (in addition to being
accessed).

Second Chance algorithms are modification of FIFO to allow


second chance if reference bit is set. Page is time stamped again
as though new.
Modern O/S'es often use a combination of different paging
algorithms.

FIT9137 52
Program Locality
• Why Virtual Memory works:
Programs tend to work within sections
• As the program proceeds, sections change, but at any one time, for
a period of time, programs will work within the same section. This is
the concept of Locality. Eg:  a program may spend a lot of time
performing a loop, or accessing consecutive elements of a list,
etc…
• “Working Set”= the minimum number of pages that meets the
locality requirement  (ie. the amount of primary memory, measured
in pages, that is required for a program to make effective progress
without excessive page-swapping).
• Some operating systems maintain estimates of the working set for
all running processes.

FIT9137 53
The Working Set Model
• As the number of pages allocated to a process decreases,
number of page faults increase. Need to store enough pages
of the process so that the CPU may be used effectively.

• Minimum set is called Working Set (or Resident Set) of the


process. If number of pages allocated falls below this level
then Thrashing will result.

• Thrashing is when so many page faults occur that most


activity is just paging in and out while the CPU is blocked
waiting on I/O. This will have a very serious performance
impact, since I/O access time is typically much slower than
memory access time.

FIT9137 54
The Working Set Model
• Idea of working set relies on 'locality of execution' principle - that
only a small number of pages from few modules in program are in
use at one time. The O/S must keep track of current working set.

• Tuning a system that uses paging involves setting initial size on


working set.

• Pages in working set may be:

• loaded on demand,

• as a result of direct page faults (demand paging), or

• anticipated in advance (pre-paging) based on some common


access pattern.

FIT9137 55
Page Replacement Policy
• Local vs Global Page Replacement Policies

Whenever there is a need to replace pages in memory, what is the range of
pages that the replacement policy is applied to?
• local - replaces pages actually owned by the process
• global - replaces pages from any process

Global replacement is generally more flexible, because there is a larger set of


replacement pages to choose from;
• disadvantage : can reduce the working set size for unrelated
processes.

Crucial pages (eg. the actual disk driver, video driver, etc) can be marked as
“locked” so that they are never swapped out.

FIT9137 56
Segmentation
• Segmentation is another approach to memory
management, similar to Paging.  

• Reflects the Logical division in programs and data,  eg.


may have segment for global variables, code portions of
functions and procedures, etc.

• the division is decided by the programmer, and the O/S


will then build the appropriate Segment Table (as
opposed to a Page Table) to mirror the division.

• Program addresses are now of form: 

      segment_number : offset

FIT9137 57
Segmentation
• The address mapping for logical to physical addresses is
maintained in a Segment Table (similar to a Page Table).

• each segment may vary in size depending on its function


(ie. logical division)

• each segment is a logical entity of the program it


represents compare this approach to Paging : where
each page/frame is of the same size.

• Segmentations is more complicated to program than


paging; so less popular in use to implement virtual
memory.

FIT9137 58
Virtual Memory Technique
• Advantages:

• Provides a large logical memory space to physical memory space ratio.

• Allows more processes to run concurrently.

• Process isolations - protect processes from each other. Each process has its
own virtual memory space.

• Less I/O resource, as we load in only the required sections of a user process.

• Disadvantages:

• Adds complexity to memory management

• Can cause performance degradation if not implemented properly - eg.


Thrashing due to excessive page faults

FIT9137 59
Memory Management

• Order of increasing complexity:


1. Single-processing – process loaded into memory and stays
there until it has finished.
2. Multi-processing - all processes staying in memory.
3. Swapping - system can handle more processes than it has
room for in memory, by swapping processes to and from
disk.
4. Virtual memory - can handle processes bigger than physical
memory using paging or segmentation.
5. Paging/Segmentation - memory subdivided into pages or
segments.

FIT9137 60
Process Management

FIT9137
Processes
• A process is a program in execution. 

• consists of executable program, its data & stack, its Program


Counter (PC), Stack Counter (SP) and other info necessary to run
(or restart) the program.

• Process control is an important part of multi-tasking O/S –this


involves allocating memory, cpu time, I/O devices, etc

• Modern O/S breaks processes down further - into threads – which


are smaller individually executable pieces of a process. This makes
more efficient use of the CPU.

• Information about processes is stored in a Process Table (a data


structure of O/S)

FIT9137 62
Process States
• A process can be in one of 3 main “states” :
Ready:      waiting for a processor to become available
Running:   instructions are being executed
Blocked:   waiting for some event, eg.  I/O completion

Eg.
A process might move from the Running state
interrupted to the Ready state once its time on the CPU
NEW has expired or another higher priority process is
scheduled to use the CPU.

start

end
READY RUNNING End
dispatched

wake up wait

Eg.
BLOCKED A process moves from the Running state to the
Blocked state when it is waiting for an event,
such as an I/O completion.
Process States

FIT9137 63
Processes

• A process may create a new process as it runs - this is


called forking or spawning a new process.

• The original process is called the parent process, the


new one the child process.

• The Unix  ps  (try the –ael option) command can show
information about currently running processes.

FIT9137 64
Process Control Block
• Usually there are more processes than processors. Concurrency achieved by
interleaving processes i.e. allocating each process a fraction of the CPU time.

• When a process is interrupted, its current state must be saved, for it to be resumed
later.  This info is stored in a “Process Control Block”, which forms one entry in the
Process Table .

• Process Control Block (PCB)       

• is an in-memory data structure created by O/S

• is used to identify process

• stores status of process

• stores its 'volatile environment' (e.g. register values)

FIT9137 65
Process control block (PCB)
• A PCB exists for every
Identifier
process in the system. 
State

Priority
Does this
entry look
• A Process Table contains
Program Counter
PCBs for all the processes.
familiar?

Page Table memory address

Resources used/required
• Entries in the Process
I/O status Information
Table may be linked
Accounting Information
together to form a list, or
etc ............. stored in an array; each
entry in the list (or in the
array) is for one PCB.  

FIT9137 66
FLUX: PCB?
What does PCB stand for?

A. Process control block (PCB)

B. Process control board (PCB)

C. Priority control board (PCB)

D. Printed circuit board (PCB)

E. Printed circuit block (PCB)


FK2HL1
FIT9137 67
Scheduling
• CPU scheduling is divided into two separate components
- the long-term and short-term schedulers.

• Long-term (or high-level) scheduler decides which


processes will be admitted into the system’s Ready
Queue. Decision based on memory availability and
system load. Important in batch systems, but less so in
most modern interactive systems.

• Short-term (or low-level) scheduler works with


processes already in memory and ready to run.  A
Dispatcher then decides which one to run next.

FIT9137 68
High-Level Scheduler
• If there is not enough memory to hold all processes, high-level
scheduler will swap jobs from disk to memory and vice versa

• Criteria that the high-level scheduler could use may include:

• how long the process has been swapped in/out

• how much CPU time has the process recently had

• how big is the process

• how high is the process priority

• etc

FIT9137 69
Low-Level Scheduler

• A running process may need to stop for I/O, or is


interrupted for some reason.  The dispatcher will then
choose the next process to run.

• An operating system may use pre-emptive or non-pre-


emptive low-level scheduling.

FIT9137 70
Scheduling algorithms
• different algorithms favour different types of processes,
and different criteria may be used to determine the “best”
algorithm

• examples of criteria which may be used are:

• minimize response time for interactive processes

• ensure fairness for all processes

• maximize throughput

• prevent CPU starvation

FIT9137 71
Pre-emptive Vs Non-Pre-emptive Scheduling

• Non-Pre-emptive scheduling means system relies on a


(well-written) process itself to relinquish CPU when it
finishes. Eg. Windows 3.1, Windows 95 (16-bit),
“Classic” MacOS, etc

• Pre-emptive scheduling means the O/S controls how


the CPU is shared by the processes. Eg. Unix, Linux,
Windows NT/2000/XP/Vista/8/9/10, Mac OS X, etc

FIT9137 72
Non-pre-emptive scheduling
• Non-pre-emptive algorithms are more applicable to batch
systems. Differ from pre-emptive as processes will only stop
executing when they decide to stop.

• Examples of non-pre-emptive algorithms:

• First-in, first-out, where processes are executed in the


order they arrive

• Shortest job first, which maximizes throughput, but may


result in job starvation

• Priority scheduling, where priorities are assigned based on


criteria such as resources requested, or financial criteria

FIT9137 73
Pre-emptive Scheduling
• With pre-emptive scheduling, computer uses an inbuilt
clock to ensure no process runs for too long. Pre-
emptive scheduling is more common in interactive
systems, but involves much more overhead. Most
modern O/S’s use pre-emptive scheduling. Eg: an
internal clock creates interrupts 50-100 times/sec. The
O/S dispatcher runs at each clock interrupt to decide on
next process to execute.

• Different algorithms can be used to achieve maximum


efficiency and response.

FIT9137 74
Pre-emptive scheduling algorithms
• Round Robin :
All processes assigned equal time quantum to run. All ready-
to-run processes are maintained in circular linked-list, and
take turn to use CPU.

how long should a reasonable time quantum be?


  Eg.
◦If process switch takes 5msec, 20 ms quantum means 25% of CPU
time spent just switching processes. 
◦If 500 ms quantum is used - very slow response time to interactive
users.
◦Usually,  quantum of ~100 msec is used.

FIT9137 75
Round Robin Scheduling
Process 1

Process 2

Process 6 Dispatcher

CPU Process 3

Process 5
Process 4

The Scheduler switches the processes between


the CPU in a cyclic order, based on pre-defined
time quantums.

FIT9137 76
Round Robin problems
• Round Robin does not allow definition of “more
important processes”, ie. priority

• Round robin also indirectly penalizes processes that


frequently use I/O resources, by always returning them
to back of queue even if used only small % of quantum.
This is because I/O always takes longer to complete,
hence such processes have higher chance of waiting/
blocking.

FIT9137 77
Other Scheduling Algorithm
• Priority Scheduling:

• Processes given initial priority level. Usually multiple


priority classes exist. Runnable processes maintained in
priority queues, with round robin used within queue.

• To prevent CPU starvation of low priority jobs,  may need


to temporarily boost priority (eg. if they have been waiting
for long periods). Once process has had its share of CPU
time, its priority drops back to normal.

FIT9137 78
Dynamic Priority Scheduling
• Another variation of priority scheduling is to assign priorities
dynamically, using some formula.

• For instance, based on fraction of the last time quantum used (f),
priority formula could be 1/f (ie. more time used now, lesser priority
later). This would favour interactive users and I/O bound jobs (these
tends to spend more time in blocked states & use less CPU time
quantum, then the 1/f  formula will give them higher priorities) rather
than CPU bound jobs.

FIT9137 79
Process Management
• When dealing with multiple processes sharing the same CPU, we must consider
3 important situations:

1. Mutual Exclusion - ensuring that non-shareable resources (e.g. printers)


are accessed by only one process at a time.

2. Synchronization - for processes which must cooperate (e.g. chat


programs) with one another.

3. Deadlock - when two or more processes want to use a non-shareable


resource held by each other.

for example:       
User A opens file1 with lock
User B opens file2 with lock
User A wants to open file2 but cannot..
User B wants to open file1 but cannot..

  " "Deadlock" situation!

FIT9137 80
Process Management
• In order to implement mutual exclusion, synchronization
and deal with deadlocks, some form of process-
coordination is required.

• In addition, processes often need to exchange


information.

• Both of these goals are met by Inter-Process


Communication mechanisms (IPC).

FIT9137 81
FLUX: Non-pre-emptive scheduling?

Examples of non-pre-emptive scheduling algorithms:

A. First-in first-out, Shortest job first, Round robin

B. First-in first-out, Round robin, Priority scheduling

C. First-in first-out, Shortest job first, Priority scheduling

D. All of the above

E. None of the above.


FK2HL1
FIT9137 82
FLUX: Mutual Exclusion?
Mutual Exclusion in OS:

A. Ensures non-shareable resources (e.g. printers) are accessed by


only one process at a time

B. Ensures shareable resources are accessed by only one process at


a Time

C. Ensures non-shareable resources (e.g. printers) are accessed by


more than one process at a time

D. Ensures shareable resources are accessed by more than one


process at a time

E. None of the above. FK2HL1


FIT9137 83
FLUX: Deadlock
Deadlock in OS:

A. When two or more processes want to use a shareable


resource held by each other

B. When two or more processes want to use a non-


shareable resource held by each other

C. All of the above

D. None of the above.


FK2HL1
FIT9137 84
Lecture Summary

• Operating Systems Functions

• File Management

• Memory Management

• Process Management

FIT9137 85
Lab Week 4 Overview

• Research on commands

• Advanced Linux commands

• Understanding concepts of Links

FIT9137 86
Next week: Introduction to Computer Networks

• Introduction to Computer Networks

FIT9137 87
FIT9137
Introduction to Computer
Architecture and Networks
Week 4: Introduction to Computer Networks
Amin Sakzad and ABM Russel

FIT9137
Unit Topics

FIT9137 2
Three big topics
• Basic concepts of networking
• Network technology
• Network management and design
Networks Types and
Components

FIT9137
Network components
Wireless Local Area
Network (WLAN)
Local Area Network (LAN)
switch
client

server

circuit

router

FIT9137 5
Network components
Client: gives users access to the network

Server: stores data or software and makes


it available to the clients over the network

Switch: connects computers in a LAN

Router: connects two or more networks

FIT9137 6
Types of networks
Networks within an organisation:

• Local Area Network (LAN) (room, building):



a group of clients and servers that share a circuit

• Backbone Network (BN) (< a few km):



high-speed connection between LANs

• Metropolitan Area Network (MAN) (> a few km):



connect LANs and BNs across locations

• Wide Area Network (WAN):



same as MAN except longer distances
FIT9137 7
The Monash Network
Overview of the Monash ITS Network Infrastructure

Caulfield
campus
Alfred
Bendigo hospital
Monash Medical
Parkville Centre
campus

City
campuses

Clayton
campus

THE INTERNET
Via Aarnet

Australian
Synchrotron

Berwick
campus

1 Gigabit Peninsula campus


10 Gigabit
Gippsland East regional schools
Wide area links are provided by VERNET campus of rural health
Links are dark fibre or metro ethernet

FIT9137 8
The Internet
• A network of networks

• Connecting millions of networks



and billions of devices

• Based on a common,

standard set of protocols

Source: Wikipedia / Opte project


FIT9137 9
How do computers
communicate?

FIT9137
How to transfer messages

• Basic function of a data communications network:



transfer a message from sender to receiver

• We are looking at packet-switched networks:



messages are broken up into small units of data called
packets

FIT9137 11
www.youtube.com

192.168.1.15

packet
packet
packet
216.58.220.142

address
192.168.1.1
203.214.44.94
216.239.46.151
202.158.200.149 209.85.142.94

202.158.200.12

202.158.210.41
Data transmission rates
• Fundamental characteristic of a network:

how many bits per second can it transmit?

• Typical transmission rates:

• 1 Mbps (million bits per second) from your home to your


ISP (Internet Service Provider), 10-20 Mbps in the other
direction

• 50-500 Mbps within your WLAN (wireless network)

• 1 Gbps in LANs (local area network, e.g. Monash lab)

• 10 Gbps in backbone networks

• Tbps (tera bits per second, 1012) in optical fibre networks

FIT9137 13
FLUX: How long does it take?
Assume you want to send a 4k movie (50 GByte) to a friend.

How long does it take if you use your home ADSL connection?

1. 5-10 Minutes

2. 10-12 hours

3. Around one day

4. Roughly one week

5. About one month FK2HL1


FIT9137 14
How long does it take?
• Typical ADSL upload speed: 1 Mbps

• 50 GByte = 400 Gbit = 400 000 Mbit

• 400 000 seconds = 4 days, 15 hours

• How about NBN? Advertised as 39 Mbps

• 400 000 Mbit / 39 Mbps = 2 hours 29 minutes

• And within the Monash network? 1 Gbps

• 400 Gbit / 1 Gbps = 6 minutes 40 seconds

FIT9137 15
How to transfer messages
• Networks run on very diverse and complex hardware
and software:

How can we make sure they all understand each
other?

• Solution:


hierarchical layers of abstraction 

each with well-defined tasks and interfaces


formal languages (protocols) within each layer

• This is typical software engineering!


FIT9137 16
Layers and Protocols

FIT9137
Layers of Abstraction
Application

(manage user data)

Logical connections

(break up into packets, make
sure they arrive)

Routing

(where should packets go?) 209.85.142.94 203.214.44.94

Low-level connections
 packet 216.239.46.151


(computer-to-computer)

Hardware

packet
(cables, WIFI etc)

FIT9137 18
Layers of Abstraction
Application

(manage user data)

Transport

(break up into packets, make
sure they arrive)

Network

(where should packets go?) Internet Model
Data link

(computer-to-computer)

Physical

(cables, WIFI etc)

FIT9137 19
Layers of Abstraction
Application

(manage user data)
Interface
Transport

(break up into packets, make
sure they arrive)

Network

(where should packets go?)

Data link

(computer-to-computer)
Interfaces define how
each layer “talks” to the
Physical

(cables, WIFI etc)
one above and below.

FIT9137 20
Layers of Abstraction
Computer 1 Computer 2
Protocol
Application Application

Transport Transport

Network Network

Data Link Data Link

Physical Physical

Protocols define how the same layers communicate


between different computers.
FIT9137 21
Layers of Abstraction

Application
Ethernet

Transport Optic Fibre

Network

Data Link

Physical

Switch Router Switch


ADSL Wi-Fi
FIT9137 22
Internet Model
Application

(manage user data)
HTTP, SMTP, IMAP, …

Transport

(break up into packets, make TCP, UDP
sure they arrive)

Network

(where should packets go?) IP

Data link

(computer-to-computer)
Ethernet

Physical

(cables, WIFI etc) Ethernet, Wi-Fi, …
FIT9137 23
Message Encapsulation
Each layer puts the message in an “envelope” and
adds necessary information for transmission.
packet
Application HTTP www.youtube.com

Transport TCP

Network IP

Data Link Ethernet

Physical ?

FIT9137 24
Message Encapsulation
Each layer puts the message in an “envelope” and
adds necessary information for transmission.
packet
Application

Transport

Network

Data Link Ethernet


?
IP TCP HTTP www.youtube.com

Physical

FIT9137 25
Message Encapsulation
Each layer puts the message in an “envelope” and
packet
adds necessary information for transmission.

Application

Transport

Network ?

Data Link Ethernet


? TCP
IP HTTP www.youtube.com

Physical

FIT9137 26
https://youtu.be/DGpa7bAVgTo
Message Encapsulation
Protocol Data Unit

(PDU)

Application Message PDU contains:

HTTP www.youtube.com

• Addresses (sender/
Transport Segment TCP
receiver)

• Error detection codes

Network Packet IP
• Protocol-specific

Data Link Frame information

Ethernet
• Special start and end

Physical Bit symbols

FIT9137 28
Background: Modular Design
Well-defined protocol stack has three characteristics:

1. Low coupling:

Interfaces clearly defined. You can replace/modify a
layer as long as you don’t change the interface.

2. High cohesion:

All related tasks are performed by a single layer.

3. Information hiding:

Keep information internal that other layers don’t need
to know.

FIT9137 29
Reflection
A complex hierarchy must work together perfectly to
ensure messages are delivered quickly, without errors and
to the correct destination.

Is this efficient?

• Involves many different pieces of software and hardware

• Packets must be processed at intermediate nodes

• Interoperability vs streamlined communication

• Flexibility vs efficiency

FIT9137 30
OSI vs the Internet
Open Systems Interconnection Internet Model
Reference Model
Application 7
Introduced in 1984
Presentation 6 Application

Not widely used Session 5


(almost all networks
Transport 4 Transport
use Internet model)

Network 3 Network
But important
historical milestone! Data Link 2 Data Link

Physical 1 Physical
FIT9137 31
Standardisation

• Remember: networks connect computers with diverse


range of hardware and software

• This is only possible if all manufacturers agree on the


protocols and interfaces

• Accomplished by an open standard

FIT9137 32
Types of Standards
• Formal standards (“de jure”):

• Developed by an industry or government standards-


making body

• E.g. Ethernet, HTTP

• De-facto standards:

• Emerge in the marketplace and are widely used

• Are not necessarily backed by a standards-making


body

• E.g. PDF files (started as Adobe product, now de jure)

FIT9137 33
Major Standards Bodies
ISO (International Organization for Standardization)

• e.g. OSI model

ITU-T (International Telecommunications Union - Telecom Group)

• e.g. ADSL

IEEE (Institute of Electrical and Electronic Engineers)

• e.g. Ethernet, Wi-Fi

IETF (Internet Engineering Task Force)

• e.g. TCP/IP, HTTP

FIT9137 34
Lecture Summary
• Networks consist of clients, servers, and circuit
infrastructure (switches, routers, cables etc)

• Messages are transmitted as packets that travel through


several intermediate steps

• The Internet Model defines 5 layers: physical, data link,


network, transport, and application layer

• Each layer encapsulates the message and adds a PDU

• Standardised protocols and interfaces enable different


hardware and software to interoperate

FIT9137 35
Lab Week 5 Overview

• Browsing the web

• Packet sniffing

• Command line tools

FIT9137 36
Next week: Physical Layer & Data Link Layer

• Physical:

• How do we turn bits into electrical signals, radio signals, or light pulses?

• How do we turn electrical signals, radio signals, or light pulses into bits?

• How can several devices be connected to the same circuit?

• Data Link Layer:

• How to control access to the physical layer?

• How to address different computers on the same network?

• How to detect and avoid errors?

FIT9137 37
FIT9137
Introduction to Computer
Architecture and Networks
Week 5: Physical Layer / Data Link Layer
Amin Sakzad and ABM Russel

FIT9137
Unit Topics

FIT9137 2
Introduction

Physical Layer:
• directly connects devices (e.g. via cable or radio)

on the same circuit

Data Link Layer:


• manages the physical connection between devices
on the same circuit

FIT9137 3
Layers of Abstraction

Switch Router Switch


FIT9137 4
Internet Layers

Application HTTP www.youtube.com

Transport TCP

Network IP

Data Link Ethernet

Physical

FIT9137 5
Fundamentals

• We must represent our bits as signals for transmission

• Signals travel through a medium:

• electrical signals through e.g. copper cables

• radio waves through “air” (or, really, space…)

• light signals through “air” or fibre optic cables

FIT9137 6
Transmission Standards
• Remember: we need standards to ensure that two
computers understand each other

• Codes are used to convert data into numbers and then


sequences of bits. E.g. data becomes

01100100011000010111010001100001

• Signals are electrical or optical wave forms that


transmit sequences of bits across media

• Both codes and signals need to be standardised!

FIT9137 7
Today
Physical Layer

• Mainly focus on how to turn bits into a signal and back into bits

• This is quite technical

• There’s even some physics and some maths (trigonometry)

Data Link Layer


• Media Access Control: Control when devices are sending

• Error Control: How to make sure that data arrives correctly

• Data Link Protocols: Asynchronous and synchronous transmission

• Transmission Efficiency: Message length vs error rate

FIT9137 8
Digital vs Analog
• Digital data:

• Discrete values (e.g. 0 and 1, or characters in the


alphabet)

• Discrete step from one symbol to the next

• Analog data:

• Range of possible values (e.g. temperature, air pressure)

• Continuous variation over time

FIT9137 9
Digital vs Analog
• Digital signal:

• Waveform with limited number of discrete states

• Analog signal:

• Continuous, often sinusoidal wave

• E.g. sound (pressure wave in air), light and radio


(electromagnetic waves)

FIT9137 10
Transmission types

• digital transmission of digital data

• analog transmission of digital data

• digital transmission of analog data

FIT9137 11
Digital transmission

FIT9137
Digital transmission
• Digital signals are typically transmitted through copper
cables

• A digital signal encodes 0s and 1s into different



voltage levels on the cable

• This results in a square wave


• Simplest encoding: unipolar

+3V
0V
1 0 1 1 0 1

FIT9137 13
Bipolar signalling
• Use positive and negative voltages

• Fewer errors than unipolar because signals are more


distinct

• Return to zero (RZ):



go to 0V level after each bit

• Non return to zero (NRZ):



stay at current level after each bit

• Non return to zero inverted (NRZI):



0 = no transition, 1 = transition
FIT9137 14
Digital transmission
0 1 0 0 1 1 0 0 0 1 1
+3V
NRZ 0V
-3V
+3V
NRZI 0V
-3V

• Very simple encoding, but:

• Cannot distinguish 00000… or 11111… from


"jammed signal"

• 010 or 001100? Need additional clock!

• Solution: always have a transition


FIT9137 15
Digital transmission
0 1 0 0 1 1 0 0 0 1 1
NRZ

NRZI

Manchester

low-to-high in high-to-low in
the middle of a the middle of a
bit bit
FIT9137 16
Analog transmission
of digital data

FIT9137
FLUX: What's that noise?

1. Data stored on a magnetic tape

2. Communication over a phone line using a modem

3. An Australian magpie

4. A 4G mobile phone network transmission

FIT9137 18
http://www.windytan.com/2012/11/the-sound-of-dialup-
pictured.html
Telephone Network
• Designed for analog signals: human speech

• POTS: Plain Old Telephone Service

• Voice communications between phones

• Sound wave converted into (analog) electrical signal


wave (microphone)

• Electrical wave transmitted through copper wires

• Electrical wave converted back to sound (speaker)

• How can we use POTS for digital data?

• Use a modem to convert to and from analog signal

FIT9137 20
Modems
• Modulator / Demodulator

• Translate digital data into analog signals and back

FIT9137 21
Waves
sine wave 14/03/2015 1:52 pm

!
A wave is an oscillation that travels through a medium,
transferring energy.

Phase
Amplitude

Wavelength ∼ 1 / Frequency
FIT9137 22
Wave characteristics
Amplitude
• Height of the wave

• Loudness, voltage level



Frequency
• Number of cycles per second, measured in Hertz

• Sound: pitch, light: colour



Phase
• Initial angle at which the wave begins

y = A×sin(2π f x + φ)
FIT9137 23
Example
https://www.desmos.com/calculator/80uhiwety4

FIT9137 24
Modulation
• Analog signals are waves

• Take a constant carrier wave



(fixed frequency, amplitude, phase)

• Modify its characteristics to encode the bits

• frequency modulation

• amplitude modulation

• phase key shifting

FIT9137 25
!
Frequency Modulation
Frequency Shift Keying 14/03/2015 2:46 pm

1 0 0 1 1 0

FIT9137 26
Amplitude Modulation
Amplitude Modulation 14/03/2015 2:53

1 0 0 1 1 0

FIT9137 27
Phase Modulation
Phase Shift Keying 14/03/2015 2:59

1 0 0 1 1 0

FIT9137 28
Increasing the bit rate
• Last three examples: one bit per time unit

• But we could use several different frequencies,


amplitudes or phases!

• Encode several bits into one symbol

• Example: AM with 2 bits per symbol



00 = amplitude 1

01 = amplitude 2

10 = amplitude 3

11 = amplitude 4

FIT9137 29
Amplitude Modulation 4 symbols
4 symbol AM 14/03/2015 3:10 pm

11
10
01
00

00 11 01 00 01 00 10 10 11 01
Two bits per symbol = data rate doubled!
FIT9137 30
FLUX Question: Satellite Transmission

How is data transmitted via satellites?

1. A digital signal is modulated onto microwaves

2. Phase Modulation of laser light pulses

3. 2.4 GHz radio waves are sent to the satellite over a


direct line-of-sight path

4. With a rocket

FIT9137 31
How many bits per symbol?
• Take the AM example:

very small differences in amplitude can be

difficult to distinguish

• Increasing the bits per symbol rate can



increase the error rate

• Maximum depends on the quality of the media and the


modem

• E.g. 15 bits / symbol requires 32768 different symbols!

FIT9137 32
Bandwidth and Bit Rate
• Bandwidth: difference between highest and lowest
frequency in a range (band) of frequencies

• Human hearing: between 20 Hz and 20,000 Hz



bandwidth = 19,980 Hz

• Telephone: between 300 Hz and 3400 Hz



bandwidth = 3100 Hz

• WiFi channel 11: between 2452 MHz and 2472 MHZ



bandwidth = 20 MHz

FIT9137 33
POTS Bandwidth
• Need one wave cycle per symbol

• 3100 Hz = 3100 symbols per second (called baud)

• In reality: maximum of 3429 baud

• With basic AM (1 bit per symbol):



maximum data rate is 3429 bps

• With 4 bits per symbol: 14 kbps

• Trellis modulation can reach 33.6 kbps

FIT9137 34
Example: ADSL

• Compromise between POTS and fully digital network

• Highest cost in broadband roll-out: last mile

• Need individual cable connection to every customer

• POTS twisted pair copper cables already in place

• Solution: use full bandwidth of the copper cable



(not only the voice band)

FIT9137 35
ADSL
Asymmetric Digital Subscriber Line

0 4 25 138 1104 KHz

966 KHz Data Downstream

113 KHz Data Upstream

4 KHz POTS: Voice


FIT9137 36
ADSL
Asymmetric Digital Subscriber Line

138 1104 KHz

Split into 4 KHz bands and use "247 separate modems"


Advantage: if some channels are bad, just don't use them!
FIT9137 37
ADSL setup
Home Telephone
Exchange

Filter
DSLAM
Split signal into DSL Access
voice and data
Multiplexer

Modem
Modem and switch
Phone

FIT9137 38
Digital transmission of
analog data

FIT9137
Analog to digital
• How can we turn analog (audio) signals into digital
data?

• Requires a codec: coder / decoder

• coder converts analog signal into digital form

• decoder converts digital signal back into analog

• used for phones, mp3 players, audio chat

FIT9137 40
ADC using sampling 15/03/2015 4:57 pm

Quantisation 111
Error
110
101
100
011
010
001

101 110 110 111 111 110 101 100 011 010 001 001 001 010 011 100 000

FIT9137 41
ADC quality
• Two parameters to create smoother signal:

Number of amplitude levels

• For voice: 7 bits (128 levels)

• For music: 16 bits (65,536 levels)

Number of samples per second

• Nyquist-Shannon Theorem: sample at



twice the rate of the highest frequency

• For voice: 4 KHz bandwidth, 8 KHz sampling

• For music: 20 KHz bandwidth, at least 40 KHz sampling

FIT9137 42
Advantages of Digital Transmission

• Better audio quality:



No noise from amplifiers, error detection/correction

• Data compression:

More efficient use of infrastructure

• Encryption:

Secure phone lines

• Integrate different services:



Voice, video, data on the same phone line

FIT9137 43
Data Link Layer

FIT9137
Two sublayers
Logical Link Control (LLC)
• Handle PDU header (and trailer)

• Error control

• Defines interface with the network layer

Media Access Control (MAC)


• Encodes / decodes between physical layer symbols
and frames (bits)

• Error detection

• Controls when the device transmits


FIT9137 45
MAC

When to transmit?

FIT9137
MAC Approaches

Contention
• Device waits until the circuit is free before
transmitting

Controlled Access
• Device waits until given permission before
transmitting

FIT9137 47
Contention
Any device can transmit at any time
• “first come first served”

Collisions: two devices transmitting at the same time


• packets in a collision are damaged

• avoid collisions by carrier sensing



(listening on the network for transmission)

• detect collisions and re-transmit

Used in Ethernet

FIT9137 48
Original Ethernet
Topology:
shared bus (multi-point)

FIT9137 49
Ethernet

Physical topology:
Every signal received
on one port is sent out star (point-to-point)
on all other ports bus
Hub
Logical topology:
shared bus (multi-point)
FIT9137 50
FLUX Question: Hubs

At which layer of the Internet Model are hubs operating?

1. Physical Layer

2. Data Link Layer

3. Network Layer

4. Transport Layer

FK2HL1
FIT9137 51
Controlled Access

message message

Roll Call Polling


A: your turn
B:
C:
D:

message
Controller
FIT9137 52
Controlled Access

message
message
message

Hub Polling /
Token Passing

message
message
token

FIT9137 53
Transmission Techniques

Asynchronous Transmission
• each character (byte) sent independently

Synchronous Transmission
• several bytes sent together in a frame

FIT9137 54
Asynchronous Transmission
Transmit one 7-bit ASCII character at a time
• used for dumb terminals (server-based architecture)

start parity
bit bit
data (7 bit ASCII)
idle
0 1 1 1 0 1 0 0 1 1
+3V
0V
stop bit

= idle

FIT9137 55
Synchronous Transmission
Data sent in a frame
• typically around 1500 bytes

• includes addressing information (for multi-point circuits)

• includes synchronisation characters (SYN)



(similar role as the start bit)

Examples:
• SDLC (IBM 1972), HDLC

• Ethernet

• PPP

FIT9137 56
Ethernet Frame: IEEE 802.3
physical data link layer Frame Check Sequence

CRC-32
layer MAC LLC
preamble

start of dest. source length



frame address address or type Data FCS

7 1 6 6 2 46-1500 4

MAC address MAC address



(e.g. (e.g.

00:23:ae:e7:52:85) ac:87:a3:14:9e:59)

10101011

1010101010101010101010101010101010101010101010101010101010101010

FIT9137 57
MAC addresses
MAC address
Unique identifier for a network interface (e.g.
00:23:ae:e7:52:85)
• 6 bytes, stored in hardware

• manufacturer must make sure it’s unique

• Used in Ethernet and Wifi

• first 3 bytes identify manufacturer:



http://standards.ieee.org/develop/regauth/oui/public.html

Only used to address computers in the same LAN


• e.g. in one WiFi network or one Ethernet

• to reach computers outside of own LAN: network layer


FIT9137 58
High Level Data Link Control (HDLC)
Frame Check Sequence

destination CRC-32

flag address control Data FCS flag

1 1 1 variable length 4 1
01111110 01111110

End of frame marked by flag


• no need for length field

• but: what if data contains 01111110?

FIT9137 59
Transparency / bit stuffing
What if the data contains the flag (01111110)?
Let’s send the message /~guidot

01111110 01100101 01001110 00101111


0 011
flag address flagcontrol

insert 0 after
When receiver sees 11111: each 11111
• if next bit is 0: remove it

• if next two bits are 10: found flag (end of frame)

• if next two bits are 11: error

FIT9137 60
FLUX Question: HDLC addresses

HDLC can be used in multi-point circuits. Its frame only


contains the destination address but not the source.
Which type of MAC does that imply?

1. Hub polling

2. Contention-based access

3. Roll call polling

FK2HL1
FIT9137 61
Point-to-Point Protocol (PPP)
Developed in early 1990s
• used for dial-up connections (e.g. POTS modems)

• inspired by HDLC

• supports authentication (username+password)

Use today
• PPPoE (PPP over Ethernet) encapsulates a PPP frame inside
an Ethernet frame

• Used e.g. for ADSL to provide user authentication

layer 3
flag address control
protocol Data FCS flag

1 1 1 2 variable length 2/4 1


FIT9137 62
Error control

FIT9137
ADSL
Asymmetric Digital Subscriber Line

0 4 25
113 kHz 138 1104 KHz

966 KHz Data Downstream

FIT9137 64
ADSL: why asymmetric?

FIT9137 65
FLUX Question: ADSL
Why is the upload bandwidth so much smaller than the
download bandwidth?

1. Crosstalk at DSLAM requires lower bit rate

2. Customers prefer faster downloads

3. POTS phone line too old to support higher speeds

4. Attenuation greater on customer side

FK2HL1
FIT9137 66
ADSL: why asymmetric?
Crosstalk depends on

distance from sender and

distance between wires!

wires far apart


wires close together

FIT9137 67
Error detection
General idea:
• calculate error-detection value (EDV) and transmit
with the message

• larger EDV: better detection but lower efficiency

Three techniques:
• Parity check

• Checksum

• Cyclic Redundancy Check (CRC)

FIT9137 68
Error Correction
now we know there’s an error,
how do we handle it?

FIT9137
Two approaches

Backward Error Correction


• Receiver asks sender to re-transmit the frame

• Most common error correction in modern networks

Forward Error Correction


• Receiver repairs the frame (does not ask to re-
transmit)

• Used if re-transmission is not feasible

FIT9137 70
Automatic Repeat Request (ARQ)
Stop and Wait
Sender Receiver
sender waits for
ACKnowledgement frame A

ACK

frame B frame B
Negative ACK

resend frame NAK

frame B

ACK

FIT9137 71
sender does
Continous ARQ
not wait for Sender Receiver
ACK
frame A

frame B

ACK identifies ACK A


the frame
frame C frame C

ACK B

frame D

NAK C

frame C

ACK D

ACK C
FIT9137 72
Forward Error Correction (FEC)

When ##rors are #ore or l#ss


uniformly #istrib#ted,
it is not di#ficult to gras# the
me##ing even when the e##or
#ate is high, as in this #entence.

FIT9137 73
FEC
Transmit additional information
• allows receiver to detect error (like CRC)

• also allows receiver to locate erroneous bits

• invert erroneous bits to repair message

Used in situations where


• no return path available

• significant propagation delay (e.g. satellite)

Examples
• Hamming code (used e.g. in error correcting memory)

• Reed-Solomon codes (CDs, DVDs, Blue-ray, QR Codes, Digital TV


broadcast, DSL)
FIT9137 74
Error Control - Today
Network cables are very reliable
• errors are not as common as in the 70s and 80s

• FEC has significant overhead

Data Link Layer / LLC


• MAC detects errors, but LLC usually does not correct
them

• error correction (using ARQ) is done by the



Transport Layer
• exception: very noisy lines where FEC can lead to
increase in bit rate despite overhead
FIT9137 75
Transmission
Efficiency

FIT9137
Transmission Efficiency

A network is efficient if it allows us to



transmit the highest possible volume of accurate
information.


The higher the volume of accurate information


transmitted, the lower the cost.

FIT9137 77
Factors affecting Efficiency
Base transmission rate of the circuit
Errors
• error rate of circuit

• error control in protocol (FEC?)

Protocol overhead
• how many bits added for error checking, frame
delimiters etc.


number of information bits transmitted


Efficiency =
total number of bits transmitted
FIT9137 78
Efficiency Example
Asynchronous transmission of 7-bit ASCII
• information bits: 7

• total bits: 1 start bit, 7 data bits, 1 parity bit, 1 stop bit

• Efficiency = 7/10 = 70%

HDLC synchronous transmission of 100 characters:


• assume 800 bits data, 16 bits flags, 8 bits address, 8
bits control, 32 bits CRC

• Efficiency = 800 / 864 = 92.6%

FIT9137 79
Optimum Frame Size
acceptable range
efficiency

optimum frame size

large frames:
increased error rate

small frames:
high protocol overhead
frame size
FIT9137 80
Summary
Physical Layer

• Digital transmission of digital data: square waves, NRZ, Manchester encoding, used e.g. in
Ethernet. Analog transmission of digital data: modulation (AM, FM, PSK), used e.g. in ADSL
or WiFi. Digital transmission of analog data: sampling, used e.g. in digital telephone
networks

Data Link Layer


• controls access to physical medium (MAC)

• performs error control

Errors
• detection: parity, checksum, CRC

• correction: retransmission (ARQ) or forward correction (FEC)

Efficiency
• protocols add overhead (e.g. flags, CRC)

• efficiency = information bits / total bits

FIT9137 81
Lab Week 5 Overview

• Modulation Encoding

• Wireshark. Data Link Layer.

FIT9137 82
Next week: LANs & WLANs
Local Area Networks
• roles of LANs in organizations
• major components of LANs

• traditional and switched Ethernet LANs

• best practice recommendations for LAN design

• how to improve LAN performance

Wireless LANs
• how does MAC work with radio waves

• how do we avoid interference between neighbouring stations

FIT9137 83
FIT9137
Introduction to Computer
Architecture and Networks
Week 6: Local Area Networks and Wireless LAN
Amin Sakzad and ABM Russel

FIT9137
Unit Topics

FIT9137 2
Today
LAN
• LAN components: devices, software

• Ethernet: traditional (hub-based), switched

• LAN design: best practices, improving performance

Wireless LAN standards


• IEEE 802.11 family

• Modulation techniques, frequencies and channels, antennas

• Data link layer for WLAN

Wireless LAN topology


• Access points

• Service sets

• WLAN design

Wireless LAN security


• How to protect your WiFi from hackers

FIT9137 3
What is a LAN?
A network of computers that are directly connected to
each other
• limited area (e.g. one building, or even one room)

• circuits owned by the organisation (not leased e.g. from


telecom provider)

• can be operated without obtaining a license

Examples
• a Monash lab

• your home (several computer connected to a WiFi router)

• a public WiFi access point


FIT9137 4
Why use a LAN?

FIT9137
Why use a LAN?
Information sharing
• files accessible to all users

• database servers

• communication (e.g. email, intranet)

Resource sharing
• shared hardware, e.g printers

• shared software licenses

• shared Internet connection

Sharing results in reduced cost!


FIT9137 6
Sharing Software on a LAN
Client-server architecture:
• purchase software on a per-seat basis

• clients access software stored on a server

• simplifies maintenance and upgrades

• example: Monash lab computers

Thin-client web server architecture:


• purchase software that provides a web-based front-end

• install on intranet web server

• clients access software via web browser

• example: Monash Allocate, WES, etc


FIT9137 7
LAN metering / License servers
What if only 10 out of 100 users need certain software at
any point in time?
• purchase a 10-seat license

• run a license manager on a server:

• clients requests license when starting software

• license manager only grants access if less than 10 users


already use software

• client hands back license to server when finished

Advantages:
• reduced cost (only pay for number of licenses used)

• helps reduce copyright violations


FIT9137 8
LAN Types

FIT9137
LAN Types
Dedicated Server LAN
• network contains servers and clients

• each server has one or more specific tasks


• most popular type of business network
Peer-to-Peer LAN cheaper, but less
capable
• no dedicated servers

• all computers act as both servers and clients

• example: your home LAN

FIT9137 10
Dedicated Server LAN
print
server

intranet http,
email

gateway
router

file
server

FIT9137 11
Peer-to-peer LANs
print
server

E.g. share photos, music


with other computers in
the same network.
WiFi
router Often still contains
dedicated servers (e.g.
for printing, backup)

FIT9137 12
Comparison
Dedicated P2P

expensive (more cheap (re-use


Cost
hardware needed) existing hardware)

very high,
 lower,



Performance
scalable may not scale well
very high

Reliability (server-grade lower
components)
easier

Management more difficult
(centralised)
FIT9137 13
Basic LAN
components

FIT9137
Basic LAN components
Client computer
Network interface
card (NIC)
Network
operating
system Switch
(NOS) Server
NOS
Network cable NIC

FIT9137 15
Network interface card (NIC)
Implements physical and data link layer
• includes unique data link layer address (MAC address)

• provides physical connection to the network (socket


or antenna)

• implements protocols (error detection, construction of


frames, modulation or encoding etc)

Connection to the computer


• often built into motherboards

• or connected via USB, PCI Express etc

FIT9137 16
FLUX question: Newest?

1
2

3 4
FK2HL1
FIT9137 17
FLUX question: Most expensive?

1
2

3 4
FIT9137 18
Network Cables

Physical connection between network devices


Different types:
• UTP (most common type for LAN)

• STP (shielded twisted pair)

• Optical fibre (not yet common in LANs)

• Coaxial (only old LANs)

FIT9137 19
Network Cables
Name Data Rate Cables

10BASE-T 10Mbps UTP cat 3 / cat 5

100BASE-T 100Mbps UTP cat 5

1000BASE-T 1Gbps UTP cat 5e, 6

optic fiber (single mode


1000BASE-X 1Gbps
or multi-mode)
UTP cat 6, 7

10GbE 10Gbps
optic fibre

40GbE / 100GbE 40Gbps / 100Gbps optic fiber

FIT9137 20
Network Operating Systems
Software to access and control the LAN
• Server NOS provides network management tools and
network services

• Client NOS provides access to the network services

Services provided by Server NOS


• directory service

• network & user profiles

• file, web, print, email server etc

FIT9137 21
NOS Server Software
Handles network functions
• full protocol stack (data link, network, transport, application
layers)

• includes application software for e.g. HTTP, FTP, SMTP, IMAP,


LDAP, DHCP, DNS, SQL databases, …

Replaces or augments the normal OS


• can be optimised for server performance instead of user
applications

Examples
• Linux

• Microsoft Windows Server


FIT9137 22
NOS Client Software
Handles network access
• data link, network, transport layers

• interacts with application layer

• used to be separate OS

• now included in all major operating systems


(Windows, Mac OS, Linux, Android, iOS, …)

Client can view and access network resources


• present available services to client

FIT9137 23
Ethernet,

Hubs and Switches

FIT9137
Ethernet
Dominant LAN technology
• Standardised as IEEE 802.3

• used by almost all LANs

• developed in 1973, standardised in 1980

Physical layer
• Originally 10Mbps over shared media coaxial cable

• Now mostly switched 100Mbps or 1Gbps over UTP

• Standards exist for optic fiber up to 100Gbps

FIT9137 25
Ethernet
Topology:
shared bus (multi-point)

FIT9137 26
Ethernet

Physical topology:
Every signal received
on one port is sent out star (point-to-point)
on all other ports

Hub
Logical topology:
shared bus (multi-point)
FIT9137 27
Ethernet

max 100m

Hub
max 100m

Multi-hub design
(100BASE-T Ethernet)

FIT9137 28
Ethernet MAC (recap)

Contention-based Media Access


• devices compete for access

• frames can collide if two devices send at the same


time

Collisions
• are not avoided, but tolerated and detected

• efficient enough for small to medium size networks

FIT9137 29
Ethernet MAC
Media Access Control: CSMA/CD
• Carrier Sense (CS):

listen on bus, only transmit if no other signal is "sensed"

• Multiple Access (MA):



several devices access the same medium

• Collision Detection (CD):



when signal other than own is detected:

• transmit jam signal (so all other devices detect


collision)

• both wait random time before re-transmitting

FIT9137 30
Problems with Shared Ethernet
Half-duplex
• only one device can send at a time

Broadcasting
• all frames are delivered to all devices, not just
destination

Limited network size


• CSMA/CD limits size of collision domain

Solution: implement logical star topology!

FIT9137 31
Switched Ethernet

FIT9137
Switched Ethernet
Network switch
• looks like hub

• 16 to 24 ports for UTP cables

• but: circuit no longer shared!


A switch is a layer 2 device
• reads MAC address of frame

• transmits only to destination port

How does the switch know the destination port?

FIT9137 33
Switch Forwarding Table
MAC Port

A A
B
0
1
B
A to B B to A
C 2

When the table is 0 1


empty, a switch acts A to B
like a hub! 3 2

flood frame to all


D ports except C
source C to A

FIT9137 34
FLUX Question: Switch vs Router
What is the difference between a forwarding table and a routing
table? (several correct answers, you can click several times)

1. A forwarding table uses the MAC address, a routing table uses the
IP address

2. Forwarding tables can contain multiple destinations per port,


routing tables only one

3. Routing tables connect different subnets

4. Forwarding tables change when the network changes, routing


tables don't

5. Routing tables are set up by hand, forwarding is automatic

FIT9137
FK2HL1 35
Modes of Switch Operations
Cut through switching
• transmit as soon as destination address has been read

• low latency, but may transmit frames that have errors

Store and forward switching


• switch waits until entire frame is received, performs error control,
then transmits

• higher latency, but less capacity wasted with errors

Fragment free switching


• reads first 64 bytes (contains header)

• if OK, begin transmitting

• compromise between the other two approaches


FIT9137 36
Switches and MAC
Full-duplex circuits
• point-to-point connection between computer and switch

• no collisions possible

But frames may still be sent at the same time


• e.g. A sends to B while C sends to D

• or A and B both send to C simultaneously

• switch has memory: stores second frame until


transmission of first frame is finished, then forwards the
second - store and forward
Switched Ethernet runs at up to 95% capacity, compared
to 50% for shared Ethernet!
FIT9137 37
Best Practice Ethernet LAN Design
Switched 1000BASE-T
• Most PCs now have 1000BASE-T NICs

• 1000BASE-T switches cost basically the same as 100BASE-T

Cat 6, 6a cables (Cat 8 in data centre)


• Costs are not prohibitive any more

• Cat 6a can be upgraded to 10Gbps Ethernet

Optic fiber
• Still more expensive than copper

• LAN with extremely high traffic needs

• May be more future-proof


FIT9137 38
FLUX Question: 10/100/1000
A 10/100/1000 Ethernet switch can sense the speed of the
device on each port and connect e.g. a 100BASE-T client
NIC to a 1000BASE-T server NIC.

Which switching mode can it use?

FK2HL1
1. It can only use cut-through switching.

2. It can only use store-and-forward switching.

3. It can use any switching mode.

4. It cannot use switching, it has to implement routing.

FIT9137 39
Improving LAN
performance

FIT9137
Improving LAN performance
Throughput
• common measure for LAN performance

• total amount of user data transmitted in a given period of


time

To improve throughput, eliminate bottlenecks


• a bottleneck is a point in a network where congestion is
occurring

• congestion is when a network or device can't handle the


demand

• congestion at bottlenecks typically results in dropped


packets
FIT9137 41
Identifying Bottlenecks
Potential locations
• network server

• network circuit (including switches)

• client (unlikely, unless very old hardware)

How to find bottlenecks


• Check server utilisation

if high (> 60%): the server is the bottleneck

if low (<40%): the circuit is the bottleneck

if moderate: both server and circuit are bottlenecks

FIT9137 42
Improving Server Performance
Software improvements
• fine tune network and NOS parameters, e.g.

• memory used for disk cache

• available buffer space

• number of simultaneously open files

Hardware improvements
• add second server (load balancing)

• upgrade server's CPU and/or memory

• add more hard disks

• add second NIC to existing server


FIT9137 43
Improving Disk Performance
Important!
• disks are the slowest components in a server

• many server tasks require disk access

RAID
• Redundant Array of Inexpensive Disks

• links several hard drives together

• can improve performance (read/write from/to several


drives simultaneously)

• can improve reliability (duplicate files across drives,


when a drive fails, another one still contains the files)
FIT9137 44
Improving Circuit Capacity
Option 1: upgrade to better standard
• e.g. from 100BASE-T to 1000BASE-T

• requires new NICs and new switches, often new


cables

• some switches provide e.g. 16 1000BASE-T ports


plus 2 10GbE ports: only upgrade path to the server

Option 2: segment the network


• add second NIC to server

• increase number of parallel paths to the server

FIT9137 45
Network Segmentation
Split into two Add second
LANs NIC

Add router to
connect LANs
FIT9137 46
Reducing Network Demand
Move files to clients
• e.g. heavily used software packages

Install disk caching software on clients


• can store often used files locally

• reduces need to access file server

Spread out tasks to off-peak time


• let automated tasks such as backups run e.g. at night

FIT9137 47
FLUX Question: Server in LAN?
Should file servers be part of the same LAN as clients? (multiple
answers possible)

1. Yes: LANs have high bandwidth, so server access is most


efficient.

2. No: all devices in a LAN are in the same physical location


(e.g. office space), but servers are better kept in separate
areas.

3. Yes: LANs have low latency, so server access is most


efficient.

4. No: LANs should be homogeneous (e.g. all devices should


use the same OS) to be most efficient.
FIT9137 48
Wireless LANs

FIT9137
Why WiFi?
Wireless LANs
• eliminate cables (heritage buildings, rented
apartments, …)

• allow for more flexible network access

• facilitate mobile workers (e.g. hospital)

Basic setup
• WLAN NICs connect to Access Points (APs) using
radio frequencies

• APs are connected to wired LANs (or backbones)

FIT9137 50
WLAN Technology
Wi-Fi (or “Wireless Ethernet”)
• IEEE 802.11 family of standards

• Original standard from 1997-1999 (802.11a, 802.11b)

• Widely used: 802.11n (2009), 802.11ac (2013)

• Latest: 802.11ax

Other wireless LAN technologies


• WiMAX (802.16)

• Bluetooth (802.15), also called WPAN (Wireless


Personal Area Network)
FIT9137 51
IEEE 802.11 WLAN
Spectrum
• 802.11 use radio waves in the 2.4 GHz and 5 GHz bands

• These frequencies can be used without obtaining a license



ISM - Industrial, Scientific and Medical

Data rates
• 802.11a/g: up to 54 Mbps

• 802.11b: up to 11 Mbps

• 802.11n: up to 150 Mbps

• 802.11ac: up to 800 Mbps

• 802.11ax: 1 Gbps+
FIT9137 52
Antennas

Omnidirectional
• transmits in all directions

• used in most APs and NICs

Directional
• project signal in one direction

• transmitter and receiver must point at each other

• higher signal strength with same transmitting power


FIT9137 53
Attenuation and Noise

signal
Signal strength

noise spike
error
signal-to-noise noise floor
ratio (SNR) (average noise
level)

noise

Distance
FIT9137 54
WLAN Radio Frequencies
Most WLANs use the 2.4GHz and/or 5GHz range
• high frequencies allow for large bandwidth

• but higher frequencies have stronger attenuation

WLAN channels
• Networks in the same area should not use the same
frequencies

• WLAN spectrum is divided into channels, each


network is set to a different channel

FIT9137 55
WLAN channels (802.11n)
2.4 GHz Wi-Fi channels (802.11b,g WLAN) 24/04/2015 5:10 pm

1 2 3 4 5 6 7 8 9 10 11 12 13 14 Channel
2.412 2.417 2.422 2.427 2.432 2.437 2.442 2.447 2.452 2.457 2.462 2.467 2.472 2.484 Center Frequency
(GHz)

22 MHz

channel 1 channel 6 channel 11

2.4GHZ band
• 2.4000-2.4835 GHz

• 13 channels, each 22 MHz wide

• But channels overlap! Only 5 MHz apart

FIT9137 56
FLUX Question: Neighbours’ channels
Which neighbour do you need to convince to change channels?

1 2
channel 1
channel 6

4
3
channel 6 your house channel 11
FIT9137 57
FLUX Question: Neighbours’ channels
Which neighbour do you need to convince to change channels?

1 2
channel 1
channel 6

4 channel 11
3
channel 6 your house channel 1
FIT9137 58
802.11 Data Link Layer
Recap: Ethernet frame (802.3)

dest. source length



address address or type Data FCS

6 6 2 46-1500 4

WLAN frame

address address address address


FC D/I
1 2 3
SC
4
QC Data FCS

2 2 6 6 6 2 6 2 0-2312 4

four address fields!

FIT9137 59
CSMA/CA Media Access Control
All devices in a WLAN share the medium
• use the same channel (frequency band)

• need to deal with collisions

CSMA/CA
• Carrier Sense, Multiple Access

• Collision Avoidance

• Compare to 802.3: Collision Detection

• Devices try to actively avoid collisions

FIT9137 60
Why is WLAN different?

sense carrier -
don't send

FIT9137 61
Why is WLAN different?
"hidden
node
problem"

too far away to


sense carrier!

FIT9137 62
Why is WLAN different?
"hidden
collision!
node
problem"

too far away to


sense carrier!

FIT9137 63
Two solutions: ARQ + Controlled Access

802.11 uses stop-and-wait ARQ


• devices only send next frame after receiving ACK for
previous frame

• note: this is in addition to ARQ at transport layer!

802.11 may use controlled access


• device can send "Request To Send" (RTS)

• will then only transmit frame if AP sends "Clear To


Send" (CTS)

• usually not implemented

FIT9137 64
802.11 Carrier Sense
no wait until
medium
idle? transmission ends
inter-frame
spacing time yes

wait IFS wait IFS + random


back-off

no
still idle?
still idle? no

yes
yes
transmit frame
FIT9137 65
Inter Frame Space (IFS)
If medium available:
• need to wait certain time to make sure medium is idle

• this is the time between two frames: IFS

This lets us implement priorities!


• High-priority frame (e.g. ACK): short IFS

• Normal frame: regular IFS

• Re-send after collision: longer IFS

FIT9137 66
802.11 ARQ
Hidden node problem
• collision detection not reliable

• instead, receiver needs to ACK every frame

What if no ACK?
• we may not sense a carrier (too far away)

• re-sending immediately therefore might be bad idea

Solution: exponential back-off


• 1st collision: everybody waits 0 or 1 time unit

• 2nd: everybody waits between 0 and 3 time units

• 3rd: everybody waits between 0 and 7 time units…


FIT9137 67
WLAN Topology

FIT9137
Basic Service Set (BSS)

Independent BSS
• ad-hoc network

• devices communicate directly with each other

FIT9137 69
Basic Service Set (BSS)

Infrastructure BSS
• all devices communicate with one Access Point (AP)

• AP connects to LAN

• all devices communicate via the AP


FIT9137 70
Extended Service Set (ESS)

AP1 AP2 AP3

BSS1 BSS2 BSS3

devices can
15% roam between
overlap different APs

FIT9137 71
Extended Service Set (ESS)
Extends range of mobility
• set of infrastructure BSSs

• APs communicate to forward traffic between BSSs

• APs communicate via distribution system (LAN)

• devices see a single layer 2 connection

Roaming between different ESSs


• not possible in 802.11 protocol

• requires higher-level protocol, e.g. Mobile IP

FIT9137 72
Extended Service Set (ESS)

FIT9137 73
WLAN Design
More challenging than Ethernet LAN
• expected to work in every corner of a building

• need to create overlap for roaming

• need to select channels to avoid interference

Site survey
• measure signal strength with temporary APs

• identify sources of interference (walls, other radio


equipment)

• identify location of LAN and power sources for APs

• estimate number of APs required


FIT9137 74
WLAN Design Specs (802.11g)
WLAN Design Specs for 802.11g

Access Point
use similar table to
estimate number of
APs and overlap

Topic Notes: Wireless Local Area Networks 44

44
FIT9137 75
FLUX Question: Walls
FK2HL1
Why are walls a problem for Wireless LAN?

1. WLAN NICs require direct line of sight to the AP.

2. Walls weaken the signal (attenuation).

3. Walls often contain metal, which acts as an antenna


and therefore can damage frames.

4. Walls reflect the signal and can therefore introduce


duplicate frames.

FIT9137 76
Attenuation
Walls can introduce
significant attenuation.
• 3db means signal strength
halves

• 6db means 1/4

• these values are for


2.4GHz, attenuation is even
higher in 5GHz

Source: http://www.liveport.com/wifi-signal-attenuation

FIT9137 77
Planning Example
150m

6 1 6 11 6 1

1 11 1 6 1 11
100m

11 6 1 align coverage
areas to ensure
minimum overlap
6 1 11 select channels to
avoid interference
11 6 1

50m
FIT9137 78
Multi-Storey Building WLAN
CHAPTER 6 WIRED AND WIRELESS LOCAL AREA NETWORKS

Channel 1 usual horizontal


mapping

Channel 6 plus vertical


mapping

FIGURE 6.10 A Wi-Fi


Channel 11
design in the three dimensions
(the numbers indicate the channel
numbers)

APs on different floors do not interfere with one another (Figure 6.10). Because floors
FIT9137 79
WLAN Security

FIT9137
Why WLAN Security is important

It's much easier to eavesdrop


• radio waves travel through walls and leave the office /
building / campus

• thicker walls + directional antennas don't solve the


problem (e.g. what about visitors?)

• can't limit access to physical layer

FIT9137 81
Open WLAN

No authentication, no encryption
• e.g. Monash guest-wireless

• does not require user login

• all frames can be captured by any device in range

FIT9137 82
captured from a different
computer, without log-in!
Open WLAN
No authentication, no encryption
• e.g. Monash guest-wireless

• does not require user login

• all frames can be captured by any device in range

Not adequate for company networks


• threat to company secrets

• why does Monash offer guest-wireless?

FIT9137 85
Open WLAN
No authentication, no encryption
• e.g. Monash guest-wireless

• does not require user login

• all frames can be captured by any device in range

Not adequate for company networks


• threat to company secrets

• why does Monash offer Free Wi-Fi?

FIT9137 86
Why WLAN Security is important
It's much easier to eavesdrop
• radio waves travel through walls and leave the office /
building / campus

• thicker walls + directional antennas don't solve the


problem (e.g. what about visitors?)

• can't limit access to physical layer

Limit access to higher layers!


• encrypt at network, transport or application layer (e.g.
SSL/TLS, IPSec)

• encrypt at data link layer


FIT9137 87
Types of WLAN Security
Wired Equivalent Privacy (WEP)
• NIC and AP have a shared key ("password")

• all communication is encrypted by that key

• key length: 40 or 128 bits

FIT9137 88
Cracking WEP

FIT9137 89
Types of WLAN Security
Wired Equivalent Privacy (WEP)
• NIC and AP have a shared key ("password")

• all communication is encrypted by that key

• key length: 40 or 128 bits

Wi-Fi Protected Access (WPA/WPA2, 802.11i)


• key is longer and changed for every packet

• uses strong AES encryption

• two modes:

• PSK (pre-shared key) for personal use

• Enterprise (802.1X) uses authentication server

FIT9137 90
WPA2 KRACK
WPA2 was hacked!
• Vulnerability discovered in 2016

• Published in 2017 by researchers from Belgium

• Can be mitigated in new software (but both AP and


client have to be updated)

WPA3 will feature stronger security measures


• Will be rolled out with new APs and operating
systems in the next few years

FIT9137 91
Google WiFi sniffing

https://youtu.be/ZjfQhb4AkEE
FIT9137 92
FLUX Question: Was Google wrong?
Google stored results from WiFi sniffing. This included
unencrypted, personal data from unprotected WLANs.
What do you think about this?

1. Not Google’s fault. If you use an unprotected WLAN,


you should know that your data is essentially public.

2. Google was wrong to store the data. It was clearly not


meant for them. It’s Google’s responsibility to only
collect data that they are allowed to have.

3. Google made a mistake, but it’s mainly the users’


fault if they use an open WLAN.
FIT9137 93
WLAN Performance

FIT9137
Improving WLAN performance

Similar to improving 802.3 Ethernet


• upgrade to newer standard (802.11n, ac, ax)

• buy high-quality hardware (antennas!)

• improve network layout (placement of APs,


interference)

• reduce network demand

FIT9137 95
Improving WLAN circuit capacity
Find best place for APs
• few walls between AP and devices

• ceiling or high mounted (fewer obstacles)

• not in a closet

Remove interference
• other wireless devices operating in same frequencies
(Bluetooth, cordless phones, clickers)

Use different antennas


• directional antennas to get stronger signals
FIT9137 96
Reducing WLAN demand
Never place a server in a WLAN
• remember: all devices communicate through the AP
• and all devices share the same medium

• server in a WLAN doubles traffic in WLAN!

Place enough wired Ethernet sockets


• don't rely solely on WLAN

• alternative for high-bandwidth hardware or when


WLAN becomes a problem

FIT9137 97
Summary
LANs
• enable sharing of information and resources
• dedicated server vs peer to peer
• NOS provides services such as directory, files, printers
Ethernet
• CSMA/CD
Switched Ethernet
• full-duplex connections up to 10Gbps over copper

• switch forwards packets based on MAC address

LAN performance
• identify and remove bottlenecks

Wireless LANs
• similar to wired Ethernet: hub with shared medium

• CSMA/CA, hidden node problems, stop-and-wait ARQ

• roaming in ESS

• installation requires careful planning

Security
• important because easy to eavesdrop

• WEP is easy to crack

• WPA2 is industry standard

FIT9137 98
Lab Week 7 Lab Overview

• War-Walking

• Assignment 1

FIT9137 99
Next week

Network and transport layers


• connect networks to other networks
• addressing computers

• addressing different applications

• establishing connections

FIT9137 100
FIT9137
Introduction to Computer
Architecture and Networks
Week 7: Network and Transport Layers (Part 1)
Amin Sakzad and ABM Russel

FIT9137
Unit Topics

FIT9137 2
Network / Transport
Transport Layer:
• establish end-to-end channel

• reliable communication (segmenting + ARQ)

• addressing of individual applications


Network Layer:
• addressing and routing of packets

• connecting different networks

FIT9137 3
Layers of Abstraction

Switch Router Switch


FIT9137 4
FLUX Question: Error Correction
Why do most Data Link Layer protocols (e.g. Ethernet as
discussed last week) not perform error correction?

1. The Data Link Layer PDU does not contain enough


information to correct an error

2. The physical layer already performs error correction

3. The application layer needs to be aware of errors, so


error correction is implemented there

4. The transport layer performs ARQ, which can correct


errors anyway
FK2HL1
FIT9137 5
Addressing

FIT9137
Addressing applications

Why does the HTTP response


arrive in this browser window
and not the other one?
FIT9137 7
Addressing applications
http://www.google.com.au
216.58.220.99 :80
Random client port,
one per connection

Fixed server port


130.194.77.37:57017 (80 = HTTP)
130.194.77.37:57018
130.194.77.37:57019

130.194.11.146:25 Fixed server port


smtp.monash.edu (25 = SMTP)

111.119.8.38:80
http://www.nasa.gov
FIT9137 8
One address per layer
Application Layer
• URL (e.g. http://www.csse.monash.edu)

Transport Layer (TCP)


• Port number (e.g. 80 for HTTP)

• identifies the application that handles a message

Network Layer (IP)


• IP address (e.g. 130.194.66.43)

• used for identifying devices across networks

Data Link Layer (Ethernet)


• MAC address (e.g. 00:23:ae:e7:52:85)

• used for sending frames in a LAN


FIT9137 9
Where to get an address?
DNS entries
• ICANN/Registrars manage top-level and second-level domains

• Network admins manage DNS for their assigned domains

Port numbers
• IANA maintains official list of port numbers

IP addresses
• IANA and 5 RIRs allocate blocks of addresses, local registries re-
distribute to customers

• Network admins configure (static or dynamic) addresses in their


assigned block

MAC addresses
• Unique addresses allocated by hardware manufacturers

FIT9137 10
Addressing devices
192.168.1.15

192.168.1.1 216.58.220.142

202.158.200.149
216.239.46.151
203.214.44.94
202.158.200.12

202.158.210.41
209.85.142.94

Each “layer 3 device” has an address!


Routers decide path for packets that need
to leave their own network.
FIT9137 11
IP version 4 addresses
32 bit addresses
• Written using “dotted decimal” notation

• Example:
 130.194.66.43

 10000010 11000010 01000010 00101011


 Network
Monash (Monash)
University Subnet
LAN
(LAN) Host

Hierarchy used for routing


• You can immediately see if a destination address is in
the same subnet!
no. of bits in network +
subnet
• Subnet mask: 255.255.255.192 or /26
FIT9137 12
Networks and subnets
Organisations
• buy a network address, such as 130.194.0.0/16

• allocate multiple subnets within their network

• subnets (roughly) correspond to LANs

Analogy:
• network = post code

• subnet = street

• host id = building number

FIT9137 13
Network Classes
Previously used hierarchy:
• Class A: /8 (e.g. IBM, MIT, AT&T, Apple, …)

• Class B: /16 (e.g. Monash 130.194.0.0/16)

• Class C: /24

Example:
• Monash would buy a Class B network, and then be
able to create 256 Class C subnets inside

Now: classless
• e.g. /22, which can also be written as 255.255.252.0
FIT9137 14
FLUX Question: Classes
Why was the restriction to 3 classes (A,B,C) a problem for
the network?

1. There were not enough class A networks available for


all companies that needed one

2. For many companies class C is too small but



class B is too big

3. Classes must have all 1s at the start (e.g. 255.0.255.0


impossible)
FK2HL1
4. Class A networks were too big to be efficient
FIT9137 15
Subnets
130.194.76.192 Backbone
130.194.76.253 network

130.194.40.13

130.194.76.191

Gateway routers

130.194.66.61

130.194.40.22

130.194.66.43

FIT9137 16
MAC address

IPv4 address subnet mask


MAC address

IPv4 address

subnet mask
IP version 6
IPv4 addresses: 32 bits
• In theory 4,294,467,295 addresses

• In practice probably only half are usable

• We’ve run out of new blocks of IPv4 addresses

IPv6
• “new” version of the IP protocol (from 1998…)

• 128 bits per address

• so that’s four times more, right?

FIT9137 19
IP version 6

2128=

340,282,366,920,938,463,463,374,607,431,768,211,456

(340 undecillion)

IPv6 addresses

FIT9137 20
IP version 6
340,282,366,920,938,463,463,374,607,431,768,211,456
A bit excessive?
• At least 7 addresses for every atom of every person
on earth

• 665,570,793,348,866,943,898,599 addresses per


square meter of the surface of the earth

Required!
• The huge space is used to create hierarchies
• This makes it easy to assign whole subnets

FIT9137 21
IP version 6 address space
Typical allocation:
Company / Interface ID

IANA + RIR Organisation (16 bits) (64 bits)

/23 /32 /48 /64

ISP (9 bits) Subnet (16 bits)

232 times more addresses than IPv4 in Interface ID alone!


Every company can run more than 65,000 different LANs
FIT9137 22
IPv6 address
Configuring IP addresses

Every device on the network needs an IP address


• Doesn't change for servers and routers, so configure
statically

• Probably doesn't need to change for workstations,


but configuring is time consuming

• Infeasible to allocate statically for mobile devices

FIT9137 24
Dynamic Addressing IPv4
Dynamic Host Configuration Protocol (DHCP)
• Send broadcast to DHCP server to get an address
and subnet mask

• Addresses are only leased for a limited time

• Makes efficient use of limited IPv4 address space


(since only computers currently connected to the
network get an address)

• Much easier for admins to manage than static


addresses

FIT9137 25
Dynamic Addressing IPv6
/23 /32 /48 /64

Interface ID (64 bits)

Devices create link-local address when switched on


• Special network prefix + MAC address

Send multi-cast to all routers in LAN


• Routers advertise with their subnet prefixes

Auto-configure address
• Advertised prefix + self-generated interface ID

• Check that nobody else uses this address


FIT9137 26
Address resolution
Assume we browse to http://www.google.com.au
• We know http is port 80

• We have to translate www.google.com.au into an IP


address: 216.58.220.99

• We send a request through the internet to that IP


address

• The router in the LAN of 216.58.220.99 needs to


know the MAC address for 216.58.220.99 to deliver
the frame

This is known as address resolution.


FIT9137 27
Address resolution: Application Layer

DNS (Domain Name System)


• Application layer protocol for address resolution

• Client sends request to DNS server to get IP address


registered for a name

DNS Servers
• Implement a distributed database of names

• Are organised in a hierarchy reflecting the structure


of the domain names

FIT9137 28
DNS
root
ask z.au
Root Zone

Top-Level Domain
.org
.com
.org
.org
.edu
.edu .au .monash (TLD)
ask edns-396.unimelb.edu.au

monash .edu Iterative DNS lookup

unimelb
124.47.170.46

www.unimelb.edu.au?

FIT9137 29
DNS
root Root Zone

Top-Level Domain
.org
.com
.org
.org
.edu
.edu .au .monash (TLD)

monash .edu Recursive DNS lookup

unimelb

www.unimelb.edu.au? ISP cache


124.47.170.46

FIT9137 30
Address resolution: Data Link Layer
How to find the MAC address for an IP address:

00:23:ae:e7:52:85

1.2.3.5

1.2.3.6
1.2.3.4
Who has 1.2.3.5?
broadcast
message
1.2.3.1

Address
Who Resolution
has 1.2.3.5? Protocol

(ARP)
FIT9137 31
TCP:

a reliable end-to-end
channel

FIT9137
Transmission Control Protocol (TCP)
Connection-oriented
• A virtual circuit is established between two devices

• To the application it always looks like a point-to-


point full duplex connection

• Messages split into segments for transmission

Reliable
• Errors are detected and corrected

• Segments are re-assembled in the correct order


Used by e.g. HTTP, SMTP, IMAP, SSH
FIT9137 33
TCP parameters
TCP implements segmentation
• large application layer messages are split into
segments

How fast to send segments?


• Sending too many at once may overload receiver or
intermediate path with lower bandwidth

How to decide the segment size?


• Sending too large segments requires IP to fragment
• Large segments also increase errors

FIT9137 34
TCP segment size
Two approaches:
• use “reasonable” MTU, accept that IP sometimes
needs to fragment

• use Path MTU Discovery (PMTUD):

• send IP packets to destination, asking routers to


never fragment

• if router would have to fragment, it sends back an


error message

• increase packet length until error occurs, then use


last known error-free MTU
FIT9137 35
TCP congestion control
How fast to send?
• Receiver transmits its maximum buffer size

• Sender sends segments without waiting for ACK up


to buffer size

What if network cannot cope?


• Start slow: wait for ACK after each segment

• Increase with every ACK: send two, four etc


segments after each ACK

• Fall back to slower speed when no ACK arrives

FIT9137 36
TCP:

session management

FIT9137
TCP Header
0 32
number of first
source port destination port
data byte
number of data
byte that I sequence number
receive

acknowledgement number
SYN
flags ACK

window size

checksum urgent pointer

options

FIT9137 38
Establishing a session

Three-way handshake:
• Client sends a SYN package with random sequence
number A

• Server replies with SYN, ACK, acknowledgement


number A+1, and random sequence number B

• Client sends ACK with sequence number A+1 and


acknowledgement number B+1

FIT9137 39
Recap: Continous ARQ
Sender Receiver
frame A

frame B

ACK A

frame C frame C

ACK B

frame D

NAK C

frame C

ACK D

ACK C
FIT9137 40
TCP ARQ
No NAKs!
• Data Link Layer discards frames that have errors

• Frames may not arrive at all

• Retransmit if no ACK received within timeout

No frame numbers (like ACK B)


• But need to know which frame is ACKed

• ACK next expected sequence number

• This can ACK several segments at once

FIT9137 41
Ending a session
Four-way handshake:
• Computer A (client or server!) sends a FIN packet

• Computer B acknowledges with an ACK

• Computer B sends a FIN packet

• Computer A acknowledges with an ACK


• Can be simplified to three-way (combining a FIN/
ACK)
Necessary because TCP is full duplex!

FIT9137 42
TCP session
Client Server
3185 | 0 SYN
3-way
734 | 3186 SYN, ACK
handshake
3186 | 735 ACK

3186 | 735 some data

3195 | 735 more data data


transmission 735 | 3204 ACK
(full duplex) 735 | 3204 thanks!

3204 | 742 ACK

3204 | 742 FIN

4-way 742 | 3205 ACK


handshake 742 | 3205 FIN

3205 | 743 ACK


FIT9137 43
UDP:

connectionless, unreliable
transport

FIT9137
User Datagram Protocol (UDP)
Connectionless
• Each packet ("datagram") sent individually

• No virtual circuit

• No acknowledgement of receipt (unreliable)

Small header
• 8 bytes (compared to 20 bytes for TCP)

Use cases
• Applications that send very small messages (e.g. DNS,
DHCP)

• Applications where loss of segments is acceptable, e.g.


streaming video
FIT9137 45
Quality of Service and
Net Neutrality

FIT9137
Quality of Service (QoS)

How can VoIP replace POTS?


• Sound quality?

• Availability?

• Emergency calls?

VoIP packets need guaranteed transport


characteristics:
• low latency, low jitter
FIT9137 47
QoS
Two strategies:
• Integrated Services where applications request a
channel with certain guarantees


Implemented by Resource Reservation Protocol
(RSVP) on top of UDP

• Differentiated Services where each individual packet


requests a certain service class, which is given
corresponding priority


Implemented using special field in IP packet header

FIT9137 48
Net Neutrality

What it means:
• All Internet traffic should be treated equally

• ISPs should not charge based on type of traffic or


application

Let's hear a few opinions!

FIT9137 49
Last Week Tonight with John Oliver (HBO), June 1 2014
https://youtu.be/fpbOEoRrHyU
Tom Wheeler, FCC Chairman, February 26, 2015
https://youtu.be/vfVR0C2HHSI
https://youtu.be/EZldPT7gFGU
Robert Kahn, co-inventor of TCP/IP
https://youtu.be/t3uTKs9XZyk
FLUX Question: Net Neutrality

What do you think about network neutrality?

1. The Internet belongs to everyone, so nobody should


be allowed to decide what users can and cannot do.

2. Networks are owned and run by commercial


companies, so they should be allowed to decide
which services to provide, to whom, and at what price.

3. Governments should regulate networks to ensure fair


access for every end user and every business.

FIT9137 54
Net Neutrality
Controversial!
• Telcos blocking e.g. Skype or IM over 3G/4G/5G

• ISPs want to charge e.g. Netflix or YouTube for traffic

• FCC ruled that (in the US) internet providers can be


regulated like telecommunications providers and net
neutrality can be enforced

• New FCC director has reversed the ruling

How about QoS?


• Difficult, but one argument is that any service can e.g.
use the QoS bits in the IP header
FIT9137 55
Summary
Addressing
• At each layer (DNS, ports, IP, MAC)

• Hierarchy necessary for routing (networks, subnets)

• IPv4 vs IPv6

Transport
• TCP: Reliable end-to-end channel using segmenting and
ARQ

• UDP: unreliable individual messages

QoS / Net Neutrality


• Compromises required
FIT9137 56
Lab Week 8 Overview

• Wireshark - TCP

• Subnets

FIT9137 57
Next week

Routing
• How to get a packet from one edge of the network to
another through multiple hops

FIT9137 58
FIT9137
Introduction to Computer
Architecture and Networks
Week 8: Network and Transport Layers (Part 2)
Amin Sakzad and ABM Russel

FIT9137
Unit Topics

FIT9137 2
Today

Recap: TCP segmentation


• congestion control, window size

Routing
• how routers determine the path to a destination
address

• how routers exchange information about the network


to find good paths

FIT9137 3
TCP parameters
TCP implements segmentation
• large application layer messages are split into
segments

How fast to send segments?


• Sending too many at once may overload receiver or
intermediate path with lower bandwidth

How to decide the segment size?


• Sending too large segments requires IP to fragment
• Large segments also increase errors

FIT9137 4
TCP segment size
Two approaches:
• use “reasonable” MTU, accept that IP sometimes
needs to fragment

• use Path MTU Discovery (PMTUD):

• send IP packets to destination, asking routers to


never fragment

• if router would have to fragment, it sends back an


error message

• increase packet length until error occurs, then use


last known error-free MTU
FIT9137 5
TCP congestion control
How fast to send?
• Receiver transmits its maximum buffer size

• Sender sends segments without waiting for ACK up


to buffer size

What if network cannot cope?


• Start slow: wait for ACK after each segment

• Increase with every ACK: send two, four etc


segments after each ACK

• Fall back to slower speed when no ACK arrives

FIT9137 6
Routing

FIT9137
Recap: Subnets
130.194.76.192 Backbone
130.194.76.253 network

130.194.40.13

130.194.76.191
How do routers
know where
Gateway to send
routers
packets?
130.194.66.61

130.194.40.22

130.194.66.43

FIT9137 8
Routers
Routers connect networks
• Internet is a network of networks!

• Most important piece of Internet infrastructure

A router is a layer 3 device


• one IP address per interface, i.e. typically per subnet it
is connected to

• Clients send packets to routers if destination is


outside their own subnet

• Routers use IP address to determine over where the


packet is sent next
FIT9137 9
Routing
Three components:
• The routing protocol:

how to find the best route between a sender and a
receiver through the network

• The routing table:



the best routes currently known are stored in a
lookup table for fast access

• The routing decisions:



deciding for each incoming packet where it is sent
next

FIT9137 10
Routing example
Dest. Next Dest. Next
A A A C
dest: H
A G D G G G
H E H H
K E K C
Dest. Next
default C
C D

Dest. Next
default F
B E F
Dest. Next Dest. Next
A C A D
K G F G D H
H F H H
dest: A
K B K E
FIT9137 11
Types of routing
Centralized
• All clients connect to central computer, which makes
the routing decisions

• Used on small, host-based networks

Decentralized
• Each device makes its own decisions

• Information needs to be exchanged to prepare routing


tables

• Used on the Internet

FIT9137 12
Types of decentralised routing
Static routing
• Network manager prepares fixed routing tables
• Manually updated when the network changes

• Used in simple networks that don't change a lot

FIT9137 13
Dynamic Routing

FIT9137
FLUX Question: Router administration
Routers are typically managed by logging in via SSH and then
configuring the router using command line tools.

What are the risks of this approach?

1. Remote operation is always risky, because someone could


eavesdrop on the connection, find out the router password and
then change its configuration.

2. Two admins could be logged in simultaneously and set up


conflicting configurations.

FK2HL1
3. None, because SSH is a secure protocol.

4. When you modify the routing table, you risk locking yourself out.

FIT9137 15
Types of decentralised routing
Static routing
• Network manager prepares fixed routing tables
• Manually updated when the network changes

• Used in simple networks that don't change a lot

Dynamic routing
• Routers exchange information to build routing
tables dynamically
• Initial tables can be set up by network managers

FIT9137 16
Dynamic routing algorithms
Distance vector
• Exchange information about distance to destination,
choose shortest route

• EIGRP (Enhanced Interior Gateway Routing Protocol)

• RIP (Routing Information Protocol)

• BGP (Border Gateway Protocol)

Link state
• Exchange information about quality of links, choose
fastest route

• OSPF (Open Shortest Path First)


FIT9137 17
Distance vector routing
Network A
A Distance: 0 hops
 G
Direction: interface 0

0
1 0 1
3 C D
2 3 2
Network G
Distance: 1 hop

Direction: interface 1 Network K
0 Distance: 2 hops

Direction: interface 0
B 2 E 1 F

K Interface number H

FIT9137 18
RoutingDest.Information
Dist. Interf. Protocol
Dest. Dist. Interf. (RIP)
A 0 0 C 0 0
A B 0 1 G 0 1 G
E 0 2 H 0 2
D 0 3 F 0 3
K 1 1 A 1 0
G 1 C3 B D1 0
H 1 3 E 1 0
F 1 3 K 2 0

B E F
Dest. Dist. Interf.
A 0 0
All routers send their routing
C 0 1
tables to all other routers. H
EK 0 2
K 0 3 Tables converge after some time.
FIT9137 19
Routing Information Protocol (RIP)

Distance = hop count


• Max. hop count 15

• Avoids loops

Only used in small networks


• At most 15 hops

• Updates transmit whole routing table

• Can be slow to converge

FIT9137 20
RIP demo

FIT9137
Link-state routing protocols
Routers exchange information about connectivity
• not just routing table (best routes)

• but all of the network it knows about

• use a metric (usually link speed) to describe the


quality of each connection

Each router creates a topological map


• a map of the entire network

• each router can independently compute best route


to every subnet using a shortest path first algorithm

FIT9137 23
Dijkstra's Shortest Path Algorithm
A ∞ tentative distance ∞ G
5 5
0 ∞
C 5 D metric

2 (lower=better)
1 1 2
20
∞ ∞ ∞
B 1 E 1 F
5
5
K H
∞ ∞
FIT9137 24
Dijkstra's Shortest Path Algorithm
A 5 ∞ G
5 5
0 5
C 5 D
2
1 1 2
20
1 1 ∞
B 1 E 1 F
5
5
K H
∞ ∞
FIT9137 25
Dijkstra's Shortest Path Algorithm
A 5 ∞ G
5 5
0 5
C 5 D
2
1 1 2
20
1 1 ∞
B 1 E 1 F
5
5
K H
∞ ∞
FIT9137 26
Dijkstra's Shortest Path Algorithm
A 5 ∞ G
5 5
0 5
C 5 D
2
1 1 2
20
1 1 2
B 1 E 1 F
5
5
K H
∞ ∞
FIT9137 27
Dijkstra's Shortest Path Algorithm
A 3 ∞ G
5 5
0 5
C 5 D
2
1 1 2
20
1 1 2
B 1 E 1 F
5
5
K H
6 ∞
FIT9137 28
Dijkstra's Shortest Path Algorithm
A 3 ∞ G
5 5
0 4
C 5 D
2
1 1 2
20
1 1 2
B 1 E 1 F
5
5
K H
6 7
FIT9137 29
Dijkstra's Shortest Path Algorithm
A 3 ∞ G
5 5
0 4
C 5 D
2
1 1 2
20
1 1 2
B 1 E 1 F
5
5
K H
6 7
FIT9137 30
Dest. Route
Dijkstra's Shortest
A B Path Algorithm
K B
A 3 G E 9 G
H E
5 5
0 4
C 5 D
2
1 1 2
20
1 1 2
B 1 E 1 F
5
5
K H
6 Shortest Path First (SPF) tree 7
FIT9137 31
Open Shortest Path First (OSPF)
Widely used in large enterprise networks
• OSPFv1 1987, OSPFv2 1991/1998, OSPFv3 for IPv6
1999

Link-state routing protocol


• router builds and maintains a link-state database (LSDB)

• link cost calculated based on bandwidth

• routers exchange information about their LSDB using


multicast and unicast messages

• LSDB is used to create a SPF tree

• best routes from SPF tree are placed in routing table


FIT9137 32
OSPF demo

FIT9137
FIT9137 34
Dynamic routing algorithms
Distance vector
• Exchange information about distance to destination,
choose shortest route

• EIGRP (Enhanced Interior Gateway Routing Protocol)

• RIP (Routing Information Protocol)

• BGP (Border Gateway Protocol)

Link state
• Exchange information about quality of links, choose
fastest route

• OSPF (Open Shortest Path First)


FIT9137 35
FLUX Question: WIFI Routers
Your WiFi/ADSL modem at home is often called a WiFi
Router. What kind of routing does it perform?

1. Static routing, all packets are routed to my ISP.

2. BGP routing, it connects my AS at home to the internet.

3. Link-state routing, to compensate for sometimes poor


quality of ADSL connections.

4. No routing, the name is just used for marketing


reasons.

FIT9137 36
Autonomous Systems
Networks operated by a single organisation
• e.g. Monash University’s or your ISP’s network

Interior routing
• for routing packets within an AS

• uses RIP, OSPF, EIGRP

Exterior routing
• for routing packets between different AS

• Internet uses BGP (Border Gateway Protocol)

FIT9137 37
Internet Architecture
Interior routing
AS1
OSPF
BGP AS3

BGP
Border router BGP BGP

AS4

RIP BGP

AS2 BGP
BGP
OSPF
AS5
AS6
FIT9137 38
FLUX Question: OSPF for the Internet?

Why isn’t OSPF used for routing between autonomous systems?

1. This would be a security concern, because it would expose


internal AS network structure to the outside.

2. This would be a scalability issue, because routers would


have to communicate the entire structure of the internet.

3. This would be impossible to manage for network


administrators.

4. This would be impossible because OSPF only routes in


subnets, not in general networks.

FIT9137 39
Putting it all together

(demo)

FIT9137
Summary
Recap: TCP Segmentation
• congestion control makes TCP adapt to the network
conditions

IP Routing
• routers determine next hop of a packet through the network

• routing tables map destinations to their next hop

• can be configured statically or dynamically

• distance-vector routing (RIP)

• link-state routing (OSPF)

• BGP to connect autonomous systems


FIT9137 42
Lab Week 9 Overview

• Routing Table

FIT9137 43
Next week: Application Layer

• Architectures: client-server, multi-tier, peer-to-peer

• World Wide Web: HTTP and HTML

• Email: SMTP, POP, IMAP

FIT9137 44
FIT9137
Introduction to Computer
Architecture and Networks
Week 9: Application Layer
Amin Sakzad and ABM Russel

FIT9137
Unit Topics

FIT9137 2
The

Application Layer
contains software that enables the
user to perform useful work.

This software provides the



business value.

FIT9137
Today

• Recap: Network Layer and Transport Layer

• Application Architectures

• World Wide Web

• Electronic Mail

• Telnet & SSH

FIT9137 4
Recap:

Layers and Protocols

FIT9137
Layers of Abstraction

Switch Router Switch


FIT9137 6
Layers of Abstraction
Computer 1 Computer 2
Protocol
Application Application

Transport Transport

Network Network

Data Link Data Link

Physical Physical

Protocols define how the same layers communicate


between different computers.
FIT9137 7
Message Encapsulation
Protocol Data Unit

(PDU)

Application Message HTTP www.youtube.com

Transport Segment TCP

Network Packet IP

Data Link Frame Ethernet

Physical Bit

FIT9137 8
FLUX Question: Routing

Which layer is responsible for routing packets?

1. The transport layer

2. The network layer

3. The session layer

4. The data link layer

FK2HL1
FIT9137 9
Architectures

FIT9137
Application Architectures

client
Presentation logic
The user interface. Controls the application.

Application / business logic


Who
Defines what the application does.
does
what?
Data access logic
Defines how the application manages its data.

server
Data storage
Where the data is kept, e.g. files or data base.

FIT9137 11
Server-based Architecture

client
“dumb” terminal Client sends keystrokes to the
server, displays text according to
server’s instructions.

Problems:

Server can become a bottleneck.
Upgrade expensive and “lumpy”.

Presentation logic

server
Application / business logic
Data access logic
Data storage
FIT9137 12
Client-based Architecture

client
Presentation logic
Application / business logic
Data access logic

All the logic is performed by the client.



The server stores the data.

Problems:
All data must travel back and forth
between server and client.

server
Data storage

FIT9137 13
Client-Server Architecture

client
Presentation logic
Application / business logic

Balance the processing load between



client and server.

server
Data access logic
Data storage

FIT9137 14
Thin-Client Architecture

client
Presentation logic

Server handles most of the



application logic.

Advantage:
Only one server needs updating.

Application / business logic

server
Data access logic
Data storage

FIT9137 15
Multi-Tier Architecture

client
Presentation logic

server
Multi-tier
Application / business logic
architecture

server
Data access logic
Data storage

FIT9137 16
Peer-To-Peer Architecture
Presentation logic

client
Application / business logic
Data access logic
Data storage
All computers act as both

clients and servers.

Use local logic to access data stored on

another computer.

Presentation logic

client
Application / business logic
Data access logic
Data storage

FIT9137 17
FLUX question: Google Drive
Monash pays Google to provide vital services such as email,
calendars, and Google Drive, a cloud-based file storage.

Which architecture does Google Drive use?

1. Client-based

2. Thin client-server

3. Server-based

4. Client-server
FK2HL1
FIT9137 18
World Wide Web

FIT9137
What is HTTP?
What is HTML?
HTTP <html>…</html>

Internet

HTTP www.youtube.com
HyperText Transfer Protocol (HTTP)
• Defines how web browsers talk to web servers

• Invented in 1989 by Tim Berners-Lee at CERN:



“How will we ever keep track of such a large project?”

• Based on two innovative ideas:

• Hypertext:

A document containing links to other documents

• Uniform Resource Locators (URLs):



A standard for identifying links to other documents

• HTTP defines how documents are requested and transferred

FIT9137 21
FIT9137 22
Request - Response-Cycle

Response
HTTP <html>…</html>

Internet

Request
HTTP www.youtube.com
Basic HTTP session
client: GET /~guidot/test.html HTTP/1.1 Request line
Host: www.csse.monash.edu
 Req. header
HTTP/1.1 200 OK
Response
server:
Date: Thu, 05 Mar 2015 08:30:48 GMT status
Server: Apache/1.3.26 (Unix)
Transfer-Encoding: chunked Response
Content-Type: text/html header
<html>
<body>
<h1>Guido Tack</h1> Response
<img src="images/guido3.jpg"> body
</body>
</html>

FIT9137 25
Date: Thu, 05 Mar 2015 08:30:48 GMT
Server: Apache/1.3.26 (Unix)
Basic HTTP session
Transfer-Encoding: chunked
Content-Type: text/html

<html>
<body>
<h1>Guido Tack</h1>
<img src="images/guido3.jpg">
</body
</html>

client: GET /~guidot/images/guido3.jpg HTTP/1.1


Host: www.csse.monash.edu

FIT9137 26
<img src="images/guido3.jpg">
Basic HTTP session
</body>
</html>

client: GET /~guidot/images/guido3.jpg HTTP/1.1


Host: www.csse.monash.edu

server: HTTP/1.1 200 OK


Date: Thu, 05 Mar 2015 08:31:23 GMT
Server: Apache/1.3.26 (Unix)
Last-Modified: Tue, 20 Nov 2012 03:29:22 GMT
Accept-Ranges: bytes
Content-Length: 15681
Content-Type: image/jpeg

JFIFHH@ICC_PROFILE0appl mntrRGB

FIT9137 27
HTTP Methods
• GET:

Retrieve specified URL from server

• HEAD:

Retrieve only header for specified URL

• POST:

Add data specified in request body to specified URL


E.g. add a message to a web forum, or an item to a
shopping cart. Also retrieves document.

• Other methods (PUT, DELETE, OPTIONS…) less common


FIT9137 28
Full HTTP Request
POST /~guidot/test_form.php HTTP/1.1 Request line
Host: www.csse.monash.edu

Connection: keep-alive
Accept: text/html,application/xhtml+xml
User-Agent: Mozilla/5.0 (Macintosh)
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US;en
Content-Type: application/x-www-form-urlencoded
Content-Length: 26
Request header
search=data+communications

Request body

Request header and body are optional.



HTTP 1.1 requires at least the Host header.
FIT9137 29
Full HTTP Response
Response
HTTP/1.1 200 OK
Date: Thu, 05 Mar 2015 08:30:48 GMT status
Server: Apache/1.3.26 (Unix)
Transfer-Encoding: chunked Response
Content-Type: text/html header
<html>
<body>
<h1>Guido Tack</h1> Response
<img src="images/guido3.jpg"> body
</body>
</html>

Response header and body are optional.


FIT9137 30
HTTP is stateless
• Each request is an independent transaction
• Example: shopping cart

• Client browses online store

• Server responds with web pages

• Client puts item into shopping cart

• Client continues browsing

• How does the server keep track of which client put


which items into the shopping cart?

(This is called the state of the session)

FIT9137 31
Adding state to HTTP
• Two approaches:

• Client sends session identifier with every request,


e.g. encoded in URL or as data in POST

• Server sets a cookie,



client transmits the cookie with every future request

HTTP HTTP
GET /index.html
GET /index.html HTTP <html>…</html>

FIT9137 32
HTML
• HyperText Markup Language

• Plain text document annotated with tags that describe how to


format the file

• First version also developed by Berners-Lee in 1990

• Example:


<html>
 tag
<body>
 link to other asset
<h1>ABM Russel</h1>

<img src=“images/russel.jpg">

<a href="http://www.w3c.org">W3C</a>

</body>

</html> link to other page

FIT9137 33
HTML + CSS
• Separation of structure and layout:

• HTML defines what each element of the page is

• CSS defines how each element type should be


displayed
• Example:


h1 {

font-family: sans-serif;

color: #006020;

float: left;

}

img { float: right; }

FIT9137 34
Electronic Mail

FIT9137
Electronic Mail

• Invented in 1971 by Raymond Tomlinson

• That’s before what we call the Internet!



(it was called the ARPANET at the time)

• Key invention: name@server



(address that separates the user from the destination
machine, because machines were shared)

FIT9137 36
http://www.computerhistory.org/revolution/the-web/20/377/2329
SMTP Hi! How are you?
SMTP Hi! How are you?
alice@hotmail.com
smtp.live.com

Internet

smtp.gmail.com
bob@gmail.com

POP OK 2 messages
POP LIST
SMTP

alice@hotmail.com
smtp.live.com

Internet
SMTP
smtp.gmail.com
bob@gmail.com

POP/IMAP
Email Protocols
• Simple Mail Transfer Protocol (SMTP)

• Handles transfer of text messages between email client


and mail server, and between mail servers

• Post Office Protocol (POP)

• Messages are downloaded onto client and deleted from


server

• Internet Message Access Protocol (IMAP)

• Messages remain on server

• Multiple clients can be connected simultaneously to


same mailbox
FIT9137 40
Example SMTP Session
220 smtp.monash.edu ESMTP Postfix
HELO my.laptop
250 smtp.monash.edu
MAIL FROM:<alice@monash.com>
250 2.1.0 Ok
RCPT TO:<abm.russel@monash.edu>
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
From: "Alice" <alice@monash.com>
To: "ABM Russel" <abm.russel@monash.edu>
Date: Wed, 20 May 2020 14:43:00 +1000 Header
Subject: test message

Hi Russel!
This is just a test.

Cheers, Body
Alice

.
250 2.0.0 Ok: queued as 85D5312004D
QUIT
221 2.0.0 Bye

FIT9137 41
MIME
• Multi-Purpose Internet Mail Extensions

• Remember: SMTP handles plain text email

• How do you attach other file types?

• MIME specifies an encoding

• Supports character sets (e.g. Unicode) to send


emails with non-latin characters

• Supports non-text attachments

• Supports multi-part message bodies

FIT9137 42
MIME Example
--Apple-Mail=_DC544A01-B885-421C-B475-2DBBCF2DEE37
Content-Transfer-Encoding: base64 Represent image data
Content-Disposition: inline;
filename=guido3.jpg
as plain text!
Content-Type: image/jpeg;
name="guido3.jpg"
Content-Id: <B073584A-EAF2-4A30-9ACC-1368C9C2E846@iiNet>

/9j/4AAQSkZJRgABAQEASABIAAD/4gVASUNDX1BST0ZJTEUAAQEAAAUwYXBwbAIgAABtbnRyUkdC
IFhZWiAH2QACABkACwAaAAthY3NwQVBQTAAAAABhcHBsAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAA
AADTLWFwcGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtk
c2NtAAABCAAAAvJkZXNjAAAD/AAAAG9nWFlaAAAEbAAAABR3dHB0AAAEgAAAABRyWFlaAAAElAAA
ABRiWFlaAAAEqAAAABRyVFJDAAAEvAAAAA5jcHJ0AAAEzAAAADhjaGFkAAAFBAAAACxnVFJDAAAE
vAAAAA5iVFJDAAAEvAAAAA5tbHVjAAAAAAAAABEAAAAMZW5VUwAAACYAAAJ+ZXNFUwAAACYAAAGC
ZGFESwAAAC4AAAHqZGVERQAAACwAAAGoZmlGSQAAACgAAADcZnJGVQAAACgAAAEqaXRJVAAAACgA
AAJWbmxOTAAAACgAAAIYbmJOTwAAACYAAAEEcHRCUgAAACYAAAGCc3ZTRQAAACYAAAEEamFKUAAA
ABoAAAFSa29LUgAAABYAAAJAemhUVwAAABYAAAFsemhDTgAAABYAAAHUcnVSVQAAACIAAAKkcGxQ
TAAAACwAAALGAFkAbABlAGkAbgBlAG4AIABSAEcAQgAtAHAAcgBvAGYAaQBpAGwAaQBHAGUAbgBl
AHIAaQBzAGsAIABSAEcAQgAtAHAAcgBvAGYAaQBsAFAAcgBvAGYAaQBsACAARwDpAG4A6QByAGkA
cQB1AGUAIABSAFYAQk4AgiwAIABSAEcAQgAgMNcw7TDVMKEwpDDrkBp1KAAgAFIARwBCACCCcl9p
Y8+P8ABQAGUAcgBmAGkAbAAgAFIARwBCACAARwBlAG4A6QByAGkAYwBvAEEAbABsAGcAZQBtAGUA
aQBuAGUAcwAgAFIARwBCAC0AUAByAG8AZgBpAGxmbpAaACAAUgBHAEIAIGPPj/Blh072AEcAZQBu
AGUAcgBlAGwAIABSAEcAQgAtAGIAZQBzAGsAcgBpAHYAZQBsAHMAZQBBAGwAZwBlAG0AZQBlAG4A
IABSAEcAQgAtAHAAcgBvAGYAaQBlAGzHfLwYACAAUgBHAEIAINUEuFzTDMd8AFAAcgBvAGYAaQBs
AG8AIABSAEcAQgAgAEcAZQBuAGUAcgBpAGMAbwBHAGUAbgBlAHIAaQBjACAAUgBHAEIAIABQAHIA
FIT9137
bwBmAGkAbABlBB4EMQRJBDgEOQAgBD8EQAQ+BEQEOAQ7BEwAIABSAEcAQgBVAG4AaQB3AGUAcgBz 43
Two-tier vs Three-tier mail
• Two-tier:
• Client-server architecture

• Client implements application logic, talks to server


using SMTP and POP/IMAP

• Three-tier:
• Thin client accesses web application

• Server handles application logic

• Client accesses server using HTTP

FIT9137 44
HTTP
SMTP <html>…</html>
Hi! How are you?
IMAP FETCH

HTTP
HTTP GET
Hi! /mail.html
How are you? www.hotmail.com

alice@hotmail.com
SMTP Hi! How are you?
IMAP OK FETCH COMP
Internet
smtp.hotmail.com
smtp.gmail.com
bob@gmail.com

POP OK 2 messages SMTP Very well, thanks!


SMTP Very well, thanks!
POP LIST
HTTP
www.hotmail.com
SMTP/
alice@hotmail.com
POP/
IMAP
Internet
smtp.hotmail.com
smtp.gmail.com
SMTP bob@gmail.com
SMTP/POP/IMAP
FLUX Question: Spam
Spam = "Unsolicited Bulk Email"

Estimates:

between 50% and 70% of all emails are spam

How would you solve this problem?

FK2HL1
FIT9137 47
Telnet / SSH

FIT9137
Telnet session

FIT9137 49
Telnet in Wireshark

FIT9137 50
Telnet in Wireshark

t
c
r
e
p
u
s

FIT9137 51
Secure Shell (SSH)

FIT9137 52
Other Applications

FIT9137
File Transfer Protocol (FTP)
• Enables access to a file server over the network

• Requires special FTP client application program

• integrated in web browsers

• stand-alone applications also exist

• Requires special FTP server program

• Supports authentication (user needs to log in)

• Still commonly used for uploading web pages

FIT9137 54
Instant Messaging (IM)
• Examples: WhatsApp, Facebook Messenger, Tencent
QQ, Google Hangouts, Skype, Twitter…

• Client-Server application

• client sends message to server

• server forwards message to receiving client

• Clients are notified of new messages by

• keeping connection open

• polling server periodically

• "push notification" mechanisms


FIT9137 55
Video Conferencing
• Real time transmission of audio and video

• Using special hardware

• often special purpose rooms (like this lecture theatre)

• audio quality often more difficult than video!

• requires high-bandwidth network to ensure quality

• Using PCs, laptops or smart phones

• low cost solution, but often lower quality


FIT9137 56
Lecture Summary
• Application architecture determines how client and
server share the work load (server-based, client-based,
client-server, thin-client-server, peer-to-peer)

• WWW: based on HTML hypertext and URLs,


communicates using HTTP

• Email: SMTP, POP, IMAP, thin-client web mail

• Telnet/SSH: access servers using text-based interface

• Other applications: FTP, IM, video conference

• Important: standard protocols enable interoperability

FIT9137 57
Lab Week 10 Lab Overview

• SMTP

• Analysis HTTP

FIT9137 58
Next week
Network Security
- type of threats

- securing your network

- encryption

- intrusion prevention

FIT9137 59
FIT9137
Introduction to Computer
Architecture and Networks
Week 10: Computer and Network Security

Amin Sakzad and ABM Russel

FIT9137
Unit Topics

FIT9137 2
Today: Network Security
3 Goals

Availability Confidentiality

Integrity

FIT9137 3
Today: Network Security

Protect data from


unauthorised disclosure Confidentiality
• credit card information

• medical records

• private photos

• internal emails

FIT9137 4
Today: Network Security
Make sure data has not been altered or destroyed
• messages are received as sent:

no duplication, insertion, modification, reordering!

• non-repudiation:

cannot deny having sent or received a message

• e.g. bank account balance, student marks

Integrity

FIT9137 5
Today: Network Security

Provide continuous
Availability operation of services
• ATM network

• Stock trading

• Emergency services

• Moodle assignment
submission

FIT9137 6
3 Goals

Availability Confidentiality

Integrity

FIT9137 7
Authentication
Ensure that
• the communicating entities are who they claim to be

• an entity cannot impersonate another entity

Essential for integrity and confidentiality!


Examples
• Monash Authcate

• ATM PIN

• Biometric passports

FIT9137 8
Access Control
Ensure that
• only authorised entities can access systems and
applications

• resource limits are enforced

Relies on authentication!
Examples
• Swipe cards

• Moodle (you can’t see other students’ assignments)

• Disk space on shared computers


FIT9137 9
FLUX Question: Internet Security

Are you using secure mechanisms for accessing your


email?

1. Yes, always.

2. No.

3. I don’t know.

4. I don’t believe any mechanism is secure.

FK2HL1
FIT9137 10
Threats
potential adverse occurrences

that may cause harm

FIT9137
Types of Threats
Availability / business continuity
• loss or reduction of network service

• virus destroying files, hard disk crash

• disaster destroying hardware or network

Intrusion
• unauthorised access to company resources

• e.g. industrial espionage, fraud, blackmail

• unauthorised access often involves employees!

FIT9137 12
Malware - malicious software

Potential targets
• identity theft

• "ransomware": make computer unusable and


demand payment for unlocking

• "adware": display unwanted advertisements

• gaining access to a computer (botnets)

• gather sensitive information (espionage)

FIT9137 13
Malware - malicious software
Viruses
• spread when infected files are accessed

• require human interaction to spread (e.g. opening a


file or program)

Worms
• special type of virus that spreads without human
intervention

• typically uses the network to copy itself from


computer to computer

FIT9137 14
FLUX Question: Malware
Have you been the target of a malware attack?

1. Yes: identity theft



(somebody impersonated me, e.g. on social media)

2. Yes: data loss



(e.g. a virus deleted files)

3. Yes: ransomware/adware

(worm installed itself that showed unwanted ads or asked for
money to unlock computer)

4. No

5. Other FK2HL1
FIT9137 15
Example: Stuxnet
Targeted cyber-sabotage attack
• delay Iranian Uranium enrichment

• achieved by using extremely high-tech worm

• first known cyber-weapon


Source unknown
• most likely government source, lots of speculation

• cost of development estimated at > $1 million

FIT9137 16
Example: Stuxnet

Full video: https://youtu.be/CS01Hmjv1pQ


FIT9137 17
FLUX Question: Security Goals

Which security goal does Stuxnet attack?

1. Availability

2. Integrity

3. Confidentiality

4. Authentication

FK2HL1
FIT9137 18
Example: Carbanak

https://youtu.be/wUU8bAVgx80
FIT9137 19
Security Holes
Flaws in network software
• permit unintended access to the network

• all operating systems contain security holes

Information about security holes


• once found out, usually quickly published

• hackers start exploiting the hole

• security teams try to patch the problem

Zero-day exploits
• hole that is exploited before anybody knows about it

• particularly dangerous, since no patch exists

• Stuxnet exploited four separate zero-day flaws

FIT9137 20
Denial of Service
Flood a server with messages
• server may crash under the load

• or network capacity to server is overloaded so that


legitimate users can’t reach the server

Let’s look at two types


• TCP SYN flood - send TCP SYN but never send the
ACK

• ICMP flood - send broadcast ping messages with


fake source

FIT9137 21
TCP SYN Flood
Send lots of TCP SYNs
• remember 3-way handshake:

client sends SYN

sever sends SYN/ACK

client sends ACK

What if client never sends ACK?


• TCP/IP stack needs to allocate data structures for every
connection

• older TCP/IP stacks may run out of memory - server


crashes

• newer TCP/IP stacks simply won’t accept new connections

FIT9137 22
TCP SYN Flood
Bot under our
control

Target, e.g. web


server

Client, requesting
data

FIT9137 23
ICMP Flood
Send broadcast ping requests with fake source
• you need control of a computer in a large LAN

• send a broadcast ping to all computers in the LAN

• fake your source IP to be the IP of the attack target

• the target gets a ping reply from every computer in


the LAN
Distributed denial-of-service (DDoS) attack
Use the LAN to amplify your attack!

FIT9137 24
ICMP Flood
Bot under our
control

Target, e.g. web


server

Client, requesting
data
ping -s 1000 -fb 10.0.0.255

FIT9137 25
Baidu-GitHub Attack
http://arstechnica.com/security/2015/03/github-battles-largest-ddos-in-sites-history-targeted-at-anti-censorship-tools/

FIT9137 26
Baidu-GitHub Attack Two targets:
github.com/greatfire

Client github.com/cn-nytimes
Insert malicious
HTTP OK
JavaScript

HTTP GET HTTP GET


HTTP
HTTP GET
GET HTTP OK

send repeated GET requests

HTTP OK
HTTP GET
HTTP OK Baidu server
GitHub server
FIT9137 27
Intrusion
Casual intruders
• limited knowledge ("trying doorknobs"), e.g. using neighbours'
WLAN

• script kiddies: novice attackers using hacking tools

Security experts ("hackers")


• motivation: thrill of the hunt, but also to detect vulnerabilities

Criminals ("crackers")
• breaking into computers for espionage, fraud etc

Employees
• use their legitimate access to the internal network

• gain access to information without authorisation


FIT9137 28
Countermeasures

FIT9137
Countermeasures: Physical Security

Prevent physical access to equipment


• limit access to offices, server rooms, hardware

• implement strict access controls to areas where


network equipment is located

• physical security such as locks on power switches

Also remember to secure secondary locations


• e.g. remote backup locations

FIT9137 30
Countermeasures: Malware
Anti-virus software
• checks disk files, emails and running programs

• can remove viruses in some cases

OS updates
• fix security bugs that enable malware to enter a
system

• see e.g. iOS jailbreaking

Firewalls (later today…)


• prevent network access from outside
FIT9137 31
Countermeasures: Malware
http://www.pcworld.com/article/2150743/antivirus-is-dead-says-maker-of-norton-antivirus.html

Anti virus software detects only


45% of all attacks. Only one of
many tools needed to keep
computer safe.

FIT9137 32
Countermeasures: DoS/DDoS
Traffic filtering
• e.g. never reply to broadcast pings

• verify all incoming packets for valid address

Traffic limiting
• when too many packets are coming in, limit the traffic

• this may filter legitimate packets, but may keep the service
accessible

Traffic anomaly detectors


• perform analysis of traffic to see what normal traffic looks like

• block abnormal patterns

FIT9137 33
Firewalls
Prevent intrusion by securing the perimeter
• no unauthorised access to machines inside your network

• secure basic access vectors: Internet, LANs, WLANs

Firewall
• can be router, special purpose computer, or client software

• examines packets flowing into and out of an organisation's


network

• can filter and log suspicious packets

Main types
• packet-level firewalls (packet filters)

• application-level firewalls
FIT9137 34
Packet-level firewall
Examines headers of every packet passing through
• defines rules to determine which packets are
acceptable

• can make decisions based on source or destination


IP or port addresses

Access Control List (ACL)


• a set of rules for a packet-level firewall

• can be used to permit or deny packets into a network

FIT9137 35
Application-level firewall
Examines application-layer packet contents
• can scan for known attacks on application-layer
server software

• example: scan for viruses in email attachments sent


via SMTP

Compared to packet-level
• more computationally expensive

• more difficult to set up

• more resource intensive

FIT9137 36
DMZ
De-Militarized Zone
• A part of a company network that is accessible from
the Internet

• Not as heavily protected as the company intranet

• But allows access to e.g. web, e-mail, DNS servers

FIT9137 37
DMZ

FIT9137 38
Example: iptables
Implements packet-level filtering in the Linux kernel
• configure using the iptables command

Five pre-defined chains:


• PREROUTING: for packets before routing decision

• INPUT: for packets going into firewall machine itself

• FORWARD: for packets forwarded by firewall machine

• OUTPUT: for packets leaving firewall machine

• POSTROUTING: for packets after routing decision

You can define rules for each chain.


FIT9137 39
Example: iptables
iptables -F
• remove all existing rules

iptables -P INPUT DROP


• set default policy of INPUT chain to DROP

• applies when no other rule matches

iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT


• Add a new rule to the FORWARD chain

• Applies to all packets coming in on eth0 and being


forwarded to eth1

• Set the policy to accept these packets

More examples in the lab.


FIT9137 40
Example: fail2ban
Intrusion detection
• monitor system log files and analyse login attempts

• works with any service that logs failed logins, e.g.


ssh, http

Intrusion prevention
• after 5 incorrect logins, add IP to firewall for an hour

• after 20 incorrect logins, block IP for a week

• limits number of attempts possible from a single IP

FIT9137 41
Example: fail2ban
detected
intrusion
attempts

firewall rules:
DROP packets
from intruders

simulated

attack

FIT9137 42
Encryption

FIT9137
Encryption
Our only tool to ensure confidentiality and integrity!
• disguise information using mathematical rules

• based on a key used for encryption and decryption

• sender encrypts message with a key

• receiver needs to know a key to decrypt

Strength of an encryption
• if key is random and same length as the message, it is
provably impossible to recover the message without
the key

• practical systems are only very unlikely to be broken


FIT9137 44
Encryption Example
Plaintext This is a message I want to send
Key MySecretKey MySecretKeyMySecretKey
Ciphertext 'gB^ca^t2el 8rLLP]eCKb`AsS_Xr^_?O

(plaintext + key) % 255

'gB^ca^t2el8rLLP]eCKb`AsS_Xr^_?O
MySecretKey MySecretKeyMySecretKey
This is a message I want to send
(ciphertext - key) % 255

Symmetric encryption: both parties use the same key!

FIT9137 45
Symmetric Encryption
Data Encryption Standard (DES)
• developed by US government and IBM

• 56 bit keys can now be broken by brute force in a day!


• should not be used any more

Other standards
• 3DES (triple DES): effectively 168 bit key

• AES (Advanced Encryption Standard) uses 128, 192 and


256 bit keys

• RC4, IDEA, Blowfish

FIT9137 46
FLUX Question: Brute Force
The 56 bit DES encryption standard was broken by a $10,000 machine
in less than a day with a brute force attack (trying all possible keys).

How long, do you think, would it take to break a key with 100 bits
using the same hardware?

1. A month

2. A year

3. 10,000 years

4. 13 billion years (age of the universe)

5. even longer FK2HL1


FIT9137 47
Sharing Secrets
How do we share a secret?
• need a secure communications channel

• chicken-and-egg problem…

Ingenious idea: Diffie-Hellman key exchange


• Alice and Bob each have a secret key

• They each construct a public key that can be shared


over an insecure channel

• From their own secret key and the other’s public key,
they can generate a shared secret!

FIT9137 48
Diffie-Hellman, Paint Analogy
Alice Bob
base colour

secret colours

FIT9137 49
Diffie-Hellman, Paint Analogy
Alice Bob
base colour

secret colours
difficult to
“unmix”, so
Alice still mix base and secret

doesn’t know to make public colour
Bob’s secret
mix contains mix contains
base + both public colours are
base + both
secrets exchanged
secrets

mix public and secret



to make shared secret

FIT9137 50
Public-Key Cryptography
Key exchange
• Alice and Bob can create a shared secret by
exchanging only publicly available information

• As long as it is difficult to “unmix” the public key, i.e.,


reconstruct the private key, the system is secure

Maths
• we need a mathematical operation that is hard to
reverse (to “unmix”)

• in practice: integer factorisation, discrete logarithm,


elliptic curves

FIT9137 51
Maths
1. Alice and Bob agree on a value g=5 (can be public) and
prime modulo p=23

2. Alice generates random A=4 and computes g raise to


power A and take modulo p=23, (a=5^4 %23 = 4)
Bob generates random B=3 and computes g raise to
power A and take modulo p=23, (b=5^3 %23 = 10)
4. They exchange a and b
5. Alice computes KA = 10^4 %23 = 18
Bob computes KB = 4^3 %23 =18
Now KA = bA = (gB)A = gBA = gAB = (gA)B = aB = KB
FIT9137 52
Maths

All modulo p, we have


KA = bA = (gB)A = gBA = gAB = (gA)B = aB = KB
Why does this work?
A and B are secret values (only a and b are public).

An attacker would have to compute A from a=gA


This is called the discrete logarithm, and it’s very difficult
to compute modulo p!

FIT9137 53
Asymmetric Encryption
Also known as Public Key Encryption (PKE)
• uses pair of public and private keys

• Diffie-Hellman is one example

• examples: RSA (named after inventors Rivest, Shamir,


Adelman), X.509 (e.g. in TLS)

Characteristics
• longer keys than symmetric (512 bits to 2048 bits)

• enables completely new applications because


communicating parties need no secure channel to
exchange keys
FIT9137 54
Authentication
Provide proof identifying the sender
• important for legal transactions

• digital signatures

Use PKE in reverse:


• in PKE, public key is used for encryption, private key
for decryption

• for digital signatures: private key is used for


encryption, public key for decryption

• sender encrypts their signature with own private key,


receiver decrypts it using sender's public key!
FIT9137 55
Secure Web

FIT9137
Transport Layer Security (TLS)

can be used by
POP, IMAP, any other… HTTPS
other application HTTP
TLS

Transport (TCP)
add security layer
Network (IP)
between TCP and
application Data Link (Ethernet)

Physical

FIT9137 57
SSL/TLS
SSL (Secure Sockets Layer)
• originally developed by Netscape

• version 2.0 (1995), version 3.0 (1996)

TLS
• IETF standardised successor to SSL as TLS 1.0
(1999)

• Current version is TLS 1.2

• All previous versions have security problems and


should not be used!

FIT9137 58
How TLS works

Provide confidentiality and integrity/authenticity


• strong encryption using a shared key

Two phases or sub-protocols:


• TLS handshake: authenticate client and server,
establish shared key

• TLS record: send encrypted data

Use Diffie-Hellman key exchange to create shared key

FIT9137 59
Authenticating web servers
How do we know this is really the
Monash server?

It uses a certificate to prove its


authenticity.
FIT9137 60
Public Key Infrastructure (PKI)
How can you trust that a public key is authentic?
• Have a trusted third party sign it
• Trusted third party: certificate authority (CA)
• And if you don’t trust the CA?

• Have it’s key signed by another CA: chain of trust


• Your web browser contains root certificates that it trusts.
PKI is an entire ecosystem
• hardware, software, people, policies…

• organises creation, storage and revoking of certificates

FIT9137 61
WannaCry
Ransomware attack, May 2017

FIT9137
WannaCry ransomware
Attack started on 12 May 2017
• Targets computers running Windows

• Exploits a vulnerability in Microsoft’s SMB protocol (used for


file sharing on a local network)

• Computer gets infected through phishing email

• Around 200,000 systems infected

What does it do?


• Encrypt files on computer’s hard disk

• Spread to other computers in LAN through SMB vulnerability

• Request payment via bitcoin


FIT9137 64
WannaCry

Things to think about:


• Was this a zero-day exploit?

• Was this a targeted attack?

• How could it have been prevented?

• Who is to blame?

FIT9137 65
Summary
Security is important
• billions of dollars at stake

• attacks are frequent

Goals
• confidentiality, integrity, availability

Countermeasures to threats
• physical security

• firewalls

• encryption
FIT9137 66
Lab Week 11 Lab Overview

• Encrypting Files

• Public Key Encryption

• Firewalls/DMZ

FIT9137 67
Next week
Backbone networks
- how to connect LANs

- Virtual LANs (VLANs)

MANs and WANs


- how to connect different parts of a company

- lease lines

- Virtual Private Networks (VPN)

FIT9137 68
FIT9137
Introduction to Computer
Architecture and Networks
Week 11: Backbones, MANs and WANs
Amin Sakzad and ABM Russel

FIT9137
Unit Topics

FIT9137 2
Today
Backbone networks
• Connecting LANs

• Based on switches

• Virtual LAN

Wide Area Networks


• Circuit-switched, dedicated circuit, packet-switched

• Virtual Private Networks

FIT9137 3
Backbone Networks

FIT9137
Backbone Networks
High speed links between LANs
• owned and operated by the company

• enables communication between different LANs

• provides connections to other backbones, MANs,


WANs, and the Internet

Technology
• high-speed physical layer (often optical fibre)

• switches and/or routers

FIT9137 5
Switched Backbone
Floor Ethernet Switch

(Access Layer)

Building Distribution
Switch

(Distribution Layer)

Precinct Switch

Precinct Router
 (Core Layer)
(Core Layer)
FIT9137 6
Switched Backbones

Access +
distribution

in one rack

FIT9137 7
Switched Backbones

FIT9137 8
Switched Backbones

Rack-mounted switched
backbone
+ easy access for
maintenance and
upgrades

- requires more cable

FIT9137 9
Rack-mounted switches

patch
cables

switches

Monash
communications
cabinet,

Bldg. H level 6

FIT9137 10
Rack-mounted switches

FIT9137 11
Rack-mounted switches

FIT9137 12
Backbone

FIT9137 13
FLUX Question: Large Subnets
What is a disadvantage of large switched backbones?

1. Since Ethernet uses a shared medium, all frames are


delivered to all devices, increasing traffic.

2. Broadcasts (such as ARP) have to be transmitted through


the whole network, increasing traffic.

3. Servers are placed in the same subnet as clients, which


should never be done (remember last week).

4. It’s a security risk, because everyone is part of the same


network.
FK2HL1
FIT9137 14
FLUX Question: Routed Backbones
What are disadvantages of routed backbones?

1. IP addresses have to be assigned by location, not by


function.

2. Routers introduce more latency than switches.

3. Routers are broadcasting all frames, while switches have


forwarding tables so they only transmit to the destination
device.

4. Routers only work for TCP traffic (they are layer-4


devices), while switches can also handle other protocols.

FIT9137 15
Virtual LANs

FIT9137
Virtual LANs (VLANs)
One switch - multiple subnets
• subnets configured in software (switch OS)

• each port (network jack) can be assigned to a


particular subnet

• hundreds of computers connected to a single switch

Multiple switches - multiple subnets


• switches connected with each other

• move packets between VLANs

FIT9137 17
Multi-switch VLAN
Multi-switch VLAN-Based Subnets

…:aa:00:03
…:aa:00:50
VLAN ID: 20 IP: 179.58.20.1
VLAN ID: 10 IP: 179.58.10.1
VLAN ID: 30 IP: 179.58.30.1 …:aa:00:03
VLAN ID: 30
VLAN tag 10 IP: 179.58.30.7

trunk
Internal Network
179.58.0.0/24 VLAN ID: 20
IP: 179.58.20.11

…:aa:00:50

FIT9137 Note: Figure 7.13


Topic Notes: The Backbone and Virtual LANs 15
18
Multi-switch VLAN
Multi-switch VLAN-Based Subnets
…:aa:00:42
10
179.58.10.102
 …:aa:00:02
…:aa:00:02
VLAN ID: 20 IP: 179.58.20.1
VLAN ID: 10 IP: 179.58.10.1
VLAN ID: 30 IP: 179.58.30.1
179.58.10.102
179.58.10.102

VLAN ID: 30
30 IP: 179.58.30.7
…:aa:00:42

Internal Network
179.58.0.0/24 VLAN ID: 20
IP: 179.58.20.11

FIT9137 Note: Figure 7.13


Topic Notes: The Backbone and Virtual LANs 15
19
VLAN - Broadcasting
Multi-switch VLAN-Based Subnets

VLAN ID: 20 IP: 179.58.20.1


VLAN ID: 10 IP: 179.58.10.1
VLAN ID: 30 IP: 179.58.30.1
VLAN ID: 30
IP: 179.58.30.7
Who has 179.58.10.1? Who has 179.58.10.1?

Internal Network
179.58.0.0/24 VLAN ID: 20
IP: 179.58.20.11

10 Who has 179.58.10.1?


Who has 179.58.10.1?

FIT9137 Note: Figure 7.13


Topic Notes: The Backbone and Virtual LANs 15
20
VLAN advantages
Subnets organised by function
• servers can be placed in LANs even if they are in a
different building

• when people move office they can keep their IP


addresses (just reconfigure the switch)

Limited broadcasting
• compared to switch-only backbones

• broadcasts are only sent to the same subnet

Efficient
• faster, cheaper, easier to configure than routing
FIT9137 21
How does it work?
Switches insert 802.1Q tag


preamble


 start of dest. 802.1Q



sourcelength

Data FCS

frame address
tagor type
address

7 1 6 6 4 2 46-1500 4
• tag contains VLAN ID + priority code

• VLAN ID is 12 bits (4096 VLANs)

Switch configuration
• network admin defines which VLANs span which
switches, and how switches are connected (trunks)

FIT9137 22
FLUX Question: QoS
Which of the following would benefit from the priority code in
802.1Q?

1. Allocating more bandwidth to the wired LAN than to the


wireless LAN

2. Making sure that the SMTP Priority header can be


implemented (marking emails as normal, urgent or non-
urgent)

3. Enabling better error correction to improve the quality of


service

4. Attaching VoIP phones to switches FK2HL1


FIT9137 23
Wide Area Networks
(Metropolitan Area Networks are basically the same…)

FIT9137
When use a WAN?
Connecting campuses
• need reliable, high-speed circuits

• connect backbones and LANs to form a single


company network

Why not build your own?


• you need a license to run cables across public land

• much more efficient to lease circuits from carriers

Why not use the Internet?


• security, reliability, performance

• but it’s an option (we’ll come to that)


FIT9137 25
Circuit-switched
Use existing telephone network
• circuit established by dialling

• pay for time connected to circuit

• very low data rates (56kbps analog, 64kbps ISDN)

Almost completely replaced by


• dedicated circuit

• packet switched

FIT9137 26
Dedicated Circuits
Leased full duplex circuits
• creates point-to-point link between locations

• guaranteed transmission characteristics



(bandwidth, latency)

• routers and switches used to form a network

Providers
• common carriers (e.g. Telstra, Optus)

• typically billed at a flat monthly fee

• T carrier, SONET, Metro Ethernet services


FIT9137 27
Dedicated Circuits
LAN
LAN

CSU/DSU

Common
Carrier Network

CSU/DSU

LAN LAN

FIT9137 28
T-Carrier Services
US standard for leased dedicated circuits
• introduced in 1961 for telephone services

• you should at least know about them (often referred to


when talking about transmission speeds)

Units
• T-1 (1.544 Mbps) = 24 simultaneous 64kbps channels,
each channel can carry a phone call

• T-2: multiplexing of 4 T-1 circuits

• T-3: multiplexing of 28 T-1 circuits

• T-4: multiplexing of 178 T-1 circuits


FIT9137 29
Synchronous Optical Network (SONET)

ANSI standard for optical fiber transmission


• Gbps transmission speeds

• co-existing ITU-T standard:



SDH (synchronous digital hierarchy)

“Hierarchy”
• OC-1 = 51.84 Mbps

• OC-X = X * 51.84 Mbps (e.g. OC-48 = 2.488 Gbps)

FIT9137 30
WAN Packet Switched Services
Ethernet or other
packet-switched LAN
LAN protocol

PAD

Point-of-
presence
Common (POP)
Carrier Network

PAD

LAN packet assembly/ LAN


disassembly

FIT9137 31
Packet-switched WAN
No dedicated circuit
• carrier operates a packet-switched network

• customers can send packets through that network

• travel together with packets of all other customers


through the same circuits

Connectionless vs connection-oriented
• similar to UDP vs TCP

• connectionless just sends packets to a destination

• connection-oriented establishes a virtual circuit


FIT9137 32
Packet-switched Data Rates

Committed Information Rate (CIR)


• Guaranteed minimum data rate for virtual circuit

• Packets sent at rates exceeding CIR are marked as


discard eligible (DE)

• DE packets are discarded if network is overloaded

Maximum Allowable Rate (MAR)


• Packets sent exceeding this rate are dropped

FIT9137 33
Packet-switched standards
X.25
• oldest packet-switched standard (slow, up to 2Mbps)

• layer-2 service (similar to HDLC) + own layer-3 protocol

• reliable (performs error control)

Frame Relay
• unreliable connection (no error control)

• encapsulates packets

• has own layer-3 protocol

ATM (Asynchronous Transfer Mode)


• similar to Frame Relay

• but has QoS information

• typically SONET at layer-2 (faster than Frame Relay)


FIT9137 34
Ethernet MAN/WAN

“Carrier Ethernet”
• same technology as in LAN

• no extra hardware (PAD or CSU/DSU) needed

• slower than fastest ATM but cheaper (can still reach


10Gbps)

FIT9137 35
Virtual Private
Networks

FIT9137
Virtual Private Networks
Use Internet as the Packet Switched Network
• easily available

• low cost due to lots of competition

• flexible

How does it work?


• software simulates “virtual NIC”

• packets are encapsulated, then sent through Internet

• receiver unpacks, then sends into LAN

Nothing to do with Virtual LAN!


FIT9137 37
Virtual Private Networks
encapsulate &
encrypt
Hello!
LAN
LAN
$U1&x#3
Hello! VPN gateway
VPN gateway Internet
Service
Provider

VPN “tunnel” Internet

LAN LAN

FIT9137 38
Types of VPNs
Intranet VPN
• connect LANs of the same organisation

• uses special VPN gateway devices

Extranet VPN
• connect different organisations (e.g. a company with its
customers)

• same technology as intranet

Access VPN
• allows employees to access company intranet over the Internet

• uses special gateway at the company + simple client software for


the employees

• Monash offers an Access VPN


FIT9137 39
Using the Monash VPN

Example: access library resources


• Monash has subscriptions to many online journals

• access is restricted to Monash IPs: 130.194.X.X

• using VPN, you get a Monash IP!

Example: access Monash servers


• you may have used this to access the SQL servers for
FIT9132

FIT9137 40
VPN Demo

FIT9137 41
VPNs to “teleport” your IP address
VPNs to “teleport” your IP address
• companies want to restrict access to services based
on location

• since location information is generally not available,


they use the IP address as a proxy

FIT9137 42
VPNs to “teleport” your IP address
VPNs to “teleport” your IP address
• companies want to restrict access to services based
on location

• since location information is generally not available,


they use the IP address as a proxy

FIT9137 43
VPNs to “teleport” your IP address
VPNs to “teleport” your IP address
• companies want to restrict access to services based on
location

• since location information is generally not available, they


use the IP address as a proxy

• a VPN can change your “perceived” location

Very, very popular


• survey by Swinburne Univ. found 20% of Australians use
this kind of service!

• Before Netflix started in Australia, it had already 200,000


subscribers here! (They had to use VPN)
FIT9137 44
IPsec - Internet Protocol Security
192.168.10.20
Layer 2 for e.g. ADSL
IP TCP HTTP www.youtube.com
LAN
PPP IP UDP ESP

Encapsulating
Security
Payload

Necessary to get through


some firewalls

Addressed to destination
VPN gateway
LAN
192.168.10.68
FIT9137 45
IPsec - Internet Protocol Security
192.168.10.20
LAN
PPP IP UDP ESP IP TCP HTTP www.youtube.com

LAN
192.168.10.68
FIT9137 46
IPsec - Internet Protocol Security
192.168.10.20
LAN

IP UDP ESP IP TCP HTTP www.youtube.com

LAN
192.168.10.68
FIT9137 47
VPN
Advantages Disadvantages

Low cost No performance guarantees

Introduces overhead (encryption,


Easy setup
encapsulation)

Secure Many incompatible standards

Flexible (endpoints can move)

FIT9137 48
MAN/WAN Design
Evaluate demand
• required data rates

• required reliability (VoIP? Video conferencing? Mainly file


transfers?)

• Network integration (Ethernet?)

Design practices
• Start with flexible packet switching service (possibly VPN)

• Move to dedicated circuit service if high bandwidth


required (and cost effective)

• May use both (packet switched as backup)


FIT9137 49
Changing Technology
Backbones
• High-speed circuits (10Gbps) now standard

• VLAN provides flexibility and better performance for backbone


networks

MAN/WAN
• Metro Ethernet very competitive compared to leased lines

• VPN becoming widely used

Your role in industry


• Most communication now based on Ethernet + WAN

• Network manager roles merged with telecommunication


managers

FIT9137 50
Summary
Backbone networks
• core, distribution, access layers

• collapsed backbones (rack-mounted)

• VLAN

MAN/WAN
• dedicated circuit, packet-switched, VPN

• moving towards Carrier Ethernet

VPN
• create secure “tunnels” through the Internet
FIT9137 51
Lab Week 11 Lab Overview

• Virtual LANs

• Virtual Private Networks

FIT9137 52
Next week
The Internet

FIT9137 53
FIT9137
Introduction to Computer
Architecture and Networks
Week 12: The Internet
Amin Sakzad and ABM Russel

FIT9137
Unit Topics

FIT9137 2
Recap
We've seen all the technology!
• LANs are built using circuits and switches (Ethernet)

• Connected by routers to backbones

• Autonomous Systems are large collections of LANs,


BNs and MANs

• Connected by routers (using BGP) to form the


Internet

• Users connect via DSL, WiFi, 4G, 5G

• Applications built on top of TCP/IP

FIT9137 3
Today
How to access the Internet
• DSL, wireless technologies, NBN

• Network Address Translation

The structure of the Internet


• Governance, POPs, IXPs, peering

Why does the Internet still work?


• Content delivery networks, load balancing, caching

The Internet of the future


• More devices, more mobile, more bandwidth - more
surveillance?
FIT9137 4
Accessing the Internet

FIT9137
FLUX Question: Internet Survey
How do you access the Internet?

(multiple answers possible)

1. ADSL

2. Cable modem

3. 3G/4G/LTE/5G

4. NBN

5. Only at Monash
FK2HL1
FIT9137 6
ADSL
Recall ADSL
• asymmetric: much more bandwidth for download
than for upload (crosstalk!)

• up to 24 Mbps

New developments
• VDSL: eliminate crosstalk in the DSLAM (like noise-
cancelling headphones), up to 100 Mbps

• Fibre-to-the-node: shorten the distance between


DSLAM and DSL modem (node = less than 1km from
customer)
FIT9137 7
Cable Internet
Hybrid Fibre Coaxial (HFC)
• Fibre backbone network

• Coaxial distribution to customers

Based on cable TV network


• Data Over Cable Service Interface Specification (DOCSIS)

• shared multi-point coaxial cable

• typically hundreds of customers on one cable

This must be bad, right?


• shared bandwidth

• privacy issues (your neighbour could run Wireshark)


FIT9137 8
Cable Internet
Comparison with ADSL
• coax has much higher bandwidth!

• maximum downstream (DOCSIS 3.0): 10 Gbps

• shared with 100 customers: guaranteed 100 Mbps

What about security?


• DOCSIS provides MAC-layer encryption

• also used for authentication (only paying customers


can use the service)

FIT9137 9
Wireless Internet
Long Term Evolution
• upgrade path for mobile operators from 2G/GPRS over 3G/UMTS to 4G

• up to 300Mbps download/75Mbps upload

• supports devices moving at up to 500 km/h

• all-IP network: no separate voice channel

LTE Advanced
• fully satisfies 4G standard set by ITU-T

• (theoretically) more than 3 Gbps

5G
• Multiplexing technologies

• (theoretically) more than 10 Gbps

• networks operational in Australia

FIT9137 10
22.5

7.5
15
30

0
Mbps
 South Korea
 Hong Kong

FIT9137
 Japan
  Switzerland
 Sweden
 Netherlands
 Ireland
 Czech Republic
 Singapore
 Finland
 United States
 Belgium
 Israel
 Norway
 Romania
 Denmark
 United Kingdom
 Austria
 Canada
 Taiwan
 Russia
 Hungary
 Germany
 Poland
 Slovakia
 Portugal

Source: Akamai State of the Internet Report 2014


 Spain
 New Zealand
 Australia
 France
 Thailand
 Italy
Australia

 Turkey
 Uruguay
 United Arab Emirates
 Argentina
 Mexico
 Malaysia
 Chile
 China
 Indonesia
 Ecuador
 Peru
 South Africa
 Colombia
 Brazil
 Panama
 Costa Rica
 Philippines
 Vietnam
 India
 Venezuela
 Paraguay
 Bolivia
World Ranking of Internet Access Speed

11
NBN
Australia is building a National Broadband Network
• Fibre optic backbone (Gigabit Passive Optical
Network - GPON)

FIT9137 12
Passive Optical Networks
Use unpowered optical
splitters
• cheaper to deploy

• more reliable (not


affected by e.g. water
damage)

• downstream traffic
broadcast to all
customers

Image source: Wikipedia


FIT9137 13
NBN

retail
service
providers
owned by ISPs

121 points of
interconnect
owned and
operated by
NBN

network
termination
device

Image source: Wikipedia


FIT9137 14
NBN Wholesale Market

https://www.accc.gov.au/regulated-infrastructure/
communications/national-broadband-network-nbn/nbn-
wholesale-market-indicators-report/march-quarter-2020-
report

FIT9137 15
NBN
Australia is building a National Broadband Network
• Fibre optic backbone (Gigabit Passive Optical
Network - GPON)

• Customer connection:

• Fibre-to-the-premises (for new developments)

• Fibre-to-the-node (plus VDSL/HFC)

• Fixed wireless (LTE)

• Satellite (for remote areas)

• Current estimates: $46b-$56b, finished by 2020

FIT9137 16
Speedtest Global Index

Source: https://www.speedtest.net/global-index
FIT9137 17
The IPv4 problem

FIT9137
The IPv4 problem
Number of people accessing the Internet:
• current estimates: 2.8 billion

Number of available IPv4 addresses:


• even very optimistically: 3.5 billion

How many devices do you have with an IP address?


• private laptop, smart phone, tablet, work computer

• plus all the servers!

We simply don’t have enough IP addresses.

FIT9137 19
The IPv4 problem
Possible solutions:
• Move to IPv6 (but that’s not possible yet as a general
solution)

• DHCP: re-use addresses if not all devices need to be


online at the same time

• Virtual Hosting: several DNS names mapping to the same


IP address (and hosted by the same server)

• Use private networks.



The following addresses are not routed on the Internet:

10.0.0.0/8

172.16.0.0/12

192.168.0.0/16
FIT9137 20
Network Address Translation (NAT)
Idea: connect private network to the Internet

Port Dest
192.168.1.10
3528 192.168.1.10:123
S:192.168.1.10:123 156.45.12.32
192.168.1.1
S:156.45.12.32:3528
D:192.168.1.10:123

NAT firewall
router
192.168.1.11

private network
FIT9137 21
NAT in practice
Every WiFi modem/router does NAT
• ISP assigns you a single IPv4 address

• WiFi router lets you connect multiple devices

• Often uses 192.168.1.0/24 or 10.0.0.0/8 private


network

Advantages
• Partially solves IPv4 address problem

• Firewalls have improved home network security

FIT9137 22
Problems with NAT
Hosts have private IP
• you cannot (easily) run a server

• computers outside the NAT cannot easily connect to


computers inside

The port numbers are changed


• an application only knows its internal port number, but
not the port number after NAT

• difficult for e.g. peer-to-peer file sharing

• workaround: NAT uses same port for external if not


already in use
FIT9137 23
FLUX Question: NAT
How many computers can you put behind a NAT?
FK2HL1

1. As many as you have addresses in the private subnet (e.g.


when using 10.0.0.0/8, you can have around 16 million hosts
behind the NAT)

2. As many as there are port numbers (which are 16 bit, so


around 65,000 hosts)

3. As many as your WiFi router can handle (typically less than


100)

4. It depends on the number of connections, not the number of


hosts (typically thousands of connections are possible)

FIT9137 24
The IPv6 transition

FIT9137
DNS and IPv6
What

 should www.google.com map to?

$> dig www.google.com any

;; QUESTION SECTION:

;www.google.com. IN ANY
 IPv4 record

;; ANSWER SECTION:

www.google.com. 27 IN A 203.13.161.91

www.google.com. 3 IN AAAA 2404:6800:4006:801::2004

IPv6 record

FIT9137 26
Dual stack systems
Preferred
One device running IPv4 and IPv6 simultaneously
mechanism for
transition!
• routers: deal with both IPv4 and IPv6 traffic

• servers: can still serve content to v4-only networks

• clients: can access any service, independent of


whether it is v6-ready

Requirements
• clients and servers must be connected to dual-stack
routers

• may need some application-level software to be


rewritten
FIT9137 27
6to4
Automatic tunnelling
• Used by two IPv6 devices to communicate over an IPv4
network

• Let’s say our router has IPv4 address 130.194.76.26

• In hex that would be 82c2:4c1a

• The router can create an IPv6 network 2002: 82c2:4c1a::/48,


where the 2002 prefix identifies 6to4

• Any IPv6 device in the router’s network can send IPv6 traffic
to the router, which will forward it to another router using IPv4

• That other router must be a well-known 6to4 relay that can


insert the traffic into the IPv6 network

FIT9137 28
6to4

IPv6 6to4 router


“island”

IPv6 IPv6
tunnelled in “island”
IPv4
IPv4
Internet 6to4 relay

IPv6
Internet
29

FIT9137
The Structure of the
Internet

FIT9137
Internet Structure
The network of ISPs
• We’ve seen how you connect to an ISP

• How are they connected with each other?

Hierarchy of ASs
• Each ISP operates an AS

• Routing information shared between ASs using BGP

• ISPs connect at IXPs

FIT9137 31
Internet Structure
Tier 3 ISP
Internet
Tier 3 ISP Exchance Point
Tier 2 ISP Tier 1 ISP
Tier 2 ISP
IXP

Tier 1 ISP Tier 1 ISP


Tier 2 ISP Tier 1 ISP
smaller ISP IXP

routes via Tier 1 ISP Tier 1 ISP Tier 2 ISP


larger
Tier 2 ISP
ISP

Tier 3 ISP
Tier 2 ISP Tier 2 ISP
Tier 2 ISP
Tier 2 ISP
Tier 2 ISP Tier 2 ISP
IXP
Tier 3 ISP Tier 2 ISP
Tier 2 ISP
Tier 3 ISP Tier 3 ISP
Tier 2 ISP

Tier 3 ISP
Tier 3 ISP Peers
Tier 3 ISP Tier 3 ISP
Tier 3 ISP
Tier 3 ISP
Tier 3 ISP

FIT9137 32
Peering
Tier-1 ISPs
• Large ISPs with large WANs

• Charge smaller ISPs for routing their traffic

Peering agreement between two ISPs


• accept each other’s traffic without charge

• usually because both are similar size (similar amount of traffic)

• connect at an IXP

IXP
• provides the hardware for several ISPs to connect

• often owned by a consortium of ISPs


FIT9137 33
FLUX Question: IXP
What kind of network devices are used to build IXPs?

1. Hubs:
 FK2HL1
all peers need to talk to each other

2. Switches:

peers need a layer-2 connection

3. Routers:

the traffic must be routed from one ISP to the other

4. NAT Firewalls:

the network addresses must be translated from one ISP to
the other

FIT9137 34
Inside an IXP

FIT9137 35
Inside an IXP
Logical Topology: Partial Mesh between peering ISPs

FIT9137 36
Inside an IXP
Physical Topology: star

FIT9137 37
Who owns the Internet?
We already know:
• Network of Autonomous Systems owned by
individual organisations

Better question: who makes the decisions?

FIT9137 38
Internet Governance
No single organisation governs the Internet
ISOC (Internet Society)
• Internet Architecture Board (IAB)

• Internet Engineering Task Force (IETF)

• Internet Engineering Steering Group (IESG)

• Internet Research Task Force (IRTF)

ICANN (Internet Corporation for Assigned Names and Numbers)


• Responsible for e.g. IP addresses and host names

IGF (Internet Governance Forum)


• Annual meetings of all stakeholders

ITU (International Telecommunication Union)


• Mostly hardware standards (e.g. DSL, 4G, 5G)
FIT9137 39
Delivering Content
over the Internet

FIT9137
The problem
The Internet has grown

FIT9137 41
The problem
The Internet has grown
• not only the number of hosts, but also their distance

• many applications rely on low latency



(video, streaming music, modern web sites)

• some services have millions of users

• the main protocols (HTTP, TCP/IP and BGP) were not


designed for this growth

So why does it still work?


• Load balancing

• Content Delivery Networks (CDNs)


FIT9137 42
Load Balancing
Many services impossible for single server
• Google processes over 40,000 search queries per
second

• 6000 tweets are sent per second

• Netflix streams around 10.2 Tbps on average

Spread load over multiple servers


• DNS-based: host name maps to multiple IPs

• Special hardware: load balancer accepts requests,


routes them to different servers

FIT9137 43
DNS-based load balancing
Inside Monash network:
• PING www.google.com (216.58.220.132)

64 bytes from 216.58.220.132: time=13.752 ms

From Optus network:


• PING www.google.com (74.125.237.209)

64 bytes from 74.125.237.209: time=52.074 ms

From Germany:
• PING www.google.com (173.194.112.176)

64 bytes from 173.194.112.176: time=1.43 ms

From France:
• PING www.google.com (74.125.21.105)

64 bytes from 74.125.21.105: time=104 ms

FIT9137 44
Dedicated Load Balancer

FIT9137 45
Content Caching
Store web data closer to users
• replicate web pages etc. in caches

• can be implemented transparently:

• user makes request

• router on path to server queries cache engine

• if content available (and not out of date), serve from local


cache

This is explicitly supported by HTTP


• GET requests can be cached

• HTTP headers can contain Expires: field

• Cache only serves GET requests that are not expired


FIT9137 46
Content Delivery Networks (CDNs)
Load balancing only solves half the problem
• once the requests arrive in your network, you can
distribute them to all your servers

• but the requests and responses need to be routed


through the Internet

CDNs
• operate servers in multiple locations

• operate their own high-bandwidth network

• locate points of presence close to end users

FIT9137 47
CDN explained by Akamai

https://youtu.be/IHEFubEQbMo
FIT9137 48
CDNs and Peering
Get close to your customers
• improves user experience (fast page load times)

• network inefficiencies are not blamed on you

CDNs are present at IXPs


• peer with anybody for free

• small ISPs avoid paying e.g. for YouTube content


downloaded from the upstream ISP

• Example: Netflix peers with Australian ISPs, which


can offer “unmetered” access

FIT9137 49
The Internet of the
(near) Future

FIT9137
It’s all IP
Integration
• 4G mobile networks are IP-only

• fixed line phones are disappearing, replaced by VoIP

• all services delivered over IP: data, media, telephony

What does this mean?


• more and more services depend on the Internet

• but Internet architecture is based on trust:



better don’t mess up the BGP routing configuration…

• do we need a backup network, a plan B?


FIT9137 51
It’s all IP

http://www.ted.com/talks/danny_hillis_the_internet_could_crash_we_need_a_plan_b
FIT9137 52
Mobile
Mobile access is growing fast

2019:

> 60 ExaBytes / month

2014:

<20 ExaBytes / month

Global mobile data as measured by Ericsson


FIT9137 53
Mobile
Mobile access is growing fast
• users expect high performance and availability

• in emerging markets mobile is often easier to deploy

What does that mean for us?


• need to make sure network services work on all
devices

• location-based services become more and more


important

• security and privacy become bigger issues

FIT9137 54
Internet of Things
Connect all devices
• home automation (lights, heating)

• energy (smart meters, smart grid)

• environmental sensors

• medical sensors

• sensors on cars, trains

• fully integrated manufacturing equipment

How can this work?


• IPv6

• machine-to-machine communication
FIT9137 55
https://www.ted.com/talks/marco_annunziata_welcome_to_the_age_of_the_industrial_internet
Security in the IoT
“The S in IoT stands for Security”
• IoT devices target mass market and need to be cheap

• Typical application: switch off the lights remotely, or


turn up the heating before you arrive home

• Devices must expose interface to the Internet


• Often do not even have the most basic security

• Easy target for hackers!

FIT9137 57
Dyn DDoS attack
Attack target: Dyn DNS servers
• Result: no DNS requests were answered

• Lead to unavailability of many major web sites in America


and Europe (Twitter, Amazon, Spotify, Reddit, …)

Botnet: IoT devices with Mirai malware


• Mirai infects wifi routers, IP cameras, baby monitors, etc.

• Very simple attack: try to log in using 60 default user/


password combinations (often “admin”/“admin” or
“root”/“password” etc)

• Then spreads to other IoT devices and waits for


instructions
FIT9137 58
Interplanetary Internet
Network of space probes
• space probes used point-to-point links back to earth

• newer FLUX missions use relay satellites:



send from surface to satellite, from satellite to earth

Why doesn’t TCP/IP work?


• light isn’t fast enough:

ARQ impossible with 40 minutes round trip

• radio links are too unreliable

Delay Tolerant Networking (DTN)


• more reliable alternative for IP

• tests are ongoing

FIT9137 59
Summary
Access
• DSL, WiMax, 4G/5G, NBN

• NAT (to overcome limited IPv4 space)

Organisation
• hierarchy of ISPs

• peering at IXPs

• self-government of the Internet

CDN
• deliver content efficiently by putting servers "close to the edge"

Future
• fast, mobile, everywhere (IoT, interplanetary)

FIT9137 60
FIT9137
Introduction to Computer
Architecture and Networks
Week 12: Revision & Review
Amin Sakzad and ABM Russel

FIT9137
Unit Topics

FIT9137 3
Unit Structure

1. Computer Architecture and Operating Systems


2. The Internet Model Layers
3. Local Area Networks (wired & wireless)
4. Backbones and WANs
5. Security and the Internet

FIT9137 4
Two Topics

Subnet and Routing from Weekly Lectures

FIT9137 5
Subnets

FIT9137
Network Classes
Previously used hierarchy:
• Class A: /8 (e.g. IBM, MIT, AT&T, Apple, …)

• Class B: /16 (e.g. Monash 130.194.0.0/16)

• Class C: /24

Example:
• Monash would buy a Class B network, and then be
able to create 256 Class C subnets inside

Now: classless
• e.g. /22, which can also be written as 255.255.252.0
FIT9137 7
Subnets
130.194.76.192 Backbone
130.194.76.253 network

130.194.40.13

130.194.76.191

Gateway routers

130.194.66.61

130.194.40.22

130.194.66.43

FIT9137 8
MAC address

IPv4 address subnet mask


MAC address

IPv4 address

subnet mask
Routing

FIT9137
Layers of Abstraction

Switch Router Switch


FIT9137 12
Routing Basics

• How do routers determine the path to a destination


address?

• How do routers exchange information about the


network to find good paths?

FIT9137 13
Recap: Subnets
130.194.76.192 Backbone
130.194.76.253 network

130.194.40.13

130.194.76.191
How do routers know
Gateway
where torouters
send
packets?

130.194.66.61

130.194.40.22

130.194.66.43

FIT9137 14
Routers
Routers connect networks
• Internet is a network of networks!

• Most important piece of Internet infrastructure

A router is a layer 3 device


• one IP address per interface, i.e. typically per subnet it
is connected to

• Clients send packets to routers if destination is


outside their own subnet

• Routers use IP address to determine over where the


packet is sent next
FIT9137 15
Routing
Three components:
• The routing protocol:

how to find the best route between a sender and a
receiver through the network

• The routing table:



the best routes currently known are stored in a
lookup table for fast access

• The routing decisions:



deciding for each incoming packet where it is sent
next

FIT9137 16
Routing example
Dest. Next Dest. Next
A A A C
dest: H
A G D G G G
H E H H
K E K C
Dest. Next
default C
C D

Dest. Next
default F
B E F
Dest. Next Dest. Next
A C A D
K G F G D H
H F H H
dest: A
K B K E
FIT9137 17
Types of routing
Centralized
• All clients connect to central computer, which makes
the routing decisions

• Used on small, host-based networks

Decentralized
• Each device makes its own decisions

• Information needs to be exchanged to prepare routing


tables

• Used on the Internet

FIT9137 18
Types of decentralised routing
Static routing
• Network manager prepares fixed routing tables
• Manually updated when the network changes

• Used in simple networks that don't change a lot

FIT9137 19
Dynamic Routing

FIT9137
Types of decentralised routing
Static routing
• Network manager prepares fixed routing tables
• Manually updated when the network changes

• Used in simple networks that don't change a lot

Dynamic routing
• Routers exchange information to build routing
tables dynamically
• Initial tables can be set up by network managers

FIT9137 21
Dynamic routing algorithms
Distance vector
• Exchange information about distance to destination,
choose shortest route

• EIGRP (Enhanced Interior Gateway Routing Protocol)

• RIP (Routing Information Protocol)

• BGP (Border Gateway Protocol)

Link state
• Exchange information about quality of links, choose
fastest route

• OSPF (Open Shortest Path First)


FIT9137 22
Distance vector routing
Network A
A Distance: 0 hops
 G
Direction: interface 0

0
1 0 1
3 C D
2 3 2
Network G
Distance: 1 hop

Direction: interface 1 Network K
0 Distance: 2 hops

Direction: interface 0
B 2 E 1 F

K Interface number H

FIT9137 23
RoutingDest.Information
Dist. Interf. Protocol
Dest. Dist. Interf. (RIP)
A 0 0 C 0 0
A B 0 1 G 0 1 G
E 0 2 H 0 2
D 0 3 F 0 3
K 1 1 A 1 0
G 1 C3 B D1 0
H 1 3 E 1 0
F 1 3 K 2 0

B E F
Dest. Dist. Interf.
A 0 0
All routers send their routing
C 0 1
tables to all other routers. H
EK 0 2
K 0 3 Tables converge after some time.
FIT9137 24
Routing Information Protocol (RIP)

Distance = hop count


• Max. hop count 15

• Avoids loops

Only used in small networks


• At most 15 hops

• Updates transmit whole routing table

• Can be slow to converge

FIT9137 25
Link-state routing protocols
Routers exchange information about connectivity
• not just routing table (best routes)

• but all of the network it knows about

• use a metric (usually link speed) to describe the


quality of each connection

Each router creates a topological map


• a map of the entire network

• each router can independently compute best route


to every subnet using a shortest path first algorithm

FIT9137 26
Dijkstra's Shortest Path Algorithm
A ∞ tentative distance ∞ G
5 5
0 ∞
C 5 D metric

2 (lower=better)
1 1 2
20
∞ ∞ ∞
B 1 E 1 F
5
5
K H
∞ ∞
FIT9137 27
Dijkstra's Shortest Path Algorithm
A 5 ∞ G
5 5
0 5
C 5 D
2
1 1 2
20
1 1 ∞
B 1 E 1 F
5
5
K H
∞ ∞
FIT9137 28
Dijkstra's Shortest Path Algorithm
A 5 ∞ G
5 5
0 5
C 5 D
2
1 1 2
20
1 1 ∞
B 1 E 1 F
5
5
K H
∞ ∞
FIT9137 29
Dijkstra's Shortest Path Algorithm
A 5 ∞ G
5 5
0 5
C 5 D
2
1 1 2
20
1 1 2
B 1 E 1 F
5
5
K H
∞ ∞
FIT9137 30
Dijkstra's Shortest Path Algorithm
A 3 ∞ G
5 5
0 5
C 5 D
2
1 1 2
20
1 1 2
B 1 E 1 F
5
5
K H
6 ∞
FIT9137 31
Dijkstra's Shortest Path Algorithm
A 3 ∞ G
5 5
0 4
C 5 D
2
1 1 2
20
1 1 2
B 1 E 1 F
5
5
K H
6 7
FIT9137 32
Dijkstra's Shortest Path Algorithm
A 3 ∞ G
5 5
0 4
C 5 D
2
1 1 2
20
1 1 2
B 1 E 1 F
5
5
K H
6 7
FIT9137 33
Dest. Route
Dijkstra's Shortest
A B Path Algorithm
K B
A 3 G E 9 G
H E
5 5
0 4
C 5 D
2
1 1 2
20
1 1 2
B 1 E 1 F
5
5
K H
6 Shortest Path First (SPF) tree 7
FIT9137 34
Open Shortest Path First (OSPF)
Widely used in large enterprise networks
• OSPFv1 1987, OSPFv2 1991/1998, OSPFv3 for IPv6
1999

Link-state routing protocol


• router builds and maintains a link-state database (LSDB)

• link cost calculated based on bandwidth

• routers exchange information about their LSDB using


multicast and unicast messages

• LSDB is used to create a SPF tree

• best routes from SPF tree are placed in routing table


FIT9137 35
Dynamic routing algorithms
Distance vector
• Exchange information about distance to destination,
choose shortest route

• EIGRP (Enhanced Interior Gateway Routing Protocol)

• RIP (Routing Information Protocol)

• BGP (Border Gateway Protocol)

Link state
• Exchange information about quality of links, choose
fastest route

• OSPF (Open Shortest Path First)


FIT9137 36
Routing on the
Internet

FIT9137
Autonomous Systems
Networks operated by a single organisation
• e.g. Monash University’s or your ISP’s network

Interior routing
• for routing packets within an AS

• uses RIP, OSPF, EIGRP

Exterior routing
• for routing packets between different AS

• Internet uses BGP (Border Gateway Protocol)

FIT9137 38
Internet Architecture
Interior routing
AS1
OSPF
BGP AS3

BGP
Border router BGP BGP

AS4

RIP BGP

AS2 BGP
BGP
OSPF
AS5
AS6
FIT9137 39
Exam
All lecture topics are examinable
– 2 hours and 15 mins exam
– 50% of total marks for unit
– Out of 100 marks

Section A: Theory and Short Answer Questions


– Out of 84 marks (6 questions)

Section B: Design Question


– Out of 16 marks (1 question)

FIT9137 40
Exam Preparation
Mock exam on Moodle
• roughly same length as real exam

• similar distribution of topics, however there are different


questions

• no solutions given, but feel free to discuss solutions with


Lecturer/Tutor or on Moodle

• The lecture topics, assignments and lab exercises should provide


a good background for answering these questions.

Additional consultation
• in week 13-15 (please check Moodle)

• using the General Discussion forum

• by email at abm.russel@monash.edu
FIT9137 41
THANK YOU!
I really enjoyed teaching this unit.

I hope you enjoyed it a bit and learned a lot.

Please complete the SETU!

FIT9137 42

You might also like