Professional Documents
Culture Documents
Chapter 4
Chapter 4
1-6/2005
chn ng (path selection): c nhiu ng i, gi tin s i theo ng no? chuyn mch (switching, forwarding): chuyn gi tin t cng vo ti cng ra ca router mt cch thch hp. thit lp lin kt (call setup): mt s kin trc mng cn thit lp knh truyn trc khi truyn.
Chng 4. Giao thc tng mng
network data link physical network data link physical application transport network data link physical
1-6/2005
1
3 2
1-6/2005
1-6/2005
cy vo tng network? cc gi tin c n ch ng th t gi? thi gian truyn c c m bo? c phn hi v tnh trng nghn mng?
1-6/2005
Virtual Circuit
Thit lp lin kt trc khi truyn d liu v hu b lin kt sau khi truyn xong.
VC
setup: trc khi truyn, tng mng phi thit lp mt knh truyn o (VC) t sender ti receiver ( bit a ch). Data transfer: d liu c truyn qua VC. VC teardown: mt khi sender hoc receiver mun ngt VC, n thng bo cho network layer bit, network layer s hu b VC. Cn c gi l connection-oriented
Mi gi tin cha thm thng tin v knh m n s i qua (VC identifier number). Cc routers/packet switches trn knh o (VC) lun nm gi trng thi ca knh i qua n.
Chng 4. Giao thc tng mng 7
1-6/2005
Giao thc truyn cc thng ip gia end system v network layer yu cu thit lp, hu b VC; gia cc thit b chuyn mch (switches) thit lp VC. c s dng trong mng ATM, Frame Relay, X.25.
application transport 5. Data flow begins network 4. Call connected data link 1. Initiate call physical
1-6/2005
host A
server B
1-6/2005
Datagram network
Khng thit lp knh truyn. Cc thit b chuyn mch khng cn nm gi trng thi cc knh. Gi tin c truyn da trn a ch ca receiving host. ng i ca cc gi tin gia hai host c th khc nhau.
application transport network data link 1. Send data physical application transport network 2. Receive data data link physical
1-6/2005
10
circuit-switched networks
networks
virtual circuitswitched networks (vd. ATM)
11
(vd. telephone)
datagram networks
FDM
TDM
(vd. Internet)
1-6/2005
ATM
Mng my tnh: dch v nhy cm. khng gii hn thi gian. Cc h thng cui thng minh (computer): c kh nng thch nghi, kim sot, khi phc li. kin trc bn trong mng n gin nhng kt ni cc mng phc tp. Nhiu dng lin kt mng dn n mt dch v thun nht (knh) l khng thch hp.
Mng in thoi (chuyn mch knh). Tng tc ngi-ngi i hi: thi gian truyn. tin cy. dch v phi c m bo. Cc thit b cui n gin, dng nh c nh: in thoi. mc phc tp nm bn trong mng.
1-6/2005
12
1-6/2005
13
B nh tuyn router
Thc thi cc gii thut chn ng (routing algorithms). Chuyn tip (forwarding) cc gi tin t cng vo ti cng ra thch hp.
1-6/2005
14
Input ports
Decentralized switching:
s dng forwarding table c trong input port memory tra cu output port queuing: nu cc gam d liu (datagram) n nhanh qu, cn phi xp hng ch x l.
Chng 4. Giao thc tng mng 15
1-6/2005
1-6/2005
16
Output ports
1-6/2005
1-6/2005
18
Network layer
routing table
1-6/2005
19
IP datagram format
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 6 = TCP; 17 = UDP 32 bits
ver
head. type of length len service fragment 16-bit identifier flgs offset time to upper Internet layer live checksum 32 bit source IP address 32 bit destination IP address Options (if any)
1-6/2005
20
Fragmentation: gam d liu (datagram) ln c chia thnh nhiu gam d liu nh.
Do mi ng truyn gia cc nt (link) c tc gii hn, ch cho php truyn n v d liu c kch thc ti a l MTU (Max Transfer Unit)
reassembly
Reassembly: Cc gam d liu nh c hp nht thnh gam d liu ln (ngc li) ti im n cui cng
Chng 4. Giao thc tng mng 21
1-6/2005
1-6/2005
22
IP address: S 32-bit nh danh giao din mng (interface). Interface (NIC - Network Interface Card): giao din kt ni mng t nt mng ti mng.
host interface: mi my tnh thng c mt NIC, cho php ni vo mt ng lin kt. router interface: router thng c nhiu giao din mng.
223.1.1.1 223.1.2.1
223.1.1.2 223.1.1.4
223.1.2.9 223.1.2.2
223.1.1.3 223.1.3.1
223.1.3.27
223.1.3.2
1
Chng 4. Giao thc tng mng 23
223.1.1.1
223.1.2.1
Cc bit cao dnh cho network. Cc bit thp dnh cho host.
223.1.1.2 223.1.1.4
223.1.1.3
223.1.2.9 223.1.2.2
223.1.3.27
Network:
Mng
LAN
223.1.3.1 223.1.3.2
to bi cc interface c phn network trong IP addr ging nhau. Cc host cng network c th trao i d liu khng cn thng qua router.
1-6/2005
network = 3 IP networks
24
IP addressing: Class-full
1-6/2005
25
Subnet
V d:
1-6/2005
26
Subnet mask
L mt s 32 bit bao gm cc bit cao = 1 v cc bit thp = 0. Cc bit 1 quy nh subnet, cc bit 0 quy nh a ch host. t subnet mask c th xc nh ranh gii gia a ch mng v a ch ca interface (host).
(111111111.11111111.11111111.00000000)
1-6/2005
ch host thay bng cc bit 1, vd: 192.168.10.255 Cc gi tin c ip ch dng broadcast s c gi cho mi host trong mng.
IP addressing: CIDR
Class-full addressing: s phn lp cng nhc, khng cn thch hp na. CIDR (Classless InterDomain Routing):
tr ngn cch gia net addr v host addr tu . addr format: a.b.c.d/x, vi x l s lng bit dnh cho net addr.
network part host part
Lm th no c a ch IP cho host?
Ngi
qun tr h thng thit lp (TCP/IP properties trong Windows 2000/XP). RARP (Reverse Address Resolution Protocol):
RARP server cung cp IP cho client da trn bng cu hnh sn c (t a ch vt l (MAC) IP).
BOOTP
(BOOTstrap Protocol):
DHCP
Giao thc cp pht a ch IP ng. DHCP server ph trch vic cp pht/thu hi IP cho/t cc DHCP client. Client c th nhn IP khc nhau tu thi im kt ni.
1-6/2005
30
ISP's block
Organization 0 Organization 1 Organization 2 ... Organization 7
200.23.16.0/20
11001000 00010111 00010000 00000000 200.23.16.0/23 11001000 00010111 00010010 00000000 200.23.18.0/23 11001000 00010111 00010100 00000000 200.23.20.0/23 .. . . 11001000 00010111 00011110 00000000 200.23.30.0/23
200.23.16.0/23
Organization 1
200.23.18.0/23 200.23.20.0/23
Organization 2
Organization 7
. . .
. . .
Fly-By-Night-ISP
200.23.30.0/23
ISPs-R-Us Send me anything with addresses beginning 199.31.0.0/16
31
1-6/2005
10.0.0.1 10.0.0.2
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)
1-6/2005
32
Khng
cn tm di IP t ISP cp pht cho cc thit b mng trong (my trm) v ch dng 1 IP. Thay i IP ca my trm ni b m khng nh hng ti mng ngoi. Thay i ISP m khng cn thay i a ch cc thit b mng trong. Cc thit b mng trong khng nhn thy c t mng ngoi.
1-6/2005 Chng 4. Giao thc tng mng 33
NAT: Implementation
NAT router: 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
1-6/2005
34
NAT example
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 138.76.29.7, 5001 10.0.0.1, 3345 1: host 10.0.0.1 sends datagram to 128.119.40, 80
1
10.0.0.4
S: 128.119.40.186, 80 D: 10.0.0.1, 3345
10.0.0.1 10.0.0.2
138.76.29.7
10.0.0.3 4: NAT router changes datagram dest addr from 138.76.29.7, 5001 to 10.0.0.1, 3345
Chng 4. Giao thc tng mng 35
v mt kin trc, ICMP thuc v tng ng dng. s dng UDP. c ng gi trong IP datagrams/packet. type + code + 8 bytes of IP datagram.
Type 0 3 3 3 3 3 3 4 8 9 10 11 12
Code 0 0 1 2 3 6 7 0 0 0 0 0 0
ICMP msg
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
1-6/2005
36
IPv6
IPv4: s dng 32-bit a ch IP s l khng ??? IPv6:
dng 128-bit a ch. phn tiu (header) cung cp kh nng x l nhanh hn, cht lng hn (QoS). 40 bytes header. khng cho php phn mnh (fragmentation). ICPM v6.
1-6/2005
37
ver: phin bn (6=v6, 4#v4!!). priority: th t cc gi tin trong cng flow. flow: nhn ca lung m gi tin thuc v
cc
ng dng i hi cht lng cao flow. ng dng khng i hi cht lng khng c coi l flow.
1-6/2005
tn
ti cc nt mng IPv4 v IPv6. IPv6 c kh nng x l gi tin IPv4. Tunneling: gi tin IPv6 c coi nh phn data (payload) ca IPv4 khi i qua cc nt mng IPv4.
1-6/2005
39
Tunneling
Logical view: A
IPv6
B
IPv6
tunnel
E
IPv6
F
IPv6
Physical view:
A
IPv6
Flow: X Src: A Dest: F data
B
IPv6
C
IPv4
D
IPv4
E
IPv6
F
IPv6
Src:B Dest: E
Flow: X Src: A Dest: F
Src:B Dest: E
Flow: X Src: A Dest: F data
data
A-to-B: IPv6
E-to-F: IPv6
1-6/2005
40
1-6/2005
41
1
3 2
1-6/2005
42
v
2
3 3
w
1
5 2
1 Network = Graph = G(N,E). N = tp hp cc routers = { u, v, w, x, y, z }. E = tp cc ng ni gia cc routers. = { (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) } Trng s = chi ph (cost): tr, nghn mng, cc ph ng i tt = ng i c chi ph thp nht.
Chng 4. Giao thc tng mng 43
1-6/2005
cc nt mng c thng tin nh nhau v cc lin kt ca ton b mng. cho php tm ng i t mt nt ti tt c cc nt cn li.
K hiu:
c(i,j): chi ph phi tr i t i ti j (trc tip) D(v): gi tr hin ti ca chi ph phi tr i t nh xut pht
ti nh v.
p(v): nh trc nh v trn ng i ngn nht
1-6/2005
Dijsktras Algorithm
1 Initialization: 2 N = {A} 3 for all nodes v 4 if v k vi A 5 then D(v) = c(A,v) 6 else D(v) = 7 8 Loop 9 Tm w khng thuc N sao cho D(w) nh nht 10 N = N + w 11 for all v k vi w v khng thuc N: 12 D(v) = min( D(v), D(w) + c(w,v) ) 13 until tt c nt thuc N
1-6/2005
46
5 2
B
2
3 3
C
1
A
1
F
2
47
1-6/2005
mi nt mng c mt bng khong cch. hng dnh cho cc ch c th n c. ct dnh cho cc nt c th n trc tip (hng xm) V d: ti nt X, vi ch Y n qua nt Z:
D (Y,Z)
X chi ph cho ng i (XZY) = Z l nt k tip cn i ti
1-6/2005
48
B
8
C
2
D ()
A 1
B
14 8 9 11
D 5 5
A
B
7
6 4
C D
4
2
w loop!
loop!
Chng 4. Giao thc tng mng 49
A 1 7 6
B
14 8 9 11
D 5 5
A
B C D
A
B C D
A,1
D,5 D,4 D,4
4
2
Distance table
1-6/2005
Routing table
50
DV Algorithm: Initialization
At all nodes, X:
1 Initialization: 2 for all adjacent nodes v: 3 D X(*,v) = infinity /* the * operator means "for all rows" */ 4 D X(v,v) = c(X,v) 5 for all destinations, y 6 send min D X(y,w) to each neighbor /* w over all X's neighbors */
w
1-6/2005
51
DV Algorithm: Loop
8 loop 9 wait (until I see a link cost change to neighbor V 10 or until I receive update from neighbor V) 11 12 if (c(X,V) changes by d) 13 /* change cost to all dest's via neighbor v by d */ 14 /* note: d could be positive or negative */ 15 for all destinations y: D X(y,V) = D X(y,V) + d 16 17 else if (update received from V wrt destination Y) 18 /* shortest path from V to some Y has changed */ 19 /* V has sent a new value for its min DV(Y,w) */ w 20 /* call this received new value is "newval" */ 21 for the single destination y: D X(Y,V) = c(X,V) + newval 22 23 if we have a new min DX(Y,w)for any destination Y w 24 send new value of min D X(Y,w) to all neighbors w 26 forever
1-6/2005 Chng 4. Giao thc tng mng 52
DV Algorithm: example
Y
7
Z
D (Z,Y) = c(X,Y) + minw {D (Z,w)} = 2+1 = 3
X Y
1-6/2005
53
DV Algorithm: example
Y
7
1-6/2005
54
Distance Vector
Ch nm gi thng tin lin quan ti cc nt hng xm msgs ch c gi cho cc nt hng xm. tc hi t c th khc nhau tu tng tnh hung, i khi ri vo trng thi lp v hn. Thng tin dn ng ca nt ny c s dng bi nt khc.
Mt nt gp s c c th gy nh hng ti cc nt khc.
1-6/2005
55
Hierarchical Routing
Dn ng theo tng mc mng, do: Quy m mng Internet l rt ln:
mt
cu mng t tr
Internet =
network of networks ngi qun tr mng mun iu khin vic dn ng (routing) trong mng h qun l.
1-6/2005
56
Phn vng routers, to thnh cc autonomous systems (AS) routers trong cng AS s dng chung giao thc tm ng, gi l intra-AS routing protocol.
routers ti
Gateway router:
router c
1-6/2005
B.a
a c B
Gateways:
a b
c
perform inter-AS routing amongst themselves perform intra-AS routers with other routers in their AS
network layer
link layer
physical layer
1-6/2005
58
C.b b A.a a
B.a
c B
Host h2
b
Host h1
1-6/2005
59
1-6/2005
60
Two-level routing:
ngi qun tr c quyn chn gii thut cho ring mng ca mnh Inter-AS: gii thut duy nht (inter-AS routing: BGP)
Intra-AS:
1-6/2005
61
Internet AS Hierarchy
Intra-AS border (exterior gateway) routers
Intra-AS Routing
OSPF: IGRP:
1-6/2005
63
S dng Distance vector algorithm Included in BSD-UNIX Distribution in 1982 n v o khong cch: s lng chng (hop, ti a = 15 hops) Routing table c trao i 30 giy mt ln thng qua RIP response msg (RIP advertisement), mi msg cha ti a 25 bn ghi. v1: RFC 1058; v2: RFC 1723
u v destination hops u 1 v 2 w 2 x 3 y 3 z 2
x y
Chng 4. Giao thc tng mng
1-6/2005
64
RIP: Example
z
w A x D C
Destination Network
w y z x
Next Router
A B B -.
2 2 7 1
....
Routing table in D
1-6/2005 Chng 4. Giao thc tng mng 65
RIP routing tables managed by application-level process called route-d (daemon) advertisements c gi nh k, qua UDP packets.
1-6/2005
66
Three attached class C networks (LANs) Router only knows routes to attached LANs Default router used to go up Route multicast address: 224.0.0.0 Loopback interface (for debugging)
Chng 4. Giao thc tng mng 67
1-6/2005
packet dissemination Topology map at each node Route computation using Dijkstras algorithm
OSPF advertisement carries one entry per neighbor router Advertisements disseminated to entire AS (via flooding)
Carried in
UDP
68
1-6/2005
Security: cc OSPF msgs u cha thng tin chng thc (authenticated). Multiple same-cost paths: Cho php truyn tin theo nhiu ng c cng chi ph vi cng mt phin truyn tin. Diff. cost metrics for diff. TOS: Cho php nhiu n v o khc nhau cho tng loi dch v (e.g., satellite link cost set low for best effort; high for real time) Integrated unicast and multicast support: Multicast OSPF (MOSPF) uses same topology data base as OSPF Hierarchical OSPF in large domains.
Chng 4. Giao thc tng mng 69
1-6/2005
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.
1-6/2005
70
BGP (Border Gateway Protocol): RFC 1771; RFC 1772; RFC 1773
R4
R5
AS1
(RIP intra-AS routing)
R3
BGP AS2
AS3
(OSPF intra-AS routing)
BGP R1 R2
1-6/2005
71