You are on page 1of 19

Ch4.

The Network Layer


Chng 3. Giao thc tng mng (network layer)

4.1 - Gii thiu v chc nng ca tng mng. 4.2 - Network service model (VC and Datagram). 4.3 - Giao thc IP (Internet Protocol) 4.4 - Thit b tng mng - B nh tuyn (router) 4.5 - Gii thut chn ng (Routing Algorithms) 4.6 - Chn ng trong mng Internet.

Chng 4. Giao thc tng mng

Chc nng ca tng mng


Truyn cc gi tin (packets) t sending application host ti receiving host. transport
segment packets (datagrams).
network data link physical

Routing & switching in routers


routing algorithm

Network layer c ci t ti router v c end system. Chc nng:


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 network data link physical

network data link physical

local forwarding table header value output link


0100 0101 0111 1001 3 2 2 1

network data link physical

network data link physical

network data link physical network data link physical application transport network data link physical

value in arriving packets header


0111

1
3 2

Chng 4. Giao thc tng mng

Ch4. The Network Layer

Network service model


Tng mng cung cp dch v cho tng Transport:
tin 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?

4.1 - Gii thiu v chc nng ca tng mng. 4.2 - Network service model (VC and Datagram). 4.3 - Giao thc IP (Internet Protocol). 4.4 - Thit b tng mng - B nh tuyn (router). 4.5 - Gii thut chn ng (Routing Algorithms). 4.6 - Chn ng trong mng Internet.

Hai model c bn ca tng mng:


knh o (virtual circuit) lc (gam) d liu (datagram)

Chng 4. Giao thc tng mng

Chng 4. Giao thc tng mng

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

Virtual Circuit: Signaling protocol


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

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

6. Receive data application 3. Accept call transport 2. incoming call network

data link physical

Chng 4. Giao thc tng mng

Datagram network
application transport network data link physical

host A

server B

application transport network data link physical

S khc bit gia lin kt ti tng Transport v Network?


application transport network data link physical application transport network data link physical

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 2. Receive data network data link physical

Chng 4. Giao thc tng mng

Chng 4. Giao thc tng mng

10

Network taxonomy (review)


communication networks switched networks broadcast networks (vd. Radio, Broadcast TV) packet-switched networks

Datagram or VC network: why?


Internet
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.
11

ATM
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:

circuit-switched networks (vd. telephone)

in thoi.
Mc phc tp nm bn trong mng.

FDM

TDM

datagram networks (vd. Internet)

virtual circuitswitched networks (vd. ATM)

Chng 4. Giao thc tng mng

Chng 4. Giao thc tng mng

12

Ch4. The Network Layer

4.1 - Gii thiu v chc nng ca tng mng. 4.2 - Network service model (VC and Datagram) 4.3 - Giao thc IP (Internet Protocol) 4.4 - Thit b tng mng - B nh tuyn (router) 4.5 - Gii thut chn ng (Routing Algorithms) 4.6 - Chn ng trong mng Internet.

Chng 4. Giao thc tng mng

13

Chng 4. Giao thc tng mng

14

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 len service length 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) E.g. timestamp, record route taken, specify list of routers to visit. total datagram length (bytes) for fragmentation/ reassembly

IPv4 Addressing: Introduction


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.1.2 223.1.1.4 223.1.2.1 223.1.2.9 223.1.2.2 223.1.3.2

data (variable length, typically a TCP or UDP segment)

32-bit = 4 s 8-bit

dng thp phn d nh:

223.1.1.3 223.1.3.1

223.1.3.27

223.1.1.1 = 11011111 00000001 00000001 00000001 223 1 1 1

Chng 4. Giao thc tng mng

15

Chng 4. Giao thc tng mng

16

Mng & mng con (subnet)


Internet = network of networks. a ch IP bao gm 2 phn:
Cc bit cao dnh cho network. Cc bit thp dnh cho host.
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

IP addressing: Class-full

223.1.3.27

Network:
Mng 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.
223.1.3.1

LAN
223.1.3.2

network = 3 IP networks

Chng 4. Giao thc tng mng

17

Chng 4. Giao thc tng mng

18

Network addr, Broadcast v loopback


Network Address: Thay a ch host bng cc bit 0, v d: 192.168.10.0 Broadcast Address:
a 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.

Subnet
i khi cn chia nh mt mng thnh cc mng nh hn (subnet)

V d:

Loopback Address: 127.x.x.x


Cc gi tin c coi nh c gi ti t nt khc. Thng dng 127.0.0.1

Chng 4. Giao thc tng mng

19

Chng 4. Giao thc tng mng

20

Subnet mask
Mt interface trong mng cn c:
IP address Mt n mng con (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).

IP addressing: CIDR
Class-full addressing: s phn lp cng nhc, khng cn thch hp na. CIDR (Classless InterDomain Routing):
V 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.

V d: Subnet gm cc host 192.168.10.x, mt host c th c thng s nh sau:


IP = 192.168.10.1 SM = 255.255.255.0 (111111111.11111111.11111111.00000000)

Kim tra xem hai IP c cng mt subnet khng?


(IP1 XOR IP2) AND SM = 0?
Chng 4. Giao thc tng mng 21

11001000 00010111 00010000 00000000 200.23.16.0/23


Chng 4. Giao thc tng mng 22

network part

host part

IP addresses: how to get one?


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).

Phn cp a ch Internet - ISP


ICANN: Internet Corporation for Assigned Names and Numbers
Organization 0 ISP's block Organization 0 Organization 1 Organization 2 ... Organization 7 11001000 00010111 00010000 00000000 11001000 00010111 00010000 00000000 11001000 00010111 00010010 00000000 11001000 00010111 00010100 00000000 .. . 11001000 00010111 00011110 00000000 200.23.16.0/20 200.23.16.0/23 200.23.18.0/23 200.23.20.0/23 . 200.23.30.0/23

200.23.16.0/23
Organization 1

BOOTP (BOOTstrap Protocol):


BOOTP server cung cp IP cho client da trn bng cu hnh sn c.

200.23.18.0/23 200.23.20.0/23

Organization 2

DHCP (Dynamic Host Configuration Protocol):


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.

Organization 7

200.23.30.0/23
ISPs-R-Us Send me anything with addresses beginning 199.31.0.0/16
24

. . .

. . .

Fly-By-Night-ISP

Send me anything with addresses beginning 200.23.16.0/20 Internet

Chng 4. Giao thc tng mng

23

Chng 4. Giao thc tng mng

NAT: Network Address Translation


rest of Internet local network (e.g., home network) 10.0.0/24
10.0.0.4 138.76.29.7 10.0.0.3

NAT: Network Address Translation (cont)


Mt LAN ch s dng mt IP duy nht khi giao tip vi mng ngoi. T :
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.
Chng 4. Giao thc tng mng 26

10.0.0.1 10.0.0.2

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)

Chng 4. Giao thc tng mng

25

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

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

S: 10.0.0.1, 3345 D: 128.119.40.186, 80

S: 138.76.29.7, 5001 D: 128.119.40.186, 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

3: Reply arrives dest. address: 138.76.29.7, 5001


27

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
Chng 4. Giao thc tng mng 28

Chng 4. Giao thc tng mng

ICMP (Internet Control Message Protocol)


Giao tip mc mng gia cc hosts, routers
thng bo li (vd: khng tm c ng i, khng gi tin c ti host, port). echo request/reply.
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 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

IPv6
IPv4: s dng 32-bit a ch IP s l khng ??? IPv6:
s 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). ICMP v6.

ICMP c th coi l mt thnh phn ca IP


v mt kin trc, ICMP thuc v tng ng dng. s dng UDP.

ICMP msg
c ng gi trong IP datagrams/packet. type + code + 8 bytes of IP datagram.

Chng 4. Giao thc tng mng

29

Chng 4. Giao thc tng mng

30

IPv6: datagram format


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.

IPv6: chuyn i IPv4

IPv6

Chuyn i tt c cc hosts, routers sang s dng IPv6: khng th!!! Chuyn i dn dn:
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.

ng dng khng i hi cht lng khng c coi l flow. next header: giao thc tng trn.
Chng 4. Giao thc tng mng 31

Chng 4. Giao thc tng mng

32

Tunneling
Logical view: A
IPv6

Ch4. The Network Layer


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 data

Src:B Dest: E
Flow: X Src: A Dest: F data

Flow: X Src: A Dest: F data

4.1 - Gii thiu v chc nng ca tng mng. 4.2 - Network service model (VC and Datagram). 4.3 - Giao thc IP (Internet Protocol). 4.4 - Thit b tng mng - B nh tuyn (router) 4.5 - Gii thut chn ng (Routing Algorithms). 4.6 - Chn ng trong mng Internet.

A-to-B: IPv6

B-to-C: IPv6 inside IPv4

B-to-C: IPv6 inside IPv4

E-to-F: IPv6

Chng 4. Giao thc tng mng

33

Chng 4. Giao thc tng mng

34

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.

Input ports

Physical layer: bit-level reception Data link layer: e.g., Ethernet

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 36

Chng 4. Giao thc tng mng

35

Cc c cu chuyn mch (switching fabrics)

Output ports

Buffering: khi datagram c gi ra nhanh hn tc x l, cn a vo b m. Scheduling discipline: c ch la chn datagram t b m tip tc gi i.


Chng 4. Giao thc tng mng 37 Chng 4. Giao thc tng mng 38

Ch4. The Network Layer

The Internet (TCP/IP) network layer


Network layer c thc thi ti end system cng nh ti router!

4.1 - Gii thiu v chc nng ca tng mng. 4.2 - Network service model (VC and Datagram). 4.3 - Giao thc IP (Internet Protocol). 4.4 - Thit b tng mng - B nh tuyn (router). 4.5 - Gii thut chn ng (Routing Algorithms). 4.6 - Chn ng trong mng Internet.

Transport layer: TCP, UDP


Routing protocols path selection RIP, OSPF, BGP IP protocol addressing conventions datagram format packet handling conventions

Network layer

routing table

ICMP protocol error reporting router signaling

Link layer physical layer

Chng 4. Giao thc tng mng

39

Chng 4. Giao thc tng mng

40

10

IP Fragmentation & Reassembly


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)

fragmentation: in: one large datagram out: 3 smaller datagrams

Example 4000 byte datagram MTU = 1500 bytes

length ID fragflag offset =4000 =x =0 =0

gam d liu ln c chia thnh nhiu gam d liu nh hn


length ID fragflag offset =1500 =x =1 =0 length ID fragflag offset =1500 =x =1 =185 length ID fragflag offset =1040 =x =0 =370

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 41

1480 bytes in data field offset = 1480/8

Chng 4. Giao thc tng mng

42

Forwarding & routing


routing algorithm

Network: graph abstraction


5 2 1

local forwarding table header value output link


0100 0101 0111 1001 3 2 2 1

v
2

3 3

w
1

z
2

value in arriving packets header


0111

1
3 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.
43 Chng 4. Giao thc tng mng 44

Chng 4. Giao thc tng mng

11

Routing Algorithm classification


Thng tin tp trung hay phn tn? Tnh hay ng?
Tp trung: Tnh: mi router phi nm gi thng tin ton ng i t thay i b mng (topology, link cost) ng: link state algorithms ng i thay i Phn tn: thng xuyn router nm c chi ph truyn tin ti cc cc thng tin dn router c ni trc tip vi mnh (hng ng c cp xm) nht nh k. qu trnh tnh ton mang tnh cht lp i lp li, trao i thng tin gia cc link cost thay i. routers. distance vector algorithms
Chng 4. Giao thc tng mng 45

A Link-State Routing Algorithm


Gii thut Dijkstra:
tt c 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 N: tp hp nh m ng i ngn nht c xc nh.


Chng 4. Giao thc tng mng 46

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

Dijkstras algorithm: example


Step 0 1 2 3 4 5 N A AD ADE ADEB ADEBC ADEBCF D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F) 2,A 1,A 5,A 2,A 4,D 2,D 2,A 3,E 4,E 3,E 4,E 4,E

5 2 1

B
2

3 3 1

C
1

F
2
48

Chng 4. Giao thc tng mng

47

Chng 4. Giao thc tng mng

12

Distance Vector Routing Algorithm Distance Table data structure


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 (X Z Y) = Z l nt k tip cn i ti = c(X,Z) + minw{D (Y,w)}
Z

Distance Table: example


7 1

B
8

C
2

D () A
D
destination

cost to destination via

A 1 7 6 4

B 14 8 9 11

D 5 5 4 2

D (C,D) = c(E,D) + minw {D (C,w)} D (A,D) = c(E,D) + minw {D (A,w)} D (A,B) = c(E,B) + minw{D (A,w)}
= 8+6 = 14
loop!

B C D

= 2+2 = 4

= 2+3 = 5 loop!

Chng 4. Giao thc tng mng

49

Chng 4. Giao thc tng mng

50

Distance table
D () A
destination

routing table
D 5
destination

DV Algorithm: Initialization
At all nodes, X:
1 Initialization: 2 for all adjacent nodes v: 3 DX(*,v) = infinity /* the * operator means "for all rows" */ X 4 D (v,v) = c(X,v) 5 for all destinations, y X 6 send min D (y,w) to each neighbor /* w over all X's neighbors */
w

cost to destination via

A 1 7 6 4

B 14 8 9 11

Outgoing link to use, cost

A B C D

A,1 D,5 D,4 D,4

B C D

5 4 2

Distance table

Routing table
51 Chng 4. Giao thc tng mng 52

Chng 4. Giao thc tng mng

13

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) = DX(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 w DV(Y,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 minw DX(Y,w)for any destination Y 24 send new value of min D X(Y,w) to all neighbors w 26 forever
Chng 4. Giao thc tng mng 53

DV Algorithm: example

Y
7

Z
D (Z,Y) = c(X,Y) + minw {D (Z,w)} = 2+1 = 3
X Y

D (Y,Z) = c(X,Z) + minw {D (Y,w)} = 7+1 = 8

Chng 4. Giao thc tng mng

54

DV Algorithm: example

Mt vi so snh (LS v DV)


Link-State
Cn nm c thng tin ton b mng n nt, E links, nE msgs c gi mi ln O(n2), nE msgs

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.

Y
7

Mi nt ch tnh ton bng dn ng cho ring mnh.

Chng 4. Giao thc tng mng

55

Chng 4. Giao thc tng mng

56

14

Hierarchical Routing
Dn ng theo tng mc mng, do: Quy m mng Internet l rt ln:
mt nt khng th cha tt c cc bn ghi cho mi ch! vic cp nht bng dn ng tn km!

Hierarchical Routing (cont)


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 cc AS khc nhau c th s dng intra-AS routing protocol khc nhau.

Nhu cu mng t tr
Internet = network of networks ngi qun tr mng mun iu khin vic dn ng (routing) trong mng h qun l.

Gateway router:
router c bit trong AS s dng intra-AS routing protocol vi cc routers khc trong AS

s dng inter-AS routing protocol vi cc gateway routers khc.


Chng 4. Giao thc tng mng 58

Chng 4. Giao thc tng mng

57

Hierarchical Routing (cont)


C.b b d A A.a A.c a b c a B B.a c

Hierarchical Routing (cont)


Gateways:
perform inter-AS routing amongst themselves perform intra-AS routers with other routers in their AS
network layer

C.b b A.a a

Inter-AS routing between A and B A.c

B.a a c B Host h2 b

a Host h1

inter-AS, intra-AS routing in gateway A.c

link layer physical layer

d c b A Intra-AS routing within AS A

Intra-AS routing within AS B

Chng 4. Giao thc tng mng

59

Chng 4. Giao thc tng mng

60

15

Ch4. The Network Layer

Routing in the Internet

Internet = nhiu Autonomous Systems (AS) : 4.1 - Gii thiu v chc nng ca tng mng. 4.2 - Network service model (VC and Datagram). 4.3 - Thit b tng mng - B nh tuyn (router). 4.4 - Giao thc IP (Internet Protocol). 4.5 - Gii thut chn ng (Routing Algorithms). 4.6 - Chn ng trong mng Internet.
Stub AS: cc cng ty nh: mt kt ni vi AS khc. Multihomed AS: cng ty ln: nhiu lin kt ti AS khc. Transit AS: nh cung cp (mc ni cc AS vi nhau).

Two-level routing:
Intra-AS: ngi qun tr c quyn chn gii thut cho ring mng ca mnh Inter-AS: gii thut duy nht (inter-AS routing: BGP)
61 Chng 4. Giao thc tng mng 62

Chng 4. Giao thc tng mng

Internet AS Hierarchy
Intra-AS border (exterior gateway) routers

Fixed Module Router

Inter-AS interior (gateway) routers


Chng 4. Giao thc tng mng 63 Chng 4. Giao thc tng mng 64

16

Connecting LAN interfaces

Static Route Operation


1/ .2. .1 6 72 1
Sterling

24

S0

From an Ethernet/FastEthernet interface to a hub/switch: straight through cable From an Ethernet/FastEthernet interface to a PC/other Router: crossover cable.

172.16.1.1/24

2 2 17 17 Hoboken S0 S1 172.16.3.1/24

2/ .2. .1 6

24

1/ .4. .1 6

24

2/ .4. .1 6 72 1
waycross

24

S1

172.16.5.1/24

Router(config) ip route des_net subnet_mask

Hobeken(config)# ip route 172.16.1.0 255.255.255.0 172.16.2.1 Command des. Net subnetmask interface Hobeken(config)# ip route
Chng 4. Giao thc tng mng 65

[next-hop-address | outgoing interface]

Command Chng 4. Net thc tng mng des. Giao subnetmask

172.16.5.0 255.255.255.0 172.16.4.2


66 nexthop add

Configuring Default Route Forwarding


2 17
Sterling

Intra-AS Routing Tn gi khc: Interior Gateway Protocols (IGP) Mt s giao thc: RIP: Routing Information Protocol OSPF: Open Shortest Path First IGRP: Interior Gateway Routing Protocol (Cisco proprietary)

.2. .1 6

1 /2

4 2 .1 17

.2 / 6.2

24 2 .1 17 S0

.1 / 6.4

24 2 17

.4. .1 6

2 /2

S0

172.16.1.1/24

S1 172.16.3.1/24

Hoboken

S1

waycross

172.16.5.1/24

waycross(config)# ip route

waycross(config)# ip route

[next-hop-address | outgoing interface] Default routes are used to route packets with destinations that do not match any of the other routes in the routing table

0.0.0.0

0.0.0.0

0.0.0.0

0.0.0.0

172.16.4.1

Chng 4. Giao thc tng mng

67

Chng 4. Giao thc tng mng

68

17

RIP ( Routing Information Protocol)


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

RIP: Example
z w A x D C
Destination Network

x y
Chng 4. Giao thc tng mng

w y z x

Next Router

A B B --

Num. of hops to dest.

....

2 2 7 1

Routing table in D
69 Chng 4. Giao thc tng mng 70

RIP Table processing

RIP Table example


Destination -------------------127.0.0.1 192.168.2. 193.55.114. 192.168.3. 224.0.0.0 default Gateway Flags Ref Use Interface -------------------- ----- ----- ------ --------127.0.0.1 UH 0 26492 lo0 192.168.2.5 U 2 13 fa0 193.55.114.6 U 3 58503 le0 192.168.3.5 U 2 25 qaa0 193.55.114.6 U 3 0 le0 193.55.114.129 UG 0 143454

RIP routing tables managed by application-level process called route-d (daemon) advertisements c gi nh k, qua UDP packets.

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 71 Chng 4. Giao thc tng mng 72

18

OSPF (Open Shortest Path First) open: publicly available; RFC 2178 Uses Link State algorithm
LS packet dissemination Topology map at each node Route computation using Dijkstras algorithm

OSPF advanced features (not in RIP)


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.
73 Chng 4. Giao thc tng mng 74

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

Chng 4. Giao thc tng mng

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.

Internet inter-AS routing: BGP


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

(OSPF intra-AS routing)

Chng 4. Giao thc tng mng

75

Chng 4. Giao thc tng mng

76

19

You might also like