Network Layer
CMPS 4750/6750: Computer Networks
1
Network Layer CMPS 4750/6750: Computer Networks 1 Outline - - PowerPoint PPT Presentation
Network Layer CMPS 4750/6750: Computer Networks 1 Outline Overview of network layer Forwarding (data plane) Routing (control plane) The Internet Protocol (IP) Routing in the Internet: OSPF, BGP 2 Network Layer application
1
2
3
application transport network data link physical 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 data link physical network data link physical network data link physical network data link physical network data link physical network data link physical
4
5
1 2 3 0111
values in arriving packet header
6
Routing Algorithm data plane control plane
Local forwarding table header 0100 0110 0111 1001 3 2 2 1
1 2 0111
values in arriving packet header
3
7
data plane control plane
Remote Controller CA
CA CA CA CA
1 2 0111 3
values in arriving packet header
8
9
10
high-seed switching fabric routing processor router input ports router output ports
forwarding data plane (hardware) operates in nanosecond timeframe routing, management control plane (software)
time frame
line termination link layer protocol (receive) lookup, forwarding queueing
decentralized switching: § using header field values, lookup output port using forwarding table in input port memory (“match plus action”) § goal: complete input port processing at ‘line speed’ § queuing: if datagrams arrive faster than forwarding rate into switch fabric physical layer: bit-level reception data link layer: e.g., Ethernet see chapter 5
switch fabric
line termination link layer protocol (receive) lookup, forwarding queueing
decentralized switching: § using header field values, lookup output port using forwarding table in input port memory (“match plus action”) § destination-based forwarding: forward based only on destination IP address (traditional) § generalized forwarding: forward based on any set of header field values physical layer: bit-level reception data link layer: e.g., Ethernet see chapter 5
switch fabric
13
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
Link Interface 1 2 3
forwarding table
14
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
Link Interface 1 2 3
forwarding table
15
Destination Address Range 11001000 00010111 00010*** ********* 11001000 00010111 00011000 ********* 11001000 00010111 00011*** *********
Link interface 1 2 3
DA: 11001000 00010111 00011000 10101010 examples: DA: 11001000 00010111 00010110 10100001 which interface? which interface?
1
16
high-seed switching fabric routing processor router input ports router output ports
17
input queues
Bipartite graph representation
18
blocked
switch fabric
assuming FCFS, green packet experiences HOL blocking
switch fabric
19
line termination link layer protocol (send) switch fabric datagram buffer queueing
20
at t, packets more from input to output
(assume switch operates at three times the line speed)
switch fabric switch fabric
21
queue (waiting area) packet arrivals packet departures link (server)
22
high priority queue (waiting area) low priority queue (waiting area) arrivals classify departures link (server)
1 3 2 4 5 5 5 2 2 1 1 3 3 4 4
arrivals departures packet in service
23
1 2 3 4 5 5 5 2 3 1 1 3 3 4 4
arrivals departures packet in service
24
25
27
28
u y
w v
2 2 1 3 1 1 2 5 3 5
29
u y
w v
2 2 1 3 1 1 2 5 3 5
cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)
30
31
32
1 Initialization: 2 N' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(u,v) 6 else D(v) = ∞ 7 8 Loop 9 find w not in N' such that D(w) is a minimum 10 add w to N' 11 for all v adjacent to w and not in N' : 12 D(v) = min( D(v), D(w) + c(w,v) ) 13 until all nodes in N' new cost to v is either
shortest path cost to w plus cost from w to v
33
w
3 4
v x u
5 3 7 4
y
8
z
2 7 9
Step N' D(v)
p(v)
1 2 3 4 5
D(w)
p(w)
D(x)
p(x)
D(y)
p(y)
D(z)
p(z)
u ∞ ∞ 7,u 3,u 5,u uw ∞
11,w
6,w 5,u
14,x 11,w
6,w uwx uwxv
14,x 10,v
uwxvy
12,y
v construct shortest path tree by
tracing predecessor nodes
v ties can exist (can be broken
arbitrarily)
uwxvyz v w x y z (u,w) (u,w) (u,x) (u,w) (u,w) destination link
34
35
y x v
v
36
u y
w v
2 2 1 3 1 1 2 5 3 5
37
38
39
v distributed, asynchronous algorithm v under minor, natural conditions, the estimate Dx(y) converge to the
x y z x y z 0 2 7 ∞ ∞ ∞ ∞ ∞ ∞
from cost to from from
x y z x y z x y z x y z ∞ ∞ ∞ ∞ ∞
cost to
x y z x y z ∞ ∞ ∞ 7 1
cost to
∞ 2 0 1 ∞ ∞ ∞ 2 0 1 7 1 0 time
x
1 2 7
y
node x table Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2 Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)} = min{2+1 , 7+0} = 3 3 2 node y table node z table
cost to from
x y z x y z 0 2 3
from cost to
x y z x y z 0 2 7
from cost to
x y z x y z 0 2 3
from cost to
x y z x y z 0 2 3
from cost to
x y z x y z 0 2 7
from cost to
2 0 1 7 1 0 2 0 1 3 1 0 2 0 1 3 1 0 2 0 1 3 1 0 2 0 1 3 1 0 time x y z x y z 0 2 7 ∞ ∞ ∞ ∞ ∞ ∞
from cost to from from
x y z x y z x y z x y z ∞ ∞ ∞ ∞ ∞
cost to
x y z x y z ∞ ∞ ∞ 7 1
cost to
∞ 2 0 1 ∞ ∞ ∞ 2 0 1 7 1 0 time
x
1 2 7
y
node x table Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2 Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)} = min{2+1 , 7+0} = 3 3 2 node y table node z table
cost to from
42
v node detects local link cost change v updates routing info, recalculates
v if DV changes, notify neighbors
x z
1 4 50
y
1
43
v node detects local link cost change v may have routing loops during convergence v bad news travels slow - “count-to-infinity” problem!
x z
1 4 50
y
60 ! "# $ "% $
4 5 1 min 60 + 0, 1 + 5 = 6 5 2 6 min 50 + 0, 1 + 6 = 7 3 min 60 + 0, 1 + 7 = 8 7 4 8 min 50 + 0, 1 + 8 = 9 ... … … 46 50 min 50 + 0, 1 + 50 = 50 47 min 60 + 0, 1 + 50 = 51 50 48 51 min 50 + 0, 1 + 51 = 50
y detect link cost change
44
x z
1 4 50
y
60
v If Z routes through Y to get to X :
v will this completely solve count-to-infinity problem?
! "# $ "% $ 4 5 1 min 60 + 0, 1 + ∞ = 60 5 2 60 min 50 + 0, 1 + 60 = 50 3 min 60 + 0, 1 + 50 = 51 50 4 51 min 50 + 0, 1 + ∞ = 50 y detect link cost change
45
rtinit0() distance table and
rtupdate0() routing packets received from
routing packets sent to other nodes: tolayer2() node0.c Layer 2 Simulator prog.c routing packets sent to other nodes: tolayer2()
distance table at node 0 § dt.costs[4][4]: 4-by-4 array of int's § dt.costs[i,j]: node 0’s currently computed cost from 0 to j via direct neighbor i
47
48
49
forwarding table
routing protocols
IP protocol
ICMP protocol
transport layer: TCP, UDP link layer physical layer
50
ver length 32 bits
data (variable length, typically a TCP
16-bit identifier header checksum time to live 32 bit source IP address head. len type of service flgs fragment
upper layer 32 bit destination IP address
IP protocol version number header length (4 bytes) upper layer protocol to deliver payload to total datagram length (bytes): header + data type of data for fragmentation/ reassembly max number remaining hops (decremented at each router) e.g. timestamp, record route taken, specify list of routers to visit.
how much overhead?
v 20 bytes of TCP v 20 bytes of IP v = 40 bytes + app
layer overhead
recomputed at each router
51
fragmentation: in: one large datagram
reassembly
52
ID =x
=0 fragflag =0 length =4000 ID =x Offset =0 fragflag =1 length =1500 ID =x
=185 fragflag =1 length =1500 ID =x
=370 fragflag =0 length =1040
several smaller datagrams
v 4000 byte datagram v MTU = 1500 bytes
1480 bytes in data field
1480/8
wired Ethernet, wireless 802.11)
53 223.1.1.1 223.1.1.2 223.1.1.3 223.1.1.4 223.1.2.9 223.1.2.2 223.1.2.1 223.1.3.2 223.1.3.1 223.1.3.27
223.1.1.1 = 11011111 00000001 00000001 00000001 223 1 1 1
54 223.1.1.1 223.1.1.2 223.1.1.3 223.1.1.4 223.1.2.9 223.1.2.2 223.1.2.1 223.1.3.2 223.1.3.1 223.1.3.27
wired Ethernet interfaces connected by Ethernet switches wireless WiFi interfaces connected by WiFi base station
55
223.1.1.0/24 223.1.2.0/24 223.1.3.0/24
223.1.1.1 223.1.1.3 223.1.1.4 223.1.2.9 223.1.3.2 223.1.3.1
subnet
223.1.1.2 223.1.3.27 223.1.2.2 223.1.2.1
56
223.1.1.0/24 223.1.2.0/24 223.1.3.0/24
223.1.1.1 223.1.1.3 223.1.1.4 223.1.2.9 223.1.3.2 223.1.3.1
subnet
223.1.1.2 223.1.3.27 223.1.2.2 223.1.2.1
57
223.1.1.1 223.1.1.3 223.1.1.4 223.1.2.2 223.1.2.1 223.1.2.6 223.1.3.2 223.1.3.1 223.1.3.27 223.1.1.2 223.1.7.0 223.1.7.1 223.1.8.0 223.1.8.1 223.1.9.1 223.1.9.2
R1 R2 R3
58
subnet part host part
59
Send me anything with addresses beginning 200.23.16.0/20
200.23.16.0/23 200.23.18.0/23 200.23.30.0/23
ISP 1 Organization 0 Organization 7 Internet Organization 1 ISP 2
Send me anything with addresses beginning 199.31.0.0/16
200.23.20.0/23
Organization 2
. . . . . .
60
Send me anything with addresses beginning 200.23.16.0/20
200.23.16.0/23 200.23.18.0/23 200.23.30.0/23
ISP 2 Organization 0 Organization 7 Internet Organization 1 ISP 1
Send me anything with addresses beginning 199.31.0.0/16
200.23.20.0/23
Organization 2
. . . . . .
61
ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20 Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23 Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23 Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23 ... ….. …. …. Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23
62
63
64
223.1.1.0/24 223.1.2.0/24 223.1.3.0/24
223.1.1.1 223.1.1.3 223.1.1.4 223.1.2.9 223.1.3.2 223.1.3.1 223.1.1.2 223.1.3.27 223.1.2.2 223.1.2.1
DHCP server arriving DHCP client needs address in this network
65
DHCP server: 223.1.2.5 arriving client
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 transaction ID: 654 lifetime: 3600 secs DHCP request 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
Broadcast: is there a DHCP server out there? Broadcast: I’m a DHCP server! Here’s an IP address you can use Broadcast: OK. I’ll take that IP address! Broadcast: OK. You’ve got that IP address!
66
67
68
10.0.0.1 10.0.0.2 10.0.0.3 10.0.0.4 138.76.29.7
local network (e.g., home network) 10.0.0/24 rest of Internet
172.16.0.0 – 172.31.255.255
69
10.0.0.1 10.0.0.2 10.0.0.3
S: 10.0.0.1, 3345 D: 128.119.40.186, 80
1
10.0.0.4 138.76.29.7
1: host 10.0.0.1 sends datagram to 128.119.40.186, 80 NAT translation table WAN side addr LAN side addr 138.76.29.7, 5001 10.0.0.1, 3345 …… ……
S: 128.119.40.186, 80 D: 10.0.0.1, 3345
4
S: 138.76.29.7, 5001 D: 128.119.40.186, 80
2 2: NAT router changes datagram source addr from 10.0.0.1, 3345 to 138.76.29.7, 5001, updates table
S: 128.119.40.186, 80 D: 138.76.29.7, 5001
3 3: reply arrives
138.76.29.7, 5001 4: NAT router changes datagram dest addr from 138.76.29.7, 5001 to 10.0.0.1, 3345
70
71
72
data destination address (128 bits) source address (128 bits) payload len next hdr hop limit flow label pri ver 32 bits
73
IPv4 source, dest addr IPv4 header fields
IPv4 datagram IPv6 datagram
IPv4 payload UDP/TCP payload IPv6 source dest addr IPv6 header fields
74
physical view:
IPv4 IPv4
A B
IPv6 IPv6
E
IPv6 IPv6
F C D logical view:
IPv4 tunnel connecting IPv6 routers
E
IPv6 IPv6
F A B
IPv6 IPv6
flow: X src: A dest: F data
A-to-B: IPv6
Flow: X Src: A Dest: F data
src:B dest: E
B-to-C: IPv6 inside IPv4 E-to-F: IPv6
flow: X src: A dest: F data
D-to-E: IPv6 inside IPv4
Flow: X Src: A Dest: F data
src:B dest: E
75
76
77
78
3b 1d 3a 1c 2a AS3 AS1
AS2
1a 2c 2b 1b
Intra-AS Routing algorithm Inter-AS Routing algorithm
Forwarding table
3c
79
80
81
boundary router backbone router area 1 area 2 area 3
backbone
area border routers internal routers
82
AS3
AS2
3b 3c 3a AS1 1c 1a 1d 1b 2a 2c 2b
networks
networks
83
84
eBGP connection iBGP connection 1b 1d 1c 1a 2b 2d 2c 2a 3b 3d 3c 3a
AS 2 AS 3 AS 1
1c ∂ ∂ gateway routers run both eBGP and iBGP protocols
85
1b 1d 1c 1a 2b 2d 2c 2a 3b 3d 3c 3a
AS 2 AS 3 AS 1
X
BGP advertisement: AS3, X
86
1b 1d 1c 1a 2b 2d 2c 2a 3b 3d 3c 3a
AS2 AS3 AS1
X
AS3,X AS2,AS3,X
AS3, X to AS1 router 1c
87
1b 1d 1c 1a 2b 2d 2c 2a 3b 3d 3c 3a
AS2 AS3 AS1
X
AS3,X AS2,AS3,X
A S 3 , X
88
89
1b 1d 1c 1a 2b 2d 2c 2a 3b 3d 3c 3a
AS2 AS3 AS1
X
90
1b 1d 1c 1a 2b 2d 2c 2a 3b 3d 3c 3a
AS2 AS3 AS1
X
91
92
§ .. so X will not advertise to B a route to C
A B C
W X Y
legend: customer network: provider network
93
§ B gets no “revenue” for routing CBAw, since none of C, A, w are B’s customers § C does not learn about CBAw path
A B C
W X Y
legend: customer network: provider network Usually, an ISP only wants to route traffic to/from its customer networks (does not want to carry transit traffic between other ISPs)
94