Beruflich Dokumente
Kultur Dokumente
Disclaimer
These slides have been adapted from J. F. Kurose and K. W. Ross slides provided on the books (Computer Networking A Top Down Approach, 5th edition) resource website
Network layer
transport segment from sending to receiving host on sending side encapsulates segments into datagrams on receiving side, delivers segments to transport layer network layer protocols in every host, router router examines header fields in all IP datagrams passing through it
analogy:
routing: process of
1
3 2
Connection setup
3rd important function in some network architectures:
network: between two hosts (may also involve intervening routers in case of VCs) transport: between two processes
2011 Khurram Aziz Department of EE, CIIT Abbottabad EEE-314: Data Communication & Computer Networks
ATM
ATM ATM ATM
2011 Khurram Aziz
CBR
VBR ABR UBR
yes
yes yes yes
yes
yes no no
Network layer connection and connection-less service datagram network provides network-layer connectionless service VC network provides network-layer connection service analogous to the transport-layer services, but:
service: host-to-host no choice: network provides one or the other implementation: in network core
Virtual circuits
source-to-dest path behaves much like telephone circuit performance-wise network actions along source-to-dest path
call setup, teardown for each call before data can flow each packet carries VC identifier (not destination host address) every router on source-dest path maintains state for each passing connection link, router resources (bandwidth, buffers) may be allocated to VC (dedicated resources = predictable service)
2011 Khurram Aziz Department of EE, CIIT Abbottabad EEE-314: Data Communication & Computer Networks
VC implementation
a VC consists of:
1. path from source to destination 2. VC numbers, one number for each link along path 3. entries in forwarding tables in routers along path
packet belonging to VC carries VC number (rather than dest address) VC number can be changed on each link.
New VC number comes from forwarding table
interface number
Incoming VC # Outgoing interface Outgoing VC #
22 18 17 87
application transport 5. Data flow begins network 4. Call connected 1. Initiate call data link physical
Datagram networks
no call setup at network layer routers: no state about end-to-end connections
no network-level concept of connection
1. Send data
2. Receive data
Forwarding table
Destination Address Range
11001000 00010111 00010000 00000000 through 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 through 11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000 through 11001000 00010111 00011111 11111111 otherwise
2011 Khurram Aziz Department of EE, CIIT Abbottabad
Link Interface 0 1 2 3
ATM (VC)
evolved from telephony human conversation: strict timing, reliability requirements need for guaranteed service dumb end systems telephones complexity inside network
Network layer
forwarding table
IP datagram format
how much overhead with TCP? 20 bytes of TCP + 20 bytes of IP = 40 bytes + app layer overhead
2011 Khurram Aziz
reassembly
offset =0
One large datagram becomes several smaller datagrams length ID fragflag =1500 =x =1 length ID fragflag =1500 =x =1 offset =0 offset =185 offset =370
IP Addressing: introduction
IP address: 32-bit identifier for host, router interface interface: connection between host/router and physical link
routers typically have multiple interfaces host typically has one interface IP addresses associated with each interface
223.1.1.1
223.1.1.2 223.1.1.4 223.1.1.3 223.1.2.1 223.1.2.9 223.1.2.2
223.1.3.27
223.1.3.1
223.1.3.2
Subnets
IP address:
subnet part (high order bits) host part (low order bits)
223.1.1.1 223.1.1.2 223.1.1.4
223.1.1.3 223.1.2.1 223.1.2.9 223.1.2.2
Whats a subnet ?
device interfaces with same subnet part of IP address can physically reach each other without intervening router
223.1.3.27
subnet
223.1.3.1 223.1.3.2
Subnets
Recipe To determine the subnets, detach each interface from its host or router, creating islands of isolated networks. Each isolated network is called a subnet.
223.1.1.0/24
223.1.2.0/24
223.1.3.0/24
Subnets
How many?
223.1.1.1
223.1.1.2
223.1.1.4
223.1.1.3
223.1.9.2
223.1.7.0
223.1.7.1
223.1.3.27
223.1.3.2
IP addressing: CIDR
CIDR: Classless InterDomain Routing
subnet portion of address of arbitrary length address format: a.b.c.d/x, where x is # bits in subnet portion of address
plug-and-play
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
Department of EE, CIIT Abbottabad EEE-314: Data Communication & Computer Networks
223.1.1.1
DHCP server
223.1.2.9
223.1.2.1
223.1.1.2 223.1.1.4
B
223.1.1.3 223.1.3.1 223.1.3.27
223.1.2.2 223.1.3.2
arriving client
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
11001000 00010111 00010000 00000000 200.23.16.0/20 11001000 11001000 11001000 .. 11001000 00010111 00010000 00000000 200.23.16.0/23 00010111 00010010 00000000 200.23.18.0/23 00010111 00010100 00000000 200.23.20.0/23 . . 00010111 00011110 00000000 200.23.30.0/23
IP addressing: the last word... Q: How does an ISP get block of addresses? A: ICANN: Internet Corporation for Assigned Names and Numbers
allocates addresses manages DNS assigns domain names, resolves disputes
10.0.0.1
10.0.0.2
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
Datagrams with source or destination in this network have 10.0.0/24 address for source, destination (as usual)
EEE-314: Data Communication & Computer Networks
range of addresses not needed from ISP: just one IP address 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).
2011 Khurram Aziz Department of EE, CIIT Abbottabad EEE-314: Data Communication & Computer Networks
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, 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
2011 Khurram Aziz Department of EE, CIIT Abbottabad EEE-314: Data Communication & Computer Networks
10.0.0.1
1
10.0.0.4
S: 128.119.40.186, 80 D: 10.0.0.1, 3345
10.0.0.2
138.76.29.7
S: 128.119.40.186, 80 D: 138.76.29.7, 5001
10.0.0.3 4: NAT router changes datagram dest addr from 138.76.29.7, 5001 to 10.0.0.1, 3345
EEE-314: Data Communication & Computer Networks
NAT is controversial:
routers should only process up to layer 3 violates end-to-end argument
NAT possibility must be taken into account by app designers, eg, P2P applications
Client
?
10.0.0.4
solution 1: statically configure NAT to forward incoming connection requests at given port to server
e.g., (123.76.29.7, port 2500) always forwarded to 10.0.0.1 port 25000
138.76.29.7
NAT router
2011 Khurram Aziz Department of EE, CIIT Abbottabad EEE-314: Data Communication &
IGD
10.0.0.4 138.76.29.7
learn public IP address (138.76.29.7) add/remove port mappings (with lease times)
NAT router
2011 Khurram Aziz Department of EE, CIIT Abbottabad EEE-314: Data Communication &
NATed client establishes connection to relay External client connects to relay relay bridges packets between to connections 2. connection to
relay initiated by client
Client
3. relaying established
10.0.0.1
NAT router
2011 Khurram Aziz Department of EE, CIIT Abbottabad EEE-314: Data Communication &
8 9 10 11 12
0 0 0 0 0
When ICMP message arrives, source calculates RTT Traceroute does this 3 times Stopping criterion UDP segment eventually arrives at destination host Destination returns ICMP host unreachable packet (type 3, code 3) When source gets this ICMP, stops.
IPv6
Initial motivation: 32-bit address space soon to be completely allocated. Additional motivation:
header format helps speed processing/forwarding header changes to facilitate QoS IPv6 datagram format: fixed-length 40 byte header no fragmentation allowed
2011 Khurram Aziz Department of EE, CIIT Abbottabad EEE-314: Data Communication & Computer Networks
Tunneling
Logical view: Physical view: A
IPv6
B
IPv6
tunnel
E
IPv6
F
IPv6
B
IPv6 IPv4
E
IPv4
IPv6
F
IPv6
IPv6
Tunneling
Logical view: A
IPv6
B
IPv6
tunnel
E
IPv6
F
IPv6
Physical view:
A
IPv6
Flow: X Src: A Dest: F
B
IPv6
C
IPv4
D
IPv4
E
IPv6
F
IPv6
Flow: X Src: A Dest: F data
Src:B Dest: E
Flow: X Src: A Dest: F data
Src:B Dest: E
Flow: X Src: A Dest: F data
data
A-to-B: IPv6
2011 Khurram Aziz
E-to-F: B-to-C: IPv6 IPv6 inside IPv4 EEE-314: Data Communication & Computer Networks
1
3 2
Speed of Convergence
LS: O(n2) algorithm requires O(nE) msgs may have oscillations DV: convergence time varies may be routing loops count-to-infinity problem
DV:
DV node can advertise incorrect path cost each nodes table used by others
error propagate thru network
Hierarchical Routing
Our routing study thus far - idealization all routers identical network flat not true in practice
scale: with 200 million destinations:
cant store all dests in routing tables! routing table exchange would swamp links!
administrative autonomy
internet = network of networks each network admin may want to control routing in its own network
Hierarchical Routing
aggregate routers into regions, autonomous systems (AS) routers in same AS run same routing protocol
intra-AS routing protocol routers in different AS can run different intra-AS routing protocol
Interconnected ASes
3a 3b AS3 1a 1d
3c
2a 1c 1b AS1
2c
2b
Forwarding table
Inter-AS tasks
suppose router in AS1 receives datagram destined outside of AS1: router should forward packet to gateway router, but which one?
AS1 must: 1. learn which destinations are reachable through AS2, which through AS3 2. propagate this reachability info to all routers in AS1 Job of inter-AS routing!
3c
3b
3a AS3 1a
1c 1d
2a 1b
AS1
2c
AS2
2b
3c
1c 1d 1b AS1
2a
2b AS2
2c
3a 3b AS3 1a
3c
AS2
2b
1d
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Hot potato routing: Choose the gateway that has the smallest least cost
Intra-AS Routing
also known as Interior Gateway Protocols (IGP) most common Intra-AS routing protocols:
u
A B
z
2011 Khurram Aziz
x
y
From router A to subnet destination hops u 1 v 2 w 2 x 3 y 3 EEE-314: Data Communication & Computer Networks z 2
RIP advertisements
distance vectors: exchanged among neighbors every 30 sec via Response Message (also called advertisement) each advertisement: list of up to 25 destination subnets within AS
RIP: Example
z
w A x D C
Destination Network Next Router Num. of hops to dest.
w y z x
.
2011 Khurram Aziz
A B B -.
Department of EE, CIIT Abbottabad
2 2 7 1
....
EEE-314: Data Communication & Computer Networks
Routing/Forwarding table in D
RIP: Example
Dest w x z . Next C hops 1 1 4 ...
Advertisement from A to D
z
x D
Next Router
Destination Network
w y z x
2011 Khurram Aziz
2 2 7 5 1
routes via neighbor invalidated new advertisements sent to neighbors neighbors in turn send out new advertisements (if tables changed) link failure info quickly (?) propagates to entire net poison reverse used to prevent ping-pong loops (infinite distance = 16 hops)
2011 Khurram Aziz Department of EE, CIIT Abbottabad EEE-314: Data Communication & Computer Networks
routed
Transprt (UDP) network forwarding (IP) table
routed
Transprt (UDP) network (IP)
forwarding table
link
physical
2011 Khurram Aziz Department of EE, CIIT Abbottabad
link
physical
EEE-314: Data Communication & Computer Networks
OSPF advertisement carries one entry per neighbor router advertisements disseminated to entire AS (via flooding)
carried in OSPF messages directly over IP (rather than TCP or UDP
Hierarchical OSPF
Hierarchical OSPF
two-level hierarchy: local area, backbone.
Link-state advertisements only in area each nodes has detailed area topology; only know direction (shortest path) to nets in other areas.
area border routers: summarize distances to nets in own area, advertise to other Area Border routers. backbone routers: run OSPF routing limited to backbone. boundary routers: connect to other ASs.
BGP basics
pairs of routers (BGP peers) exchange routing info over semipermanent TCP connections: BGP sessions
AS2 promises it will forward datagrams towards that prefix. AS2 can aggregate prefixes in its advertisement
3c 3a 3b AS3 1a AS1
eBGP session iBGP session
1c 1d
1b
2a
2c
AS2
2b
1c can then use iBGP do distribute new prefix info to all routers in AS1 1b can then re-advertise new reachability info to AS2 over 1b-to-2a eBGP session
when router learns of new prefix, it creates entry for prefix in its forwarding table.
eBGP session iBGP session
3c 3a 3b AS3 1a AS1
1c 1d
1b
2a
2c
AS2
2b
when gateway router receives route advertisement, uses import policy to accept/decline.
2011 Khurram Aziz Department of EE, CIIT Abbottabad EEE-314: Data Communication & Computer Networks
BGP messages
BGP messages exchanged using TCP. BGP messages:
OPEN: opens TCP connection to peer and authenticates sender UPDATE: advertises new path (or withdraws old) KEEPALIVE keeps connection alive in absence of UPDATES; also ACKs OPEN request NOTIFICATION: reports errors in previous msg; also used to close connection
2011 Khurram Aziz Department of EE, CIIT Abbottabad EEE-314: Data Communication & Computer Networks
legend:
X
A C
A,B,C are provider networks X,W,Y are customer (of provider networks) X is dual-homed: attached to two networks
X does not want to route from B via X to C .. so X will not advertise to B a route to C
2011 Khurram Aziz Department of EE, CIIT Abbottabad EEE-314: Data Communication & Computer Networks
legend:
X
A C
A advertises path AW to B
No way! B gets no revenue for routing CBAW since neither W nor C are Bs customers B wants to force C to route to w via A B wants to route only to/from its customers!
Policy:
Inter-AS: admin wants control over how its traffic routed, who routes through its net. Intra-AS: single admin, so no policy decisions needed
Scale:
hierarchical routing saves table size, reduced update traffic Performance: Intra-AS: can focus on performance Inter-AS: policy may dominate over performance
Broadcast Routing
deliver packets from source to all other nodes source duplication is inefficient:
duplicate
R1
duplicate creation/transmission
R1
duplicate
R2
R3 R4 R3
R2 R4
source duplication
in-network duplication
In-network duplication
flooding: when node receives brdcst pckt, sends copy to all neighbors
Problems: cycles & broadcast storm
controlled flooding: node only brdcsts pkt if it hasnt brdcst same packet before
Node keeps track of pckt ids already brdcsted Or reverse path forwarding (RPF): only forward pckt if it arrived on shortest path between node and source
spanning tree
No redundant packets received by any node
2011 Khurram Aziz Department of EE, CIIT Abbottabad EEE-314: Data Communication & Computer Networks
Spanning Tree
First construct a spanning tree Nodes forward copies only along spanning tree
A A B D F G c B
D G
Source-based trees & Computer Networks SharedDepartment tree of EE, CIIT Abbottabad EEE-314: Data Communication
Chapter 4: summary
4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 Whats inside a router 4.4 IP: Internet Protocol
Datagram format IPv4 addressing ICMP IPv6