Application layer - Summary. Application layer: Summary. Transport layer: Summary. Network Layer. Most importantly: learned about protocols

Application layer - Summary ˆ specific protocols:  HTTP  FTP  SMTP, POP, IMAP  DNS  P2P ˆ Application architectures  client-server  P2P  hybr...
Author: Elfrieda French
0 downloads 4 Views 433KB Size
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

Suggest Documents