Application layer - Summary specific protocols: HTTP FTP SMTP, POP, IMAP DNS P2P
Application architectures client-server P2P hybrid Application service
requirements:
reliability, bandwidth, delay, security
typical request/reply
message exchange:
client requests info or service server responds with data, status code
message formats: headers: fields giving info about data data: info being communicated
service model
connection-oriented, reliable: TCP unreliable, datagrams: UDP
25/9-09
Most importantly: learned about protocols
Internet transport
Application layer: Summary
25/9-09
Datakommunikation - Jonny Pettersson, UmU
Transport layer: Summary
control vs. data msgs
in-band, out-of-band
centralized vs. decentralized stateless t t l vs. stateful t t f l reliable vs. unreliable msg
transfer
“complexity at network
edge”
Datakommunikation - Jonny Pettersson, UmU
A day in the life: scenario DNS server
browser
Application
principles behind
Comcast network 68.80.0.0/13
transport layer services:
multiplexing/demultiplexing reliable data transfer flow control congestion control instantiation and implementation in the Internet UDP TCP
UDP
TCP
25/9-09
IP
web page
Link
Network Layer behind network layer services:
forwarding routing (path selection) dealing with scale how a router works advanced topics: IPv6, multicast
instantiation and
implementation in the Internet
network layer services virtual circuit and datagram
networks IP: Internet Protocol
IPv4 datagram format IPv4 addressing DHCP NAT ICMP (IPv6 – later)
(what’s inside a router?) next time
25/9-09
25/9-09
Google’s network 64.233.160.0/19
Datakommunikation - Jonny Pettersson, UmU
Network layer functions Overview:
understand principles
web server 64.233.169.105
Physical
Datakommunikation - Jonny Pettersson, UmU
Goals:
school network 68.80.2.0/24
routing algorithms routing in the Internet (broadcast and multicast routing)
Datakommunikation - Jonny Pettersson, UmU
transport segments from
sending to receiving hosts
network layer protocols in
every host, router
three important functions: routing: g determine route taken by packets from source to dest. Routing algorithms forwarding: move packets from router’s input to appropriate router output call setup: some network architectures require router call setup along path before data flows 25/9-09
application transport network data link physical network data link physical
network data link physical network data link physical
network data link physical network data link physical
network network t k data link data link physical physical network data link physical
network data link physical
network data link physical
network data link physical
application transport network data link physical
Datakommunikation - Jonny Pettersson, UmU
1
Interplay between routing and forwarding routing algorithm
Q: What service model for “channel” transporting datagrams from sender to receiver?
local forwarding table header value output link 0100 0101 0111 1001
Example services for individual datagrams: guaranteed t dd delivery li guaranteed delivery with less than 40 msec delay
3 2 2 1
value in arriving packet’s header 0111
1 3 2
25/9-09
25/9-09
Datakommunikation - Jonny Pettersson, UmU
Internet
Guarantees ? Congestion Bandwidth Loss Order Timing feedback
best effort none
ATM
CBR
ATM
VBR
ATM
ABR
ATM
25/9-09
Service Model
UBR
constant rate guaranteed rate guaranteed minimum none
no
no
no
yes
yes
yes
yes
yes
yes
no
yes
no
no (inferred via loss) no congestion no congestion yes
no
yes
no
no
Virtual Circuit Switching (VCS) VC - Virtual circuit Tre steg Uppkoppling (call setup) Dataöverföring Nedkoppling Varje paket har en VC identifierare Unik identifierare för varje hopp Varje router på vägen lagrar tillstånd för varje koppling Länk Länk- och routerresurser kan allokerars
25/9-09
Datakommunikation - Jonny Pettersson, UmU
Identifierare i headern Virtual circuit (connection-oriented) Datagram (connectionless) Vad krävs Unika adresser Identifiera enskilda portar i en router/switch
25/9-09
Datakommunikation - Jonny Pettersson, UmU
application transport 5. Data flow begins network 4. Call connected data link 1. Initiate call physical
Example services for a flow of datagrams: in-order in order datagram delivery guaranteed minimum bandwidth to flow restrictions on changes in interpacket spacing
Hur “förmedlar” man data?
Network layer service models: Network Architecture
Network service model
6. Receive data application 3. Accept call transport 2. incoming call network
Datakommunikation - Jonny Pettersson, UmU
Kännetecken för VCS Minst 1 RTT fördröjning vid uppkoppling Liten OH för varje datapaket Vid fel, riv allt och koppla nytt Hur vet switchen vägen till destinationen? När kopplingen är uppe En väg finns Meddelanden kommer att skickas vidare Resursallokering
data link physical
25/9-09
Datakommunikation - Jonny Pettersson, UmU
2
Datagram networks: the Internet model Varje paket har info om destinationen, ingen call setup
Forwarding table
4 billion possible entries
Routers har inga “tillstånd”
“Forwarding” tabell, uppdateras av bakgrundsprocess
Destination Address Range
Kännetecken
Paket kan skickas när som helst och var som helst Sändaren vet inte om paketet kan levereras Paket hanteras oberoende av varandra Kan hitta h vägar runt problem bl
application transport network data link 1. Send data physical
application transport 2. Receive data network data link physical
Link Interface
11001000 00010111 00010000 00000000 through 11001000 00010111 00010111 11111111
0
11001000 00010111 00011000 00000000 through 11001000 00010111 00011000 11111111
1
11001000 00010111 00011001 00000000 through 11001000 00010111 00011111 11111111
2
otherwise 25/9-09
25/9-09
Datakommunikation - Jonny Pettersson, UmU
Longest prefix matching Prefix Match 11001000 00010111 00010 11001000 00010111 00011000 11001000 00010111 00011 otherwise
Datagram eller VC nätverk
Link Interface 0 1 2 3
Examples DA: 11001000 00010111 00010110 10100001
Which interface?
DA: 11001000 00010111 00011000 10101010
Which interface?
25/9-09
Datakommunikation - Jonny Pettersson, UmU
The Internet Network layer Host, router network layer functions: Transport layer: TCP, UDP
Network N t k layer
IP protocol •addressing conventions •datagram g format •packet handling conventions
Routing protocols •path selection •RIP RIP, OSPF, OSPF BGP
forwarding table
ICMP protocol •error reporting •router “signaling”
Link layer physical layer 25/9-09
Datakommunikation - Jonny Pettersson, UmU
3 Datakommunikation - Jonny Pettersson, UmU
Contention Flera paket vill till samma länk samtidigt
Congestion När köerna i routern är fulla och paket börjar slängas Datagram Bryr sig inte inte, kontroll högre upp Högt utnyttjande Smarta ändsystem VCS “Hop-by-hop” flödeskontroll Konservativt QoS Dumma ändsystem 25/9-09
Datakommunikation - Jonny Pettersson, UmU
IP datagram format (IPv4) IP protocol version number header length (bytes) “type” of data max number remaining hops (decremented at each router) upper layer protocol to deliver payload to
how much overhead with TCP? 20 bytes of TCP 20 bytes of IP = 40 bytes + app layer overhead
32 bits ver head. type of len service
length
fragment 16-bit identifier flgs offset time to upper header layer live checksum
total datagram length (bytes) for fragmentation/ reassembly
32 bit source IP address 32 bit destination IP address Options (if any)
data (variable length, typically a TCP or UDP segment)
E.g. timestamp, record route taken, specify list of routers to visit
Datakommunikation - Jonny Pettersson, UmU
3
Fragmentering och hopsättning Ident
Flags
IP Fragmentation and Reassembly
Offset
Example 4000 byte datagram MTU = 1500 bytes
MTU varierar i olika nät, två val Alla
paket tillräckligt små Fragmentering g g och hopsättning p g Alla fragment har samma Ident
length ID fragflag offset =4000 =x =0 =0 One large datagram becomes several smaller datagrams length ID fragflag offset =1500 =x =1 =0
1480 bytes in data field
Tappas ett fragment slängs alla Varje fragment fullständigt IP-datagram
length ID fragflag offset =1500 =x =1 =185
offset = 1480/8
Hopsättning hos mottagaren
length ID fragflag offset =1020 =x =0 =370
Designat för ytterligare fragmentering 25/9-09
25/9-09
Datakommunikation - Jonny Pettersson, UmU
IP addressing: CIDR
IP Addressing: introduction IP address: 32-bit
identifier for host, router interface interface: connection between host/router and physical link
223.1.2.1
223.1.1.3
223.1.2.2
1
1
223.1.1.0/24
IP address: subnet part (high order bits) host part (low order bits)
What’ss a subnet ? What
device interfaces with same subnet part of IP address can physically reach each other without intervening router
223.1.2.0/24
223.1.1.1
host part
subnet part
11001000 00010111 00010000 00000000 200.23.16.0/23
1
25/9-09
Datakommunikation - Jonny Pettersson, UmU
Subnets
portion of address of arbitrary length format: a.b.c.d/x, where x is # bits in subnet portion of address
address
router’s typically have 223.1.3.2 223.1.3.1 multiple interfaces host may have multiple interfaces IP addresses associated with each 223.1.1.1 = 11011111 00000001 00000001 00000001 interface
25/9-09
subnet
223.1.2.9
223.1.3.27
223
CIDR: Classless InterDomain Routing
223.1.1.1 223.1.1.2 223.1.1.4
Datakommunikation - Jonny Pettersson, UmU
Datakommunikation - Jonny Pettersson, UmU
Subnets
223.1.1.2
How many?
223.1.1.1
223.1.1.4
223.1.2.1 223.1.1.2 223.1.1.4 223.1.1.3
223.1.1.3 223.1.2.9
223.1.3.27
223.1.9.2
223.1.2.2
223.1.7.0
LAN 223.1.3.1
223.1.9.1
223.1.3.2
223.1.7.1 223.1.8.1
223.1.3.0/24
223.1.8.0
223.1.2.6
network consisting of 3 subnets
223.1.2.1
223.1.3.27 223.1.2.2
223.1.3.1
223.1.3.2
Subnet mask: /24 25/9-09
Datakommunikation - Jonny Pettersson, UmU
25/9-09
Datakommunikation - Jonny Pettersson, UmU
4
Speciella adresser
IP addresses: how to get one?
Nätverksadresser har HostId fylld med 0 127/8 - Reserverad för loopback
hard-coded by system admin in a file
0.0.0.0 - Den här maskinen
Windows:
Bara 1’or - Broadcast i lokalt nät Bara 1’or i HostId - Broadcast i SubnetId Det krävs en IP-adress för varje interface
i en maskin
25/9-09
Q: How does a host get IP address?
control-panel->network->configurationcontrol panel >network >configuration >tcp/ip->properties UNIX: /etc/rc.config DHCP: Dynamic Host Configuration Protocol: dynamically get address from a server “plug-and-play” 25/9-09
Datakommunikation - Jonny Pettersson, UmU
DHCP: Dynamic Host Configuration Protocol
Datakommunikation - Jonny Pettersson, UmU
DHCP client-server scenario
Goal: allow host to dynamically obtain its IP address from network server when it joins network
A 223.1.1.1
Can renew its lease on address in use Allows reuse of addresses (only hold address while connected and “on”) Support for mobile users who want to join network (more shortly)
B
25/9-09
DHCP client-server scenario DHCP server: 223.1.2.5
DHCP discover src : 0.0.0.0, 68 dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID: 654
DHCP offer src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 ttransaction a sact o ID: 654 65 Lifetime: 3600 secs
DHCP request
time
src: 0.0.0.0, 68 dest:: 255.255.255.255, 67 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs
DHCP ACK src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs
25/9-09
Datakommunikation - Jonny Pettersson, UmU
arriving client
223.1.2.9 223.1.2.2
223.1.3.1
25/9-09
Datakommunikation - Jonny Pettersson, UmU
223.1.1.2 223.1.1.4 223.1.1.3
DHCP overview: host broadcasts “DHCP discover” msg DHCP server responds with “DHCP offer” msg host requests IP address: “DHCP request” msg DHCP server sends address: “DHCP ack” msg
223.1.2.1
DHCP server
223.1.3.27
E
223.1.3.2
arriving DHCP client needs address in this network
Datakommunikation - Jonny Pettersson, UmU
IP addresses: how to get one? Q: How does network get subnet part of IP address? A: gets allocated portion of its provider ISP’s address space ISP's block
11001000 00010111 00010000 00000000
200.23.16.0/20
Organization 0 Organization 1 Organization 2 ...
11001000 00010111 00010000 00000000 11001000 00010111 00010010 00000000 11001000 00010111 00010100 00000000 ….. ….
200.23.16.0/23 200.23.18.0/23 200.23.20.0/23 ….
Organization 7
11001000 00010111 00011110 00000000
200.23.30.0/23
25/9-09
Datakommunikation - Jonny Pettersson, UmU
5
Hierarchical addressing: route aggregation Hierarchical addressing allows efficient advertisement of routing information:
Hierarchical addressing: more specific routes ISPs-R-Us has a more specific route to Organization 1 Organization 0
Organization 0
200.23.16.0/23
200.23.16.0/23 Organization 1
200.23.18.0/23
Organization 2
200.23.20.0/23
Organization 7
. . .
. . .
Fly-By-Night-ISP
“Send Send me anything with addresses beginning 200.23.16.0/20”
Organization 2
200.23.20.0/23
Internet
200.23.30.0/23 ISPs-R-Us
25/9-09
“Send me anything with addresses beginning 199.31.0.0/16”
Datakommunikation - Jonny Pettersson, UmU
IP addressing: the last word...
Organization 7
25/9-09
Datakommunikation - Jonny Pettersson, UmU
NAT: Network Address Translation Motivation: local network uses just one IP address as
far as outside world is concerned: no need to be allocated range of addresses from ISP: - just one IP address is used for all devices can change addresses of devices in local network without notifying outside world can change ISP without changing addresses of devices in local network devices inside local net not explicitly addressable, visible by outside world (a security plus)
25/9-09
Datakommunikation - Jonny Pettersson, UmU
. . .
Fly-By-Night-ISP
Internet
200.23.30.0/23 “Send me anything with addresses beginning 199.31.0.0/16 or 200.23.18.0/23”
ISPs-R-Us Organization 1
200.23.18.0/23
25/9-09
Datakommunikation - Jonny Pettersson, UmU
NAT: Network Address Translation
Q: How does an ISP get block of addresses? A: ICANN: Internet Corporation for Assigned Names and Numbers allocates addresses manages DNS root servers assigns domain names, resolves disputes in Europe delegated to RIPE
. . .
“Send me anything with addresses beginning 200.23.16.0/20”
rest of Internet
local network (e.g., home network) 10.0.0/24 10.0.0.4
10.0.0.1 10.0.0.2
138 76 29 7 138.76.29.7 10.0.0.3
All datagrams leaving local network have same single source NAT IP address: 138.76.29.7, different source port numbers 25/9-09
Datagrams with source or destination in this network have 10.0.0/24 address for source, destination (as usual)
Datakommunikation - Jonny Pettersson, UmU
NAT: Network Address Translation Implementation: NAT router must: outgoing
datagrams: replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #) . . . remote clients/servers will respond using (NAT IP address address, new port #) as destination addr
remember
(in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair
incoming
datagrams: replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table
25/9-09
Datakommunikation - Jonny Pettersson, UmU
6
NAT: Network Address Translation 2: NAT router changes datagram source addr from 10.0.0.1, 3345 to 138.76.29.7, 5001, updates table 2
NAT translation table WAN side addr LAN side addr
NAT: Network Address Translation
1: host 10.0.0.1 sends datagram to 128.119.40.186, 80
138.76.29.7, 5001 10.0.0.1, 3345 …… ……
S: 10.0.0.1, 3345 D: 128.119.40.186, 80 S: 138.76.29.7, 5001 D: 128.119.40.186, 80
10.0.0.4
138.76.29.7 S: 128.119.40.186, 80 D: 138.76.29.7, 5001
3
3: Reply arrives dest. address: 138.76.29.7, 5001 25/9-09
10 0 0 1 10.0.0.1
1
10.0.0.2
S: 128.119.40.186, 80 D: 10.0.0.1, 3345
10.0.0.3 4: NAT router changes datagram dest addr from 138.76.29.7, 5001 to 10.0.0.1, 3345
server address 10.0.0.1 local Client to LAN (client can’t use it as destination addr) only one externally visible NATted address: 138.76.29.7 138 76 29 7
? 10.0.0.4
138.76.29.7
NAT router
NAT traversal problem NATed
client establishes connection to relay external client connects to relay relay bridges packets between connections
25/9-09
3. relaying established
address
IPv6
shortage should instead be solved by
Datakommunikation - Jonny Pettersson, UmU
Play (UPnP) Internet Gateway Device (IGD) Protocol. Allows NATted host to: learn public IP address (138 76 29 7) (138.76.29.7) add/remove port mappings (with lease times)
10.0.0.1
IGD 10.0.0.4 138.76.29.7
NAT router
1. connection to relay initiated by NATted host 138.76.29.7
Datakommunikation - Jonny Pettersson, UmU
ICMP: Internet Control Message Protocol
solution 3: relaying (used in Skype)
Client
should only process up to layer 3 end-to-end argument
• NAT possibility must be taken into account by app designers, eg, P2P applications
25/9-09
Datakommunikation - Jonny Pettersson, UmU
2. connection to relay initiated by client
violates
i.e., automate static NAT port map configuration
e.g., (123.76.29.7, port 2500) always forwarded to 10.0.0.1 port 25000
25/9-09
routers
solution 2: Universal Plug and 10.0.0.1
configure NAT to forward incoming connection requests at given port to server
NAT is controversial:
NAT traversal problem
server with address 10.0.0.1
solution 1: statically
simultaneous connections with a single LAN-side address!
25/9-09
Datakommunikation - Jonny Pettersson, UmU
client wants to connect to
60,000
4
NAT traversal problem
16-bit port-number field:
NAT router
Datakommunikation - Jonny Pettersson, UmU
10.0.0.1
used by hosts & routers to
communicate network-level information error reporting: unreachable host, network, port, protocol echo request/reply (used by ping) network-layer “above” IP: ICMP msgs carried in IP datagrams ICMP message: type, code plus first 8 bytes of IP datagram causing error
25/9-09
Type 0 3 3 3 3 3 3 4
Code 0 0 1 2 3 6 7 0
8 9 10 11 12
0 0 0 0 0
description echo reply (ping) dest. network unreachable dest host unreachable dest protocol unreachable dest port unreachable dest network unknown dest host unknown source quench (congestion control - not used) echo request (ping) route advertisement router discovery TTL expired bad IP header
Datakommunikation - Jonny Pettersson, UmU
7
Traceroute and ICMP Source sends series of
When ICMP message
UDP segments to dest
First has TTL =1 Second has TTL=2, etc. Unlikely port number
When nth datagram arrives
to nth router:
Router discards datagram And sends to source an ICMP message (type 11, code 0) Message includes name of router & IP address
25/9-09
arrives, source calculates RTT Traceroute does this 3 times Stopping criterion UDP segment eventually arrives at destination host Destination returns ICMP “dest port unreachable” packet (type 3, code 3) When source gets this ICMP, stops
Datakommunikation - Jonny Pettersson, UmU
Input Port Functions
Router Architecture Overview Two key router functions:
run routing algorithms/protocol (RIP, OSPF, BGP)
forwarding datagrams from incoming to outgoing link
25/9-09
Datakommunikation - Jonny Pettersson, UmU
Input Port Queuing Fabric slower than input ports combined -> queueing
may occur at input queues
Head-of-the-Line (HOL) blocking: queued datagram
Physical layer: bit-level reception Data link layer: e.g., Ethernet see chapter 5
at front of queue prevents others in queue from moving forward
queueing delay and loss due to input buffer overflow!
Decentralized switching: given datagram dest., lookup output port
using routing table in input port memory
goal: complete input port processing at
‘line speed’
queuing: if datagrams arrive faster than
forwarding rate into switch fabric
25/9-09
Datakommunikation - Jonny Pettersson, UmU
Three types of switching fabrics Via memory Via bus First generation datagram routers: from input packet copied port memory by system’s to output (single) CPU port memory speed limited via a shared by memory b bus b d id h (2 bandwidth bus crossings bus per datagram) contention: Modern routers: Via an interconection network switching overcome bus bandwidth input port speed limitations processor limited by performs Advanced design: bus lookup, copy fragmenting datagram into bandwidth into memory in fixed length cells, switch output port cells through the fabric 25/9-09
25/9-09
Datakommunikation - Jonny Pettersson, UmU
Output Ports
Buffering required when datagrams arrive from
Scheduling discipline chooses among queued
fabric faster than the transmission rate
datagrams for transmission
25/9-09
Datakommunikation - Jonny Pettersson, UmU
8
Output port queueing
How much buffering? RFC 3439 rule of thumb: average buffering
equal to “typical” RTT (say 250 msec) times link capacity C e.g.,
C = 10 Gps link: 2.5 Gbit buffer
Recent recommendation: with
buffering equal to RTT. C
N flows,
N
buffering when arrival rate via switch exceeds
output line speed
queueing (delay) and loss due to output port buffer overflow!
25/9-09
Datakommunikation - Jonny Pettersson, UmU
25/9-09
Datakommunikation - Jonny Pettersson, UmU
Summary network layer services virtual circuit and
datagram networks
IP: Internet Protocol IPv4 datagram format IPv4 addressing DHCP NAT ICMP
next time routing algorithms routing in the Internet broadcast and multicast routing
what’s inside a router?
25/9-09
Datakommunikation - Jonny Pettersson, UmU
9