What is the Internet?
The Internet Protocol Suite
G Fairhurst, http://www.erg.abdn.ac.uk
1969 Start of Internet project 1983 ! 214 hosts (50 in Arpanet ; 164 in MilNet) 1990! 200,000 hosts (start of “Internet”) 1995! 7 M hosts (30 M users) 1997 22.5 M hosts (50 M users) 2004 250 M hosts (798 M users ; 1/6 world population) 2008 ???
The Network Layer (IP) The Interface Layers (e.g. Ethernet) Routing between networks
Commercial worth of Internet G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
Time to get a market of 50 Million People: Radio took 38 years TV took 13 years The Internet took 4 years – Once opened to the general public
One current estimate: ! 2,300 M Telephones ! 1,340 M Mobile phones ! 600 M PCs
Statistics from the IITF Report released on April 15, 1998 The Emerging Digital Economy http://www.ecommerce.gov/emerging.htm
Transport (TCP, UDP, and applications)
Internet Protocol Stack
IP Protocol Stack
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
Layering of Protocols
Applications Middleware
The Power of IP
G Fairhurst, http://www.erg.abdn.ac.uk
IP under everything
Transport Internet Protocol
email ftp web chat irc VoIP TVoIP IP
End-to-End Principle ! decouple transmission from application ! networks (IS) do not care what they carry ! hosts (ES) do not care how it gets there IP-hosts can control how they use the network Profound impact on regulation Middleware
Transport Links IP on everything
Physical Layer
Some Internet Players G Fairhurst, http://www.erg.abdn.ac.uk
client
server
FTP
FTP
Ethernet Fibre 3G IP
Ethernet driver
People expect Internet connectivity G Fairhurst, http://www.erg.abdn.ac.uk
Applications Middleware
Enet
Enet
Ethernet driver
Video/Multimedia is Important! G Fairhurst, http://www.erg.abdn.ac.uk
40000 30000
Transport
20000 “above the wire and below the application”
Internet Protocol
Transport Links Physical Layer
10000 “By the year 2016, no one under the age of forty will remember a world without personal computer. The average twenty year old will find it hard to imagine a time when there wasn't any email to check or Web sites to visit.” – George Christian, 2006.
Ambient Video (webcams) Internet Video to TV Internet Video to PC Internet Voice Internet Gaming File Sharing Web/Email
0
2008 2009 2010 2011 2012 2013
IP Appliances
IP Packets
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
Messages (large blocks of data) are split into smaller pieces, called “Packets”
Internet Protocol
Each packet (PDU) has: A header (known as the PCI) ! Well-defined format ! Destination address , source address, type, ...
The Connection-Less Network Service The 20 byte IP Packet Header
A payload (known as the SDU) ! A piece of the data to be communicated
IP Network Layer Addresses Name Resolution (name to IP Address)
Internet Addresses Addresses of End Systems
129.23.5.9
139.133.204.18
Internet Architecture
IP Header
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk 15 16 31
0
4
IHL ToS/DSCP 16-bit total length flags 13-bit fragment offset 16-bit identification TTL
16-bit header checksum protocol 32-bit source IP address
Arranged in four levels: G Fairhurst, http://www.erg.abdn.ac.uk ! Core Routers (No user networks connected) ! Distribution Routers (Regional networks) ! Access Routers (Internet Service Providers) ! Home / Corporate networks
32-bit destination IP address options (if any) 20 bytes
data 139.133.1.2
139.133.1.3
139.133.10.7
RFC 791
Internet Addresses G Fairhurst, http://www.erg.abdn.ac.uk
Organisation of names andand addresses Organisation of Names Addresses G Fairhurst
I need to send to: abdn.ac.uk
Name Resolution
There are two ways of identifying a computer, using: 139.133.204.18
Name and Addresses Flat v. Hierarchical Structures
!
A name
!
A network address
Mail to:
[email protected]
Names and addresses may be organised using:
The DNS
139.133.1.2
139.133.1.3
139.133.10.7
!
A flat structure
!
A hierarchical structure
Flat Structure Flat Structure
The Telephone Numbering System ITU Telephone Numbering System
The Domain name Service Tree G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst
G Fairhurst
root
National Insurance Number
us NZ 341865 B
UK 44
Country Albania 355 Lon 171
Area
Batch of numbers allocated to Serial an office number Number indicates issuing office and nothing about individual
Uganda 256
27
Exchange
Man 1212
Abdn 1224
co
49 2201
Subscriber Line
bbc
ITU E.164
!
!
!
Flat
Easy to remember! !
Hierarchical! !
!
!
!
Difficult to remember
Abbreviated name possible!
Easy to change location
Locally administer names! !
Names allocated centrally
e.g. telephone no. Postcode IP name (DNS)
139.133.204.18
No unique abbreviations
Difficult to change location!!
e.g. social security no. IP address
ed
abdn
cs
erg
generic domains
Evolution of the DNS
Internet Email I need to send to: abdn.ac.uk
Easy to find location of name! Only uniquely identifies
com
org
ieee
ac
geographic domains
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst
edu
2497 www
v Hierarchical Structure Flat v Flat Hierarchical Structure
uk
Zim 263
USA 1
G Fairhurst, http://www.erg.abdn.ac.uk
A single file ! /etc/hosts (in unix) ! entered by person setting-up computer A central file (at internic.arpa) ! downloaded to /etc/hosts (using ftp)
Mail to:
[email protected]
139.133.1.2
139.133.1.3
139.133.10.7
A distributed database ! clients send a request (query) ! a dns sends a response (resolution) Most systems still also have a “/etc/hosts” and some also use a LAN name server
Internet Email: dns query
DNS Stack
G Fairhurst, http://www.erg.abdn.ac.uk
DNS Stub Resolver
Internet Email: dns response
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
dns stub resolver
DNS Server
dns stub resolver 139.133.204.18
139.133.204.18
Mail to:
[email protected]
I need to send to: abdn.ac.uk
I need to send to: abdn.ac.uk local dns server
local dns server 139.133.1.2
client needs to resolve a “name” to an “address” to communicate to destination
“abdn.ac.uk” is 139.133.204.18
139.133.1.2
“abdn.ac.uk” is 139.133.204.18
Sending the Email
Recursive Lookup
G Fairhurst, http://www.erg.abdn.ac.uk
dns stub resolver Mail to:139.133.204.18
DNSDNS Client Cache Client Cache
G Fairhurst, http://www.erg.abdn.ac.uk
Recursion asks server to do what is needed to resolve
dns stub resolver (recursion-bit set)
139.133.204.18
DNS Client Request
139.133.204.18
In Local Cache?
No
Yes
Mail to:
[email protected]
I need to send to: abdn.ac.uk
Cache entry out of date? No
local dns server
local dns server
(referrals without recursion-bit set) “uk” is W
139.133.1.2
DNS Cache
dns cache
G Fairhurst, http://www.erg.abdn.ac.uk
139.133.204.18
DNS Resolution G Fairhurst, http://www.erg.abdn.ac.uk
Browser/Application sends name to resolver (DNS client) Resolver checks own cache (local files, etc)
Email uses the lowest numbered reachable mail server
If not resolved, contacts DNS Server (resolver knows this IP address) If not resolved, contacts root DNS server (.) May redirect to other server(s) Resolver given 1 or more addresses (resolver caches the answer for some time)
http://www.abdn.ac.uk ftp://ftp.abdn.ac.uk sip://
[email protected]
local dns server dns cache
Store in Cache
MX records used for Mail Exchange
Other formats also use the DNS: I need to send to: abdn.ac.uk
Use cached value
DNS Records have various types:
mail.abdn.ac.uk 3600 IN MX 500 backup.abdn.ac.uk mail.abdn.ac.uk 3600 IN MX 5 mailserver.abdn.ac.uk mail.abdn.ac.uk 3600 IN MX 10 mailserver1.abdn.ac.uk
dns stub resolver
Fetch value from DNS server
“abdn.ac.uk” is 139.133.204.18
DNS Records
G Fairhurst, http://www.erg.abdn.ac.uk
“abdn.ac.uk” is 139.133.204.18
“uk.ac” is X
“abdn. ac.uk” is Y
Yes
Browser/Application given lowest numbered server
“abdn.ac.uk” is 139.133.204.18
Naming & Addressing: Naming & AddressingSummary - Summary G Fairhurst
A name is a symbol - designed for human reading An address is a data structure understood by a network Organisation may be hierarchical or flat A name server provides a service to change between network addresses and network names To know who's who on the Internet a computer must know the address of a name server
IP LANs G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
Interface Layers (L1 & L2) Encapsulation for Ethernet Address Resolution Protocol (arp)
Addresses allocated to network as an address block ! e.g. Aberdeen University allocated 139.133.x.x Each System (ES or IS): ! One (or more) unique IP address per NIC ! All addresses start with the same address prefix ! e.g. 139.133.1.5, 139.133.208.1
IP Interfaces Network Layer
IP address 3
Interface Software Physical Layer Hardware
le1
lo0
IP address 2
Loop-Back Driver
Ethernet Driver Ethernet Controller
G Fairhurst, http://www.erg.abdn.ac.uk
Internet Service Provider allocates an IP address (or pool of IP addresses) Hosts request an IP address using DHCP (Dynamic Host Configuration Protocol) Send their MAC address, receive an IP address Addresses may be loaned (for some time) or static assigned to a specific MAC address
Ethernet Controller
DHCP Server
DHCP Protocol G Fairhurst, http://www.erg.abdn.ac.uk
Clients broadcast to LAN to Discover DHCP server - includes own MAC address & “Magic Cookie” Unicast: DHCP server sends an offer with details and an IP address to use
DHCP allows this to be done automatically Unicast: Client requests use of the address
Senders know: ! MAC source address (may look in NIC ROM)
Each System (ES or IS): ! One (or more) unique IP address per NIC
G Fairhurst, http://www.erg.abdn.ac.uk
Broadcast: Client sends DHCP discover with own MAC address
What happens if you join a new network? ! Could configure IP address by hand ... but in practice need a better way
Addresses allocated to network as an address block ! e.g. Aberdeen University allocated 139.133.x.x/16 ! i.e. addresses start with the same address prefix ! e.g. 139.133.1.5, 139.133.208.1
DHCP Example
G Fairhurst, http://www.erg.abdn.ac.uk
!
G Fairhurst, http://www.erg.abdn.ac.uk
Sometimes a host doesnʼt know its IP address Quite common for dial-up, ADSL, etc ....
Operating System Kernel
Unique Interface le0 Name IP address 1
IP Address Allocation
Dynamic Host Configuration Protocol
G Fairhurst, http://www.erg.abdn.ac.uk
Unicast: DHCP server acknowledges request and provides a lease for some period
Senders use DHCP to find their own IP addresses This is automatic when end system connects to LAN
One or more DHCP Server responds with a DHCP Offer: IP address that may be used; IP Subnet mask; IP address of default router; IP address of DNS server; IP address of DHCP server; “Magic Cookie” - nonce to identify request at server Client responds to ONE server with a DHCP Request Server responds with a DHCP Acknowledgment
Client
Ethernet MAC Frame G Fairhurst, http://www.erg.abdn.ac.uk
1) Insert MAC address of destination (use arp) 2) Insert own MAC address (from PROM) 6B
MAC Destination
6B
MAC Type
Value used only for a specified period (lease interval)
IP Interfaces
Maximum Transfer Unit (MTU) G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
IP Datagram
4B
2B
MAC Source
DHCP Server
Payload
P A D
MAC CRC
3) Insert payload type code (0x800 for IP) 4) Insert up to 1500 B payload (e.g. IP packet) 5) Add padding if frame less than 60B (excl CRC) 6) Calculate 32 bit CRC over the frame (signature)
7) Prefix 8B preamble (including SFD)
MTU MTU ! Largest IP datagram (packet) which may be sent IP packet (datagram) size 68-65535 B ! Typically 1500B today using IPv4 ! Min MTU 1280 B using IPv6 [RFC 2460] Fragmentation provided by sender Larger transport packets are fragmented to MTU.
IP
L3 (NL)
Other NL
ARP L2 (DL)
Framing
L1 (PL)
Transmission Control
Medium Access Control
ARP needed to set the destination MAC address
Address Resolution Protocol (arp)
G Fairhurst, http://www.erg.abdn.ac.uk
Where is C?
A has a packet to send to C
A
Systems know the IP address of the destination (or find it out from the DNS)
B
C
Target IP
Broadcast: Who is C?
Systems know their own MAC address (or can look in the NIC ROM)
Ether Type = 0x806
No obvious way of determining destination MAC address - We will call the Next Hop IP address the Target-IP
14B
28B
18B
arp message
Ethernet header
8
15 16
31
Protocol Type Operation
G Fairhurst, http://www.erg.abdn.ac.uk IP input
IP output
! ! ! !
ARP request ARP reply RARP request - ignore this] RARP reply - ignore this]
1! 2! [3! [4!
! ! ! !
Ether Type = 0x806
Y
N
destination in arp cache?
Packets stored awaiting arp cache entry
Ethernet
Y
N
ARP
Ether Type = 0x806
demux Ethernet frame type
Ether Type = 0x806
Ether Type = 0x800
Protocol Demultiplexing
ARP Packet G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
IGMP
ICMP
gordon -> dent ARP R 10.0.0.80, gordon is 8:0:20:96:10:1a ----- ARP/RARP Frame ----Hardware type = 1 Protocol type =0x0800 (IP) Length of hardware address = 6 bytes Length of protocol address = 4 bytes Opcode 0x0001 (ARP Request) Sender's hardware address = 8:0:20:b:b0:83 Sender's protocol address = 10.0.0.17, dent Target hardware address = ? (0xffff ffff ffff) Target protocol address = 10.0.0.80, (0x8b85 cc50)
Querier IP
Target IP
ARP/DHCP Packet G Fairhurst, http://www.erg.abdn.ac.uk
48 bit Ether hardware address
32 bit IP source address
32 bit IP target address Where are my friends?
48 bit Ether hardware address
Ether Type = 0x800
dent -> (broadcast) ARP C Who is 10.0.0.80, gordon ?
ARP: ARP: ARP: ARP: ARP: ARP: ARP: ARP: ARP: ARP:
Unicast: Application stored IP packet sent with target MAC address
other protocols
dest = local IP ?
RFC 826
!
Unicast: arp target-ip is 08:00:20:1b:d4:90
copy
N
Target !P (octets 0-3) message
Broadcast: arp who-is target-ip tell me
loopback
Sender !P (octets 2-3) Target HA (octets 0-1) Target HA (octets 2-5) !
ARP triggered, packet stored
Y
dest = broadcast?
Sender HA (octets 0-3) Sender HA (octets 4-5) Sender IP (octets 0-1)
operation!
Ethernet CRC
G Fairhurst, http://www.erg.abdn.ac.uk
Application sends
Ethernet Driver
G Fairhurst, http://www.erg.abdn.ac.uk
Hardware Type HLEN PLEN
4B
Padding
ARP/RARP Packet 0
Unicast: I am C my address is XXXXXX
Not me, ignore the query
All systems connected to the Internet have a unique IP address Systems know (or find out from DHCP) their IP address
ARP Example
ARP Request (send A -> C)
G Fairhurst, http://www.erg.abdn.ac.uk
Transport Protocols
IP Protocol Type Indicates how to demux
IP ARP Ethernet Driver
Senders know: ! IP source address (may use DHCP) ! IP destination address (may use DNS) .... and hence the Target-IP of the next-hop system ! MAC source address (may look in NIC ROM) An arp cache is needed to prevent overload!!
Ethernet Frame Type Indicates how to demux Incoming frame
arp Summary G Fairhurst, http://www.erg.abdn.ac.uk
Senders use arp to find Target-IPʼs MAC addresses
0x800 0x806
Who am I? RFC 2131
The arp cache is also updated by any query The arp cache entries expire after a fixed period It is automatic when each packet is sent
ARP Example
IP Protocol Demux (Structures) Received IP Packet
G Fairhurst, http://www.erg.abdn.ac.uk
inetsw[ ] IP 0 1 UDP 2 TCP 3 IP (raw) 4 ICMP 5 IGMP
ip_proto[ ] IP Protocol Type Byte Table of pointers to entry in table of IP protocols
0 1 2
3 4 5
...
3
6
2
...
3
17
1
...
3
255
Use the “arp -a” command to examine ARP cache. gresley:arp -a milliways-mac.erg.abdn.ac.uk (139.133.207.64) at 0:d0:bb:f7:c6:c1 on en0 mavis-mac.erg.abdn.ac.uk (139.133.207.77) at 8:0:20:86:ec:df on en0
The cache consists of a table of address and bindings There are currently two entries
ARP Example
The arp cache has two new entries: 139.133.207.111 has MAC: 0:10:83:ba:c0:a5 139.133.207.222 did not respond (no cache entry)
Each time a packet is made, arp is triggered as necessary to find the target-IPʼs mac address. Packets sent to 139.133.207.111 were received and generate replies. Packets sent to 139.133.207.222 generate no replies, we can assume this address is not in use.
ARP Question
ARP Question
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
gresley:arp -a milliways-mac.erg.abdn.ac.uk (139.133.207.64) at 0:d0:bb:f7:c6:c1 on en0 mavis-mac.erg.abdn.ac.uk (139.133.207.77) at 8:0:20:86:ec:df on en0
gresley:arp -a milliways-mac.erg.abdn.ac.uk (139.133.207.64) at 0:d0:bb:f7:c6:c1 on en0 mavis-mac.erg.abdn.ac.uk (139.133.207.77) at 8:0:20:86:ec:df on en0 erg2-printer.erg.abdn.ac.uk (139.133.207.111) at 0:10:83:ba:c0:a5 on en0 ? (139.133.207.222) at (incomplete) on en0 [ethernet]
Use the “ping” command to send test packets
gresley:ping 139.133.207.222 PING 139.133.207.222 (139.133.207.222): 56 data bytes ping: sendto: Host is down ping: wrote 139.133.207.222 64 chars, ret=-1 ...
Goto inetsw[ip_proto[packet[protocol]]];
gresley:ping 139.133.207.222 PING 139.133.207.222 (139.133.207.222): 56 data bytes ping: sendto: Host is down ping: wrote 139.133.207.222 64 chars, ret=-1 ...
G Fairhurst, http://www.erg.abdn.ac.uk
gresley:ping 139.133.207.111 PING 139.133.207.111 (139.133.207.111): 56 data bytes 64 bytes from 139.133.207.111: icmp_seq=0 ttl=60 time=1.732 ms ...
Pointers to handlers for transport protocols
gresley:ping 139.133.207.111 PING 139.133.207.111 (139.133.207.111): 56 data bytes 64 bytes from 139.133.207.111: icmp_seq=0 ttl=60 time=1.732 ms ...
ARP Example
G Fairhurst, http://www.erg.abdn.ac.uk
LAN A
LAN B BRIDGE
Two 10 Mbps Ethernet LANs are connected by a bridge. When monitoring LAN A for 1 minute, 40 arp requests are observed and 30 arp responses. (a) Calculate the Utilisation for the arp packets for LAN A.
G Fairhurst, http://www.erg.abdn.ac.uk
Two 10 Mbps Ethernet LANs are connected by a bridge. When monitoring LAN A for 1 minute, 40 arp requests are observed and 30 arp responses. Calculate the Utilisation for the arp packets for LAN A. Size of ARP request/Response is =8+14+28+4 (less than minimum Enet PDU) => 8+64 B = (70/60) x 8x72/107x100 % = 0.007% Give two reasons why there may be fewer responses than queries.
(b) Give two reasons why there are fewer responses than queries.
(1) Some arp requests fail to complete (IP addr not used) (2) Some arp requests may have been sourced on LAN B and correspond to an IP address on LAN B. The response would not travel across the bridge.
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
ARP Packet G Fairhurst, http://www.erg.abdn.ac.uk
001a 2f52 4841 000a 95cf ea5e 0806 0001 0800 0604 0002 000a 95cf ea5e 8b85 cf98 001a 2f52 4841 8b85 cf40
The Internet isi.edu 128.9.0.32
Routing (L3) The Internet
Role of routers Subnet mask Default router emps 139.133.7.10
sysc 139.133.7.110
Role of Routers
Bridges v Routers
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
Routers Connect networks Control traffic flow between networks More expensive Work at Network Layer (e.g.IP) Connect different IP networks Need configuration
Relaying Media conversion IP Segmentation Routing Quality of Service Management Security RFC 1812
G Fairhurst, http://www.erg.abdn.ac.uk 15 16 31
0
4
or
Routers use IP address to forward packets know nothing about ʻconversationsʼ
IP Header
G Fairhurst, http://www.erg.abdn.ac.uk
Should the Local Network be used?
G Fairhurst, http://www.erg.abdn.ac.uk
End Systems send packet to an IP address know nothing about the network toplogy
Bridges/Switches Separate work group traffic Improve LAN performance Cheap Work at MAC Layer (mostly self configuring) Form one IP network (broadcast domain at L2)
Selecting a Route
About An IP Network
IHL ToS/DSCP 16-bit total length flags 13-bit fragment offset 16-bit identification TTL
Should a router be used?
16-bit header checksum protocol 32-bit source IP address 32-bit destination IP address
IP Subnet Mask G Fairhurst, http://www.erg.abdn.ac.uk
ES need to know the network netmask All systems in a subnet must share same subnet mask
R0
IP address! !
A) Local Network
host id
network id
20 bytes
data ES and routers always examine the IP destination address
H0
0
net mask 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0
options (if any)
B) Remote Network
Block of addresses (32768 in this case)
IP Address
H1
RFC 791
Finding the Network ID
IP Subnet Mask G Fairhurst, http://www.erg.abdn.ac.uk
netmask !!
! !
139.133.7.110
!
!
!
0xffffff00 (255.255.255.0)
network ID! !
!
!
139.133.7.0
RFC 950
Identifying the Destination Network (1)
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
Local network calculation
Subnet mask often written as a ʻ/ʼ followed by number of 1s in the mask /8 /9 /10 /11 /12
11111111 11111111 11111111 11111111 11111111
00000000 10000000 11000000 11100000 11110000
00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000
/16 /20 /24 /28
11111111 11111111 11111111 11111111
11111111 11111111 11111111 11111111
00000000 11110000 11111111 11111111
00000000 00000000 00000000 11110000
/29 /30 /31
11111111 11111111 11111111 11111000 11111111 11111111 11111111 11111100 11111111 11111111 11111111 11111110
Finding the network ID ! Convert IP address to hex (or binary) ! Convert netmask to hex (or binary) ! Perform logical AND between the two Example: ! IP address 139.131. 63. 53 &!netmask 255.255. 0 . 0 ! host id is: 139.131. 0 . 0/16
local IP address ! ! local network mask !
!139.133.7.110 !255.255.255.0
local net +subnet id !
!139.133.7.0
dest IP address ! ! local network mask !
!139.133.7.10 !255.255.255.0
dest net +subnet id !
!139.133.7.0
Remote network calculation
Compare
Match, therefore use local network
Identifying the Destination Network (2)
Escaping from the LAN
G Fairhurst, http://www.erg.abdn.ac.uk
Finding the Broadcast Address
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
Local network calculation local IP address ! ! local network mask !
!139.133.7.110 !255.255.255.0
local net +subnet id !
!139.133.7.0
dest IP address ! ! local network mask !
!129.105.2.6 !255.255.255.0
dest net +subnet id !
Where is Z?
Router understands the best link to route a packet towards Z
router forwards packet on a link
Compare
Broadcast address = the network ID + all 1ʼs host ID Finding the broadcast address ! Convert IP address to hex (or binary) ! Convert netmask to hex (or binary) ! Perform logical OR of the inverted netmask Example: netmask 255.255. 0 . 0
Sender forms packet with destination address of Z and sends to Local Router
!129.105.2.0
! IP address 139.131. 63. 53 OR 0 . 0 .255.255 ! host id is: 139.131.255.255
Differ, use a router
Remote network calculation
Network Layer Processing (IP)
IP Broadcast G Fairhurst, http://www.erg.abdn.ac.uk
IP broadcast uses network address with a subnet value of all 1ʼs
G Fairhurst, http://www.erg.abdn.ac.uk SVC
Routers
never
forward IP broadcast
To all systems in an IP network Always sent using MAC broadcast
Routing (L3)
Routing Protocols H1
Network Layer Processing (IP) G Fairhurst, http://www.erg.abdn.ac.uk
Transport
Services (application software)
SVC
Routing
Control Plane
TTL=64
Routing Table IP Forward IP In
IP Out
Net Interface
IP In
IP Out
Net Interface
Data Plane (switching/forwarding fabric)
TTL-TTL=0?
IP In
IP Out
Net Net Interface Interface
Transport Layer
Network Layer IP In
Man
Application software (and layers 5-7)
Traceroute
ARP not needed
SVC
SVC
Routing
Transport
Routes
R0
H0
Man
Interfaces Intermediate System Stack
IP Out
Interface (Link, Physical)
Net Interface
PC Router Architecture
Router Architecture G Fairhurst, http://www.erg.abdn.ac.uk
1995 Single CPU design Forwarding (data plane) Routing (control plane) and were closely linked Network Interfaces standard NICʼs Most routers did both on the same CPU (PC-like)
G Fairhurst, http://www.erg.abdn.ac.uk
SVC
2005 Separate Forwarding Engine Forwarding (data plane) in hardware and Routing Interfaces optimised for forwarding (control plane) in a local CPU in same “box” 2010 Independent Forwarding Engine Forwarding (data plane) in hardware and Routing (control plane) in a possibly separate box
End System Stack
Man
Routing
Control Plane
Forwarding Plane
Net Interface
Net Interface
Net Interface
Single CPU design Standard NICʼs Limited services: Routing Management AAA, etc
Route to zeno.ksc.nasa.gov
Routing Process
Multiservice Router Architecture G Fairhurst, http://www.erg.abdn.ac.uk
Multiple CPU design SVC
SVC
Routing
Control Plane
Man
Control Plane
Forwarding Plane
Net Interface
Net Interface
abdn.ac.uk 139.133
Net Interface
Transport
Routing
Routing
Routing Table
Routing Table
IP Forward
IP Forward
Route to zeno.ksc.nasa.gov (128.159.1.155), 30 hops max, 40 byte packets
IP In
IP Out
Net Interface
IP In
IP Out
Net Interface
IP In
IP Out
Traceroute to globalweb.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
scotland.net 194.247
linx-gw.ja.net 193.63 158.152
195.66
ja.net 146.97
195.11 194.159 router.demon.net www.test.globalweb.co.uk Web server
18 hops in total over 9 domains (7 intermediate)
1 milliways (139.133.204.64) 2.831 ms 2.077 ms 2.167 ms 2 gw34.abdn.ac.uk (139.133.34.1) 4.828 ms 4.955 ms 4.865 ms 3 gwkccs.abdn.ac.uk (139.133.7.4) 16.989 ms 15.510 ms 5.331 ms 4 aclarke-gw.abman.net.uk (194.81.60.94) 7.769 ms 5.545 ms 5.734 ms 5 146.97.250.17 (146.97.250.17) 9.785 ms 12.061 ms 9.347 ms 6 146.97.37.29 (146.97.37.29) 13.904 ms 16.689 ms 11.144 ms 7 pos9-0.edin-scr.ja.net (146.97.35.61) 11.492 ms 16.527 ms 21.450 ms 8 pos0-0.leed-scr.ja.net (146.97.33.26) 18.450 ms 27.231 ms 19.766 ms 9 pos2-0.lond-scr.ja.net (146.97.33.30) 32.023 ms 35.862 ms 28.696 ms 10 146.97.35.6 (146.97.35.6) 26.864 ms 25.046 ms 24.458 ms 11 linx-gw.ja.net (193.63.94.249) 23.115 ms 32.644 ms 21.848 ms 12 linx-2.router.demon.net (195.66.224.13) 26.371 ms 26.082 ms 22.430 ms 13 tele-backbone-1-ge020.router.demon.net (194.159.252.54) 14 anchor-core-2-fxp1.router.demon.net (158.152.0.178) 15 demon-gw-2.sol.co.uk (195.11.50.130) 37.791 ms 33.314 ms 38.483 ms 16 atm1-0-0-1.core2.scotland.net (194.247.77.34) 50.325 ms 56.771 ms 17 fe12-0-0.core1.scotland.net (194.247.67.41) 44.368 ms 46.100 ms 18 ABZ-Sci-Park.LL.scotland.net (194.247.71.109) 50.041 ms 51.625 ms
Traceroute to phys.uh.edu
5 146.97.250.17 (146.97.250.17) 10.686 ms 10.713 ms 9.235 ms 6 146.97.37.29 (146.97.37.29) 14.946 ms 20.399 ms 25.039 ms 7 pos9-0.edin-scr.ja.net (146.97.35.61) 14.822 ms 17.958 ms 20.820 ms 8 pos0-0.leed-scr.ja.net (146.97.33.26) 26.630 ms 26.973 ms 21.264 ms 9 pos2-0.lond-scr.ja.net (146.97.33.30) 28.960 ms 25.399 ms 25.840 ms 10 146.97.35.6 (146.97.35.6) 22.284 ms 22.070 ms 23.392 ms 11 us-gw2.ja.net (193.63.94.91) 28.271 ms 22.696 ms 23.660 ms 12 193.62.157.18 (193.62.157.18) 91.709 ms 90.632 ms 87.277 ms 13 ny-pop.i2.ja.net (193.62.157.210) 95.792 ms 95.864 ms 97.488 ms 14 clev-nycm.abilene.ucaid.edu (198.32.8.29) 106.189 ms 116.730 ms 15 ipls-clev.abilene.ucaid.edu (198.32.8.25) 113.960 ms 109.556 ms 16 kscy-ipls.abilene.ucaid.edu (198.32.8.5) 129.682 ms 126.980 ms
Route to phys.uh.edu G Fairhurst, http://www.erg.abdn.ac.uk
linx-gw.ja.net 193.63
abdn.ac.uk 139.133
Web browser
194.81 abman.net.uk
198.32 ucaid.edu
dnvr-kscy.abilene.ucaid.edu (198.32.8.13) 138.995 ms 130.486 ms scrm-dnvr.abilene.ucaid.edu (198.32.8.1) 153.115 ms 157.528 ms losa-scrm.abilene.ucaid.edu (198.32.8.18) 163.873 ms 163.366 ms hstn-losa.abilene.ucaid.edu (198.32.8.22) 195.996 ms 201.506 ms
21 LINK2ABILENE.GIGAPOP.GEN.TX.US (198.32.236.13) 194.006 ms 22 INTRALINK2IBT.GIGAPOP.GEN.TX.US (198.32.236.37) 199.774 ms 23 UH.GIGAPOP.GEN.TX.US (198.32.236.30) 205.365 ms 201.777 ms 24 vespasian-vlan10.gw.uh.edu (129.7.254.254) 205.210 ms 196.519 ms 25 Pegasus.Phys.UH.EDU (129.7.2.50) 204.640 ms 197.582 ms 204.103 ms
Pegasus.phys.uh.edu Web server
25 hops in total over 6 domains (4 intermediate)
IP Header
G Fairhurst, http://www.erg.abdn.ac.uk
17 18 19 20
gw.uh.edu 129.7
ja.net 146.97
Traceroute to phys.uh.edu
G Fairhurst, http://www.erg.abdn.ac.uk 1 milliways (139.133.204.64) 2.956 ms 2.103 ms 2.101 ms
2 gw34.abdn.ac.uk (139.133.34.1) 4.951 ms 4.891 ms 4.765 ms 3 gwkccs.abdn.ac.uk (139.133.7.4) 5.255 ms 16.300 ms 5.009 ms 4 aclarke-gw.abman.net.uk (194.81.60.94) 6.665 ms 5.533 ms 5.623 ms
1 milliways-erg (10.0.0.64) ! ! ! 2 ms 1 ms 1 ms 2 139.133.210.1 (139.133.210.1) !! ! 7 ms 7 ms 7 ms 3 abdn-gw.abdn.ac.uk (139.133.7.6) ! ! 3 ms 3 ms 3 ms 4 smds-gw.ulcc.ja.net (193.63.203.33) ! 17 ms 16 ms 15 ms 5 nsn-gw.ulcc.ac.uk (128.86.1.3) ! ! ! 16 ms 17 ms 16 ms 6 128.161.165.1 (128.161.165.1) !! ! 96 ms 123 ms 147 ms 7 GSFC6.NSN.NASA.GOV (192.100.13.6) !98 ms 115 ms 146 ms 8 128.161.44.4 (128.161.44.4) ! ! ! 178 ms 189 ms 154 ms 9 MSFC1.NSN.NASA.GOV (192.100.14.1) 170 ms 178 ms 175 ms 10 KSC.NSN.NASA.GOV (128.161.30.27) ! 192 ms 316 ms 168 ms 11 192.150.33.1 (192.150.33.1) ! ! ! 192 ms 205 ms 213 ms 12 128.159.215.239 (128.159.215.239) ! 172 ms 172 ms 193 ms 13 163.205.253.254 (163.205.253.254) ! 330 ms 222 ms 269 ms 14 zeno.ksc.nasa.gov (128.159.1.155) ! 220 ms 377 ms 177 ms
Net Interface
Route to globalweb.ac.uk
abman.net.uk 194.81
Web browser
Custom Interfaces Many services: Multi-protocol Routing Management, DHCP, AAA, VoIP, Web servers, Load balancing, Firewalls, NAT, Intrusion Detection
G Fairhurst, http://www.erg.abdn.ac.uk Transport
G Fairhurst, http://www.erg.abdn.ac.uk 15 16 31
0
44 IHL ToS/DSCP 16-bit total length flags 13-bit fragment offset 16-bit identification TTL
16-bit header checksum protocol 32-bit source IP address 32-bit destination IP address options (if any) 20 bytes
data 25 hops in total over 6 domains (4 intermediate)
Router always examine the IP destination address Routers may also utilise the ToS/DSCP value The TTL is decremented and checksum recalculated RFC 791
Router Forwarding Procedure
Routing
G Fairhurst, http://www.erg.abdn.ac.uk Network ID e.g. 10.1.0.0/16 139.133.1.0/24
Route IP datagram
Send ICMP message
extract net from IP address net = local network ?
net = host route ?
N
N
net N = network route ?
Y
Y
Y destination in arp cache?
N
N
Itʼs on my LAN use arp to find h.a. send directly to H3
H3
R3
R3 is nearer H3, send to R3
N3
Itʼs not for my LAN send to local router (R0)
R0 139.133.208.x H2
H0
Alternative Routes
Routing Protocols
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
R2
R2
R1
R1
“Best Effort” network service Not all packets are delivered R0 Some may be delivered twice! Not all packets follow same route Not all packets take the same time (Not all packets are segmented in the same way)
Routers exchange control packets
R0
H1
Routes from local networks G Fairhurst, http://www.erg.abdn.ac.uk
Router B declares Router B as default route Router C declares Router B as default route Router D declares Router B as default route All traffic to “unknown addresses flows towards “core”
A
Router A instructs Router B Send B all traffic to addresses with network ID 10.1.0.0/16 Router B sends traffic with network ID 10.1.1.0/24 to C Router B sends traffic with network ID 10.1.3.0/24 to D
A
Default Route Default Route
B
Thereʼs no such thing as a reliable “I am dead indication” This needs agreement between the two ends
Default Route
Router Architecture
G Fairhurst, http://www.erg.abdn.ac.uk
Interface Management Table
D
G Fairhurst, http://www.erg.abdn.ac.uk Network Interface Cards (here with single interfaces)
Received packet
C
Router Architecture
G Fairhurst, http://www.erg.abdn.ac.uk
Link Protocol Controllers (e.g. Ethernet)
!route
139.133.208.x !local default ! ! !R0
H2
Routers send “control” messages ! If you donʼt get them, you know link is “dead”
Routes to Remote Networks
destination !
N1
R0
H1
!local !local !local !R2 !R1 !R1
N0
Y
H0
!route
139.133.208.x N0 ! ! ! ! N1 ! ! ! N2 ! ! ! N3 ! ! ! 139.134.x.x
R2
N2 R1
R1 is nearest H3, send to R1
destination !
H3
R3
R1
Y
G Fairhurst, http://www.erg.abdn.ac.uk
139.134.204.x
R2
default route specified?
Send IP datagram
arp request
Routing Table
G Fairhurst, http://www.erg.abdn.ac.uk
Forwarding table (identifies this packet requires processing by general purpose processor)
Received packet
Network Protocol (Forwarding Engine) Route towards 10.1.0.0/16 Route towards 10.1.1.0/24
B Route towards 10.1.3.0/24
Hardware Address Tables Interface to/from Packet Switch
C D
Forwarded packet
Forwarded packet
Forwarding Table (IP address matches another local interface)
Hardware Packet Switch (connects via general purpose processor)
General Purpose Processor (examines packet header in detail, perhaps using filter table)
Price v RouterPerformance
Router Platform
G Fairhurst, http://www.erg.abdn.ac.uk SVC
Not all routers are equal - Cost is sometimes important - Control is sometimes important - Speed is sometimes important - Services are sometimes important
SVC
Control Plane
Net Interface
Office Router (control)
ISP Router (interfaces)
Really useful in a commercial setting This lets a company change itʼs external IP address
Core Router (speed)
Net Interface Web Server
1
Edge Router
Core Router
Fabric Engine Services Platform (flexibility)
G Fairhurst, http://www.erg.abdn.ac.uk
First invented to map one computer to one address
Cost/Bandwidth
Forwarding Plane Home Gateway (cost)
NAT
G Fairhurst, http://www.erg.abdn.ac.uk
10
100
PC
Services Platform
1000
10000
100000
Instructions/Packet
NAPT
Internet Control Message Protocol
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
Problem
Port Translation NAPT shares same address between multiple users
ICMP
Generally what is done for home networks
H0
R0
R1
H1
R2
Connections have to be started from the inside - Becomes a nuisance when connecting to a server
Internet Control Message Protocol
NAPTs build state - When a NAPT crashes the connections disappear
ICMP Encapsulation
NATs try to be “transparent”, it hides and does things without anyone asking it to do things
Ping and ICMP Echo
ICMP (Reason, Diagnostic) Routers / Computers send ICMP messages
Other uses: PMTU Discovery, Traceroute
Messages usually contain the header of the packet Not usually sent when ICMP messages received (An exception is an ICMP ECHO REQUEST)
ICMP Encapsulation
ICMP Message G Fairhurst, http://www.erg.abdn.ac.uk
7 8
0
8-bit type
15 16
8-bit code
G Fairhurst, http://www.erg.abdn.ac.uk
31
16-bit checksum
Usually contains "ID" and "sequence number" for "ICMP Echo"
(contents depend on type and code) 4
Type! Message 0! ! 3! ! 4! ! 5! ! 8! ! 11! ! !
Echo reply Destination unreachable Source quench Redirect Echo request Time exceeded (i.e. TTL=0)
Postel, J., "Internet Control Message Protocol", RFC792, STD 5, 1981.
user data
IP ICMP header header
user data
IP ICMP Ethernet header header header
user data
14
G Fairhurst, http://www.erg.abdn.ac.uk
Ping 60 B of ICMP payload
RTT = 2 ms
user data
ICMP header
20
Ping of Local Host
4 Ethernet CRC-32
ping -s sysb PING sysb: 56 data bytes 64 bytes from sysb (139.133.201.196): icmp_seq=0. time=3. ms 64 bytes from sysb (139.133.201.196): icmp_seq=1. time=3. ms 64 bytes from sysb (139.133.201.196): icmp_seq=2. time=3. ms 64 bytes from sysb (139.133.201.196): icmp_seq=3. time=3. ms 64 bytes from sysb (139.133.201.196): icmp_seq=4. time=3. ms 64 bytes from sysb (139.133.201.196): icmp_seq=5. time=3. ms 64 bytes from sysb (139.133.201.196): icmp_seq=6. time=3. ms 64 bytes from sysb (139.133.201.196): icmp_seq=7. time=3. ms 64 bytes from sysb (139.133.201.196): icmp_seq=8. time=3. ms 64 bytes from sysb (139.133.201.196): icmp_seq=9. time=4. ms 64 bytes from sysb (139.133.201.196): icmp_seq=10. time=5. ms 64 bytes from sysb (139.133.201.196): icmp_seq=11. time=3. ms ^C ----sysb PING Statistics---12 packets transmitted, 12 packets received, 0% packet loss round-trip (ms) min/avg/max = 3/3/5
Ping of Remote Host
IP Segmentation
G Fairhurst, http://www.erg.abdn.ac.uk
ping -s www.ksc.nasa.gov PING zeno.ksc.nasa.gov: 56 data bytes 64 bytes from zeno.ksc.nasa.gov (128.159.1.155): icmp_seq=0. time=191. ms 64 bytes from zeno.ksc.nasa.gov (128.159.1.155): icmp_seq=1. time=237. ms 64 bytes from zeno.ksc.nasa.gov (128.159.1.155): icmp_seq=2. time=412. ms 64 bytes from zeno.ksc.nasa.gov (128.159.1.155): icmp_seq=3. time=177. ms 64 bytes from zeno.ksc.nasa.gov (128.159.1.155): icmp_seq=4. time=183. ms 64 bytes from zeno.ksc.nasa.gov (128.159.1.155): icmp_seq=5. time=189. ms 64 bytes from zeno.ksc.nasa.gov (128.159.1.155): icmp_seq=6. time=179. ms 64 bytes from zeno.ksc.nasa.gov (128.159.1.155): icmp_seq=7. time=177. ms 64 bytes from zeno.ksc.nasa.gov (128.159.1.155): icmp_seq=8. time=174. ms 64 bytes from zeno.ksc.nasa.gov (128.159.1.155): icmp_seq=9. time=175. ms 64 bytes from zeno.ksc.nasa.gov (128.159.1.155): icmp_seq=10. time=178. ms 64 bytes from zeno.ksc.nasa.gov (128.159.1.155): icmp_seq=11. time=189. ms 64 bytes from zeno.ksc.nasa.gov (128.159.1.155): icmp_seq=12. time=322. ms ^C ----zeno.ksc.nasa.gov PING Statistics---14 packets transmitted, 13 packets received, 7% packet loss round-trip (ms) min/avg/max = 174/214/412
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
Segmentation / Fragmentation IP segmentation by routers IP segmentation header Each Interface has a Maximum Transmission Unit The MTU specifies the size of the largest IP packet Packets must be fragmented to be less than the MTU
Path MTU Discovery End System segmentation by sender
1980s: Reliable data transmission
Required Information G Fairhurst, http://www.erg.abdn.ac.uk
Own MAC hardware address (from NIC PROM) ! Used in MAC source address Own IP address (given by network administrator) ! Used as IP source address
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
Transport,Middleware & Applications
1980
UDP (Header, Services)
Own IP subnet mask (given by network administrator) ! Indicates remote destination addresses ! Indicates IP broadcast address (to all local systems)
Demultiplexing (Protocol, Port)
IP default router (given by network administrator) ! IP address of router to send to for remote addresses ! (indicates MAC address for remote IP networks)
Checksum
IP name server server (given by network administrator) ! IP address of a server to resolve names address
TCP Connections
TCP (Header, Services) Data was precious... Networks needed to be careful not to loose/damage it.
Applications
1980s: The Internet model
Reliability needs to be End-to-End
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
Network Layer Processing (IP) G Fairhurst, http://www.erg.abdn.ac.uk SVC
Man
Routing
SVC
In most places, the Internet is only “best effort” There can be: Loss (never arrives) Variable delay (arrives late) Reordering (wrong order)
Transport
TCP
Network Layer
All much more common with wireless TCP Dave Clarke, 1981 "The function in question can completely and correctly be implemented only with the knowledge and help of the application standing at the end points of the communication system. Therefore, providing that questioned function as a feature of the communication system itself is not possible."
IP In
IP Out
Net Interface
Interface (Link, Physical)
Transport Layer Service
IP Protocol Types
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
IP in IP Tunnel
Logical link between applications
IP
Transport Protocols
ICMP
IP Protocol Type Indicates how to demux
Transport protocols run in End Systems
Transport
UDP User Datagram Protocol
End System
Best Effort Service
Incoming # packet # Internet (IP) protocols # ip 0 IP # internet protocol icmp 1 ICMP # internet control message protocol tcp 6 TCP # transmission control protocol udp 17 UDP # user datagram protocol # # Internet (IPv6) extension headers # ipv6 41 IPv6 # IPv6 in IP encapsulation ... More IPv6 Extension Headers...
Multiplexing (service access points) Integrity Check Several Transport Protocols (ICMP) UDP, TCP, STCP, UDP-Lite, DCCP
Transport
End System
In UNIX, these are stored in /etc/protocols
G Fairhurst, http://www.erg.abdn.ac.uk
Why are datagram networks unreliable?
Each connection identified by: (dest IP, dest port))
Transmission Frame Corruption (link CRC fails)
15 16
31
16-bit source port
16-bit destination port
16-bit UDP length
16-bit UDP checksum
Router Header Corruption (IP Checksum fails) 8 bytes
Router Congestion (packet discarded by router) Receiver Busy (packet discarded by end system)
data (if any)
No route to destination (packet discarded by router) Integrity checked by: ! Verifying the length of PDU (incl. header) ! Executing a checksum algorithm
Corruption in Networks
Loss in Networks
UDP Header
G Fairhurst, http://www.erg.abdn.ac.uk
0
IP
Equipment failure (packet discarded by router) Each means packet does NOT reach the destination
G Fairhurst, http://www.erg.abdn.ac.uk
Why are datagram networks unreliable? (II) Corruption of packet: ! inside bridges ! inside routers ! inside end systems ! Causes: ! Software errors (copy wrong data) ! DMA hardware faults Errors in IP header detected by IP checksum ! Routers discard packets with header errors Errors in IP payload undetected A corrupted packet can reach the destination
RFC 768
16-Bit UDP Checksum
Port Numbers
G Fairhurst, http://www.erg.abdn.ac.uk
Sender treats segment contents as sequence of 16-bit integers Add (1ʼs complement sum) of segment contents Put checksum value into UDP checksum field Receiver computes checksum of received segment Is computed checksum equals checksum field value: NO - error was detected. YES - no error detected. But, may be errors nonetheless?
Some other things to check: Addresses, Length, Protocol These are also added into checksum
Well-Known Server Port Number
G Fairhurst, http://www.erg.abdn.ac.uk
C2
C1
Internet
The Server accepts packet to a socket bound to Destination Port Server
C3 C4 Each client sends packet with a specified Destination Port
G Fairhurst, http://www.erg.abdn.ac.uk
Application
Transport
I will accept packets from server-port Server “opens” a new transport session
Network
It “binds” to (dst = server-port, src= any-port)
Data Link
It “accepts” new connections
Physical Layer
IP
Ethernet driver
Well Known Port Numbers
Unique Client Port Number
G Fairhurst, http://www.erg.abdn.ac.uk
The Internet has agreed a set of well -known ports There are lots of these - one for each service
37 53! !
I want to send to server-port
Application
!Network time Server (nntp) ! Domain Name Server (dns)
e.g. packets sent from a client to a dns server (53) IP header! ! ! ! ! ! ! (clientʼs IP addr, dns server IP addr) !
Network
IP
Data Link
Ethernet driver
e.g. packets (responses) from a dns server(3) to a client IP header! ! ! ! ! ! ! (dns server IP addr, clientʼs IP addr) !
It “binds” to (src = unique-port, dst = server-port)
UDP header (client port,53) UDP header (53, client port)
UDP Services
G Fairhurst, http://www.erg.abdn.ac.uk
Client (unique)
All UDP packets carry (src, dst) port numbers
Server (wellknown)
(unique, well-known) IP
Data Link
Ethernet driver
IP (well-known, unique)
G Fairhurst, http://www.erg.abdn.ac.uk
Ethernet driver
Physical Layer
Trivial File Transfer Protocol (TFTP)
TFTP
(nfs) (dns) (ntp) ! (snmp)
Trivial File Transfer Protocol Reliability Packet Headers
Stream Services ! Audio, Video!! ! ! ! Internet Telephony! !
(Multimedia) (Voice over IP)
Multicast ! Internet TV! ! ! ! File Distribution! !
(Multicast Multimedia) (Multicast File Transfer)
! !
Read Request (RRQ)
First defined in 1980.
Can be used to transfer small files between hosts on a LAN, e.g. remote X Window System terminal.
Reliability
G Fairhurst, http://www.erg.abdn.ac.uk
VERY simple file transfer protocol.
TFTP is useful for booting computers and configuring routers which did not have mass storage devices.
Retransmission (ARQ)
Trivial File Transfer Protocol (TFTP)
G Fairhurst, http://www.erg.abdn.ac.uk
Easy to implement in a very small amount of memory.
G Fairhurst, http://www.erg.abdn.ac.uk
Simple Services ! Startup / Bootstrap !(DHCP, tftp) Query / Response ! Disk Sharing ! ! ! ! Address Query! ! ! ! Time Query! ! ! ! ! Network Management
Transport
Network
SPort needs to be unique for a client Could increment for each new socket (some OS do) But... could do something different (many OS do) Could pick a random (but unique) SPort (makes packet snooping harder)
Physical Layer
Src &Dest Port Numbers Application
G Fairhurst, http://www.erg.abdn.ac.uk
Connections identified by: {SIP,SPort,DIP,DPort} How do you choose SPort?
Client “opens” a new transport session
Transport
Some examples are:
Unique Client Port Number
G Fairhurst, http://www.erg.abdn.ac.uk
copy of client software (e.g. “bootstrap, 1074 B)
DATA
ACK
G Fairhurst, http://www.erg.abdn.ac.uk
Internet is Best Effort ! Some information may be lost in transit Corruption unlikely (due to CRCs and checksums) Reliability Implies....
No software when client switched on, requests copy from server
! All information is received!! (no loss, no residual errors) ! No information is duplicated !(no extra copies) !Sequencing !! ! ! ! ! (original order is preserved)
Automatic Repeat reQuest (ARQ)
Transmit Timer
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
Send a Packet
Wait
Loss Recovery by Timer G Fairhurst, http://www.erg.abdn.ac.uk
"What, no ACK? - send it again."
Acknowledged Timer started
D
Timer
D
D
Transmit timer monitors receipt of acknowledgments
Timer restarted
Timer restarted
D1
Timer stopped
Timer
Timer D2'
D2
Starts:!When first Data Packet sent ACK
ACK
ACK
Restarts:!When a new Data Packet sent
ACK
ACK
Stops:! When all packets have been acknowledged
"I got it!"
"I got it!"
Stop & Wait ARQ G Fairhurst, http://www.erg.abdn.ac.uk
Server starts transfer
Advantages Very simple to implement
DATA 1 (512 B)
Disadvantages Response to every transmitted Data packet Timers needed to recover loss of a Data packet/ACK Wasteful with long delays
DATA 2 (512 B)
DATA 3 (50 B)
G Fairhurst, http://www.erg.abdn.ac.uk
Op Codes for TFTP 1 = TRead Request (RRQ) 2 = Write Request (WRQ) 3 = DATA (512 B, unless final) 4 = ACK 5 = Error Op Code
ACK(1)
DATA indication
READ request (RRQ)
ACK(2)
DATA indication
ACK(3) 4B
Throughput
Idle time
Data block
20 B IP TFTP defined in RFC 1350, 1992
Throughput
Summary
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
DATA
RTT
2 B sequence number
8 B UDP
DATA indication
Last block< 512B, indicates end of transfer.
G Fairhurst, http://www.erg.abdn.ac.uk
Defined as “the number of bits transferred per second from a given layer to the upper layer as a result of a conversation between two users of the layer” Considers only data forwarded to the OSI layer above (i.e. not layer ovehead) Expressed in bits per second Measures performance of a layer
TFTP Protocol Header
Trivial File Transfer Protocol (TFTP) G Fairhurst, http://www.erg.abdn.ac.uk
"I got it!"
Lost packet
ACK
! Throughput = (PDU)/(RTT)
! TFTP is very simple to implement Uses UDP/IP Adds to this to provide reliable delivery Useful for simple tasks (software download, configuration of routers, etc) Performance OK for a LAN Not suited to general Internet Slow performance with large delay No userid/login No congestion control (see “TCP”)
FTP between local hosts G Fairhurst, http://www.erg.abdn.ac.uk
TCP Transmission Control Protocol
Encapsulation
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
user data
FTP client
Application
FTP client
Transport
TCP
TCP
Network
IP
IP
Data Link Physical Layer
Ethernet driver
Ethernet driver
application header
user data
TCP application header header
user data
IP TCP application header header header
user data
Ethernet IP TCP application header header header header
user data
Reliable
Integrity Check (as UDP)
20
Multiplexing (similar to UDP) Reliable In-Order Delivery (retransmits)
20
Stream-oriented Transport Flow Control (receiver slows-down sender) Congestion Avoidance (network slows-down sender) Out-Of-Band Data (little used)
14
(source IP, source port; Dest IP, dest port)
TCP Header
TCP Streams G Fairhurst, http://www.erg.abdn.ac.uk
Sender
Receiver read
write
read
write
read
write
read
0
15 16
16-bit source port
! !
16-bit destination port
32-bit sequence number 32-bit acknowledgement number TCPHL reserved flags 16-bit TCP checksum
20 bytes
16-bit window size
G Fairhurst, http://www.erg.abdn.ac.uk
The Internet has agreed a set of well -known ports There are lots of these, see: ! /etc/services file in UNIX ! or RFC 1060 (Assigned Numbers)
RFC 793
G Fairhurst, http://www.erg.abdn.ac.uk
File Transfer [Default Data] File Transfer [Control] Telnet Simple Mail Transfer Time Trivial File Transfer Finger Post Office Protocol v 3 Network Time Protocol Interim Mail Access Prot. v2 Simple Network Man. Prot.
Throughput G Fairhurst, http://www.erg.abdn.ac.uk
Stop and Wait Protocol !Throughput = (PDU)/(RTT) DATA
Idle time
ACK
Some examples are: FTP-DATA FTP TELNET SMTP TIME TFTP FINGER POP3 NTP IMAP2 SNMP
file transfer (ftp [21])! mail transfer (smtp [25]) streaming media
Semi-Interactive! ! ! WWW (http [80]) ! nfs
Window
Well Known Port Numbers
terminal access (telnet [23] rlogin [513]) dns
Bulk Services ! ! !
16-bit urgent pointer
Data and ACK sequence numbers
G Fairhurst, http://www.erg.abdn.ac.uk
Interactive Services
31
data (if any)
≤ MSS
TCP Services
G Fairhurst, http://www.erg.abdn.ac.uk
Same as UDP
options (if any)
20 21 23 25 37 69 79 110 123 143 161
4 Ethernet CRC-32
Window-Based Protocol !High throughput requires large enough window. ! ! (window(in bytes)xRTT) > bandwidth DATA DATA DATA DATA DATA
ACK
Defined as “the number of bits transferred per second from a given layer to the upper layer as a result of a conversation between two users of the layer” Considers only data forwarded to the OSI layer above (i.e. not layer ovehead) Expressed in bits per second Measures performance of a layer
Idle (unused)
Multiplexing
Utilisation !
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
! An end system uses TCP to communicate with another end system over a 10 Mbps Ethernet LAN. The sender transmits 50 packets per second with 1460 B of TCP data, and receives 25 packets per second of Acknowledgements (ACKs) with no data.
Utilised! Defined as “the total number of bits transferred at the physical layer to communicate a certain amount of data divided by the time taken to communicate the data.” Includes all bits in all types of frame irrespective of whether they are corrupted or correctly received. Expressed as a percentage of physical layer rate. Measures link capacity used .
Calculate: Two flows can share a link (multiplexing) Utilisation = sum of each flow utilisation No loss occurs providing utilisation < 100% Some buffer space is needed to store bursts
! (i) The throughput ! (ii) The utilisation of the network ! (iii) The utilisation if UDP were used instead of TCP
Sharing G Fairhurst, http://www.erg.abdn.ac.uk
• •
G Fairhurst, http://www.erg.abdn.ac.uk
Congestion
Congestion Collapse
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
Circuit-switching allocates fixed capacity Peak packet rate can exceed long-term share
“Route” Optimisation Problem G Fairhurst, http://www.erg.abdn.ac.uk
More packets received than sent ! ! queue builds Queue exceeds buffer memory ! packets discarded Known as a “drop-tail” router
!
Retransmit the discarded packets! ! causes more overload Situation results in a “meltdown” Known as a “congestion collapse”
Multi-path sharing
Congestion Avoidance
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
ES can optimise globally ISP-level optimisation more course-grain
Takes sharing one stage further Leverages multi-homing
Congestion Collapse was a real problem in late 80ʼs
Traffic moves away from congested links
It was prevented by new algorithms in TCP (1986) ! !
Each TCP sender now judges how fast to send - based on whether they experience congestion: End Systems that see any loss slow down. End Systems that do NOT see loss speed up.
! !
Use of this is required (1988) It has worked very well - at least up until now!
TCP continues to evolve......
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
IPv4
Transmission Transport
IPv6
Current Internet
Links and Physical
(1981)
Hop Limit
128 bit Source Address
128 bit Destination Address
Next Header
Header Length Header Extensions (if any)
Simplified header format (good for hardware) Expanded addressing 128-bit Improved support for Extensions (e.g. mobility) Flow Labeling Authentication and Privacy (IPsec, SEND, ...)
IPv6 Features
Field updated and present in IPv6 base header Field not present in IPv6 base header
32-bit address Monolithic header (complex) Options not widely implemented Router fragmentation troublesome (use PMTUD)
IPv6 Decode
G Fairhurst, http://www.erg.abdn.ac.uk Flow Label Next Header
Options (if any), multiple of 32 bits
Next Gen. Internet (1994)
“New” IPv6 Functions DSCP/ToS ECN Payload Length
G Fairhurst, http://www.erg.abdn.ac.uk Version HLen DSCP/ToS ECN Total Datagram Length Fragment Identification Flags Fragmentation Offset Time to Live Protocol Header Checksum 32 bit Source Address 32 bit Destination Address
Internet Protocol
Version
IPv4
IPv6
A New Internet Layer?
IPv6 Status
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk
0000:
47 5c 8f 15 00 80 6c 86
dd 60 00 00 00 00 40 3a
G\....l..`....@:
0010:
40 20 10 0d b8 85 a3 08
d3 13 19 8a 2e 03 70 73
@ ............ps
0020:
35 20 10 0d b8 85 a3 08
d3 13 19 8a 2e 03 70 73
5 ............ps
0030:
35 80 00 e9 6b 77 3d 00
04 9b 56 d9 47 00 00 00
5...kw=...V.G...
0040:
00 3e 0f 0d 00 00 00 00
00 10 11 12 13 14 15 16
.>..............
0050:
17 18 19 1a 1b 1c 1d 1e
1f 20 21 22 23 24 25 26
......... !"#$%&
0060:
27 28 29 2a 2b 2c 2d 2e
2f 30 31 32 33 34 35 36
'()*+,-./0123456
0070:
37 8f 05 4a 29 ff ff ff
ff ff ff ff ff ff ff ff
7..J)...........
0080:
ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff
................
0090:
ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff
................
00a0:
ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff
................
00b0:
ff ff ff ff ff ff ff ff
ff ff ff ff
............
Standard on all router platforms Common on high-end switches Standard in modern host operating systems “IPv6 is not Rocket Science” – Lorenzo Colitti But... 0.39% of BGP-advertised prefixes are IPv6! 0.2% of total web traffic! http://www.ipv6forum.com/
Distribution of allocated IPv4 Addresses
G Fairhurst, http://www.erg.abdn.ac.uk
Unallocated IANA IPv4 /8 Addresses
G Fairhurst, http://www.erg.abdn.ac.uk USA
Asia/Pacific
Europe
Lat America
Africa
G Fairhurst, http://www.erg.abdn.ac.uk 80
78
~9 /8’s allocated per year
73
IPv4
IPv6 65
USA 32%
65
65 62
60
62 59
Some features were not used:
55
Flow-labels not so useful after all IPsec mainly used for VPNs Many IPv6 features now in IPv4: QoS Multicast Mobility NAT has replaced the need for addresses? “...Itʼs not deployed, do we need IPv6?”
Asia/Pacific 31%
Africa 2% Lat America 7%
49
40
49 45 42
41
20
39 35
Europe 28%
Dec-04
0
Jul-05 Dec-05
Jun-06 Dec-06 Jun-07
Areas with high demand for rural satellite Internet have few IPv4 addresses
the days of free IPv4 addresses are numbered... Projected IANA Unallocated Address Pool Exhaustion: 20-Jun-2011
Dec-07 Jun-08 http://www.potaroo.net/tools/ipv4/index.html
So what will the Future Internet be?
? ? ?
IP Header
G Fairhurst, http://www.erg.abdn.ac.uk
G Fairhurst, http://www.erg.abdn.ac.uk 15 16 31
0
An Internet that builds on IPv4
4
Internet will continue to evolve slowly...
Packet Decodes
An Internet that deploys IPv6
TTL
Ethernet Header
NAT-free host-to-host via IPv6
16-bit total length flags 13-bit fragment offset
16-bit header checksum protocol 32-bit source IP address 32-bit destination IP address
PDU Header Chart
Autoconfig /provider-independent addressing
IHL ToS 16-bit identification
options (if any)
Hexadecimal Packet dump
20 bytes
Mobility (?) And new stuff...
A “clean slate” design of a new network architecture Transition to something better
0: 16: 32: 48: 64: 80: 96: 112: 128: 144: 160: 176: 192: 208:
0100 00cc dc3e 69c0 6219 3233 aca5 88b8 8820 0a88 7039 9128 0958 8a29
5e02 e206 7982 0752 9118 ba00 4819 4bf8 a381 3287 0b26 ca21 8092 0183
dc3e 0000 7982 bb5f 5128 e892 9088 3940 a21f 59ab e898 7822 993f fb15
00d0 7111 00b8 fe39 ffc8 a00c 0b39 d024 3bc0 e980 99ab 2971 b3b0 b888
bbf7 a1a9 08a0 3600 1321 1a3c 64ba 0a98 9298 1211 b118 090a 2922 0d4c
c6c0 84b9 8005 8808 bc10 0a28 43a0 8b0b e893 4002 a1aa 2194 337a
0800 8476 dbc6 b120 933e 37ab b9a8 1703 90bd 2208 a702 98d0 0f88
4500 e002 d721 8933 aa23 012d 04b3 0a3a 042a 98b1 9ac4 27bb 8810
Encapsulation
UDP Header
data
RFC 791
And finally....
G Fairhurst, http://www.erg.abdn.ac.uk
0
15 16
31
16-bit source port
16-bit destination port
16-bit UDP length
16-bit UDP checksum
8 bytes
data (if any)
RFC 768
G Fairhurst, http://www.erg.abdn.ac.uk ETHER Packet size = 218 bytes Destination = 1:0:5e:2:dc:3e, (multicast) (01-00-5e-02-dc-3e) Source = 0:d0:bb:f7:c6:c0, Ethertype = 0800 (IPv4) IP Version = 4, Header length = 20 bytes Type of service = 0x00 Total length = 204 bytes (00cc) ID = 57862, Flags = 0x00, Frags = 0 Time To Live = 113 seconds/hops 0: 0100 5e02 dc3e Protocol = 17 (UDP) Header checksum = a1a9 16: 00cc e206 0000 Source address = 132.185.132.118 32: dc3e 7982 7982 Destination address = 224.2.220.62 48: 69c0 0752 bb5f No options 64: 6219 9118 5128 UDP Source port = 31106 (7982) 80: 3233 ba00 e892 Destination port = 31106 (7982) 96: aca5 4819 9088 Length = 184 (00b8) 112: 88b8 4bf8 3940 Checksum = 08a0 RTP 128: 8820 a381 a21f 180B of Data 144: 0a88 3287 59ab
160: 176: 192: 208:
7039 9128 0958 8a29
0b26 ca21 8092 0183
e898 7822 993f fb15
Topics to be examined - Everything on the syllabus (includes lab & tutorials) 00d0 7111 00b8 fe39 ffc8 a00c 0b39 d024 3bc0 e980 99ab 2971 b3b0 b888
bbf7 a1a9 08a0 3600 1321 1a3c 64ba 0a98 9298 1211 b118 090a 2922 0d4c
c6c0 84b9 8005 8808 bc10 0a28 43a0 8b0b e893 4002 a1aa 2194 337a
0800 8476 dbc6 b120 933e 37ab b9a8 1703 90bd 2208 a702 98d0 0f88
4500 e002 d721 8933 aa23 012d 04b3 0a3a 042a 98b1 9ac4 27bb 8810
Topics excluded - Calculation of link CRC (but know what it does!) - Algorithm for DPLL (but know what it does!) - Calculation of packet checksum (but know what it does!) Topics not covered this year - IP router fragmentation - Path MTU Discovery