You are on page 1of 69

Chương 4: Định tuyến

4.1 Tổng quan về định tuyến.


4.2 Chức năng của Router.
4.3 Các dòng định tuyến.
4.4 Các giao thức định tuyến.
4.5 NAT_PAT.

1
4.1 Tổng quan về định tuyến.

2
What is Routing?
10.120.2.0 172.16.1.0

 To route, a router needs to know:


 Destination addresses
 Sources it can learn from
 Possible routes
 Best route
 Maintain and verify routing information
What is Routing? (cont.)
10.120.2.0 172.16.1.0

E0
S0

Network Destination Exit


Protocol Network Interface

Connected
Learned
10.120.2.0
172.16.1.0
E0
S0
Routed Protocol:

Routers must learn destinations that are


not directly connected
4.2 Chức năng của Router.
A router is a three-layer device that routes
packets based on their logical addresses
(host-to-host addressing). A router normally
connects LANs and WANs in the Internet
and has a routing table that is used for making
decisions about the route. The routing
tables are normally dynamic and are updated
using routing protocols
5
4.2 Chức năng của Router.
 Routers connecting independent LANs and WANs

6
4.2 Chức năng của Router.
 WANs .

7
4.2 Chức năng của Router.
 WANs .

8
4.2 Chức năng của Router.
 WANs .

9
Routers
Cisco 2800 Series Router

 Routers have the following components:


 CPU
 Motherboard
 RAM
 ROM
 Routers have network adapters to which IP addresses are assigned.
 Routers may have the following two kinds of ports:
 Console: For the attachment of a terminal used for management
 Network: Different LAN or WAN media ports
 Routers forward packets based upon a routing table.
Router Functions
RouterX# show ip route
D 192.168.1.0/24 [90/25789217] via 10.1.1.1
1 R 192.168.2.0/24 [120/4] via 10.1.1.2 2
O 192.168.3.0/24 [110/229840] via 10.1.1.3

1. Lets other routers know about changes


2. Determines where to forward packets
Path Determination
Routing Tables
Routing Table Entries
 Directly connected: Router attaches to this
network
 Static routing: Entered manually by a system
administrator
 Dynamic routing: Learned by exchange of
routing information
 Default route: Statically or dynamically
learned; used when no explicit route to
network is known
Routing Metrics
4.3 Các dòng định tuyến.

16
Identifying Static and
Dynamic Routes

 Static Route  Dynamic Route


Uses a route that a Uses a route that a
network administrator network routing
enters into the router protocol adjusts
manually automatically for
topology or traffic
changes
Static Routes
Stub Network

172.16.1.0
SO
Network A 172.16.2.2 172.16.2.1
B
B

Configure unidirectional static routes to and from a


stub network to allow communications to occur.
Static Route Configuration

Router(config)#ip route network [mask]


{address | interface}[distance] [permanent]
Defines a path to an IP destination network or subnet
Static Route Example
Stub Network

172.16.1.0
SO
Network
10.0.0.0 A B
B
172.16.2.2 172.16.2.1

ip route 172.16.1.0 255.255.255.0 172.16.2.1

• This is a unidirectional route. You must have a route


configured in the opposite direction.
Default Routes
Stub Network

172.16.1.0
SO
Network
10.0.0.0 A BB
172.16.2.2 172.16.2.1

ip route 0.0.0.0 0.0.0.0 172.16.2.2

• This route allows the stub network to reach all known


networks beyond router A.
4.4 Các giao thức định tuyến.
.

22
What is a Routing Protocol?
10.120.2.0 172.16.1.0

 Routing protocols are E0


S0
used between
routers to determine
paths and maintain
routing tables.
 Once the path is Network Destination Exit 172.17.3.0
Protocol Network Interface
determined a router can
Connected 10.120.2.0 E0
route a routed protocol. RIP 172.16.2.0 S0
IGRP 172.17.3.0 S1
Routed Protocol: IP
Routing protocol: RIP, IGRP
Autonomous Systems: Interior or
Exterior Routing Protocols
IGPs: RIP, IGRP EGPs: BGP

Autonomous System 100 Autonomous System 200

• An autonomous system is a collection of networks


under a common administrative domain
• IGPs operate within an autonomous system
• EGPs connect different autonomous systems
Administrative Distance:
Ranking Routes

I need to send a packet to


Network E. Both router B IGRP
and C will get it there. Administrative
Which route is best? Distance=100

Router A Router B

RIP
Administrative
Distance=120

E
Router C Router D
Classes of Routing Protocols
B
Distance Vector
C A

Hybrid Routing

B
Link State
C A

D
Distance Vector Routing
Protocols: RIP
B

C A

Distance—How far
Vector—In which direction D

D C B A

Routing Routing Routing Routing


Table Table Table Table

 Pass periodic copies of routing table to neighbor


routers and accumulate distance vectors
Information and Discovering
Routes
10.1.0.0 10.2.0.0 10.3.0.0 10.4.0.0
E0 A S0 S0 B S1 S0 C E0

Routing Table Routing Table Routing Table


10.1.0.0 E0 0 10.2.0.0 S0 0 10.3.0.0 S0 0
10.2.0.0 S0 0 10.3.0.0 S1 0 10.4.0.0 E0 0

 Routers discover the best path to


destinations from each neighbor
Information and Discovering
Routes
10.1.0.0 10.2.0.0 10.3.0.0 10.4.0.0
E0 A S0 S0 B S1 S0 C E0

Routing Table Routing Table Routing Table


10.1.0.0 E0 0 10.2.0.0 S0 0 10.3.0.0 S0 0
10.2.0.0 S0 0 10.3.0.0 S1 0 10.4.0.0 E0 0
10.3.0.0 S0 1 10.4.0.0 S1 1 10.2.0.0 S0 1
10.1.0.0 S0 1

 Routers discover the best path to


destinations from each neighbor
Information and Discovering
Routes
10.1.0.0 10.2.0.0 10.3.0.0 10.4.0.0
E0 A S0 S0 B S1 S0 C E0

Routing Table Routing Table Routing Table


10.1.0.0 E0 0 10.2.0.0 S0 0 10.3.0.0 S0 0
10.2.0.0 S0 0 10.3.0.0 S1 0 10.4.0.0 E0 0
10.3.0.0 S0 1 10.4.0.0 S1 1 10.2.0.0 S0 1
10.4.0.0 S0 2 10.1.0.0 S0 1 10.1.0.0 S0 2

 Routers discover the best path to


destinations from each neighbor
Distance Vector—Selecting
Best Route with Metrics
A IGRP

Bandwidth
56
RIP Delay
Load
Hop count
T1 56 Reliability
IPX MTU
T1
Ticks, hop count
B

Information used to select the best path for routing


Maintaining Routing
Information
Process to
update this
routing
table

Topology
change
causes
routing
A table
update

 Updates proceed step-by-step


from router to router
Maintaining Routing
Information
Process to
update this
routing
table

Router A sends Topology


out this updated change
routing table causes
after the routing
next period A table
expires update

 Updates proceed step-by-step


from router to router
Maintaining Routing
Information
Process to Process to
update this update this
routing routing
table table

Router A sends Topology


out this updated change
routing table causes
after the routing
B next period A table
expires update

 Updates proceed step-by-step


from router to router
Information Problem—
Routing Loops
10.1.0.0 10.2.0.0 10.3.0.0 10.4.0.0
E0 A S0 S0 B S1 S0 C E0

Routing Table Routing Table Routing Table


10.1.0.0 E0 0 10.2.0.0 S0 0 10.3.0.0 S0 0
10.2.0.0 S0 0 10.3.0.0 S1 0 10.4.0.0 E0 0
10.3.0.0 S0 1 10.4.0.0 S1 1 10.2.0.0 S0 1
10.4.0.0 S0 2 10.1.0.0 S0 1 10.1.0.0 S0 2

 Each node maintains the distance from itself to each possible


destination network
Information Problem—
Routing Loops
10.1.0.0 10.2.0.0 10.3.0.0 10.4.0.0
E0 A S0 S0 B S1 S0 C E0 X

Routing Table Routing Table Routing Table


10.1.0.0 E0 0 10.2.0.0 S0 0 10.3.0.0 S0 0
10.2.0.0 S0 0 10.3.0.0 S1 0 10.4.0.0 E0 Down
10.3.0.0 S0 1 10.4.0.0 S1 1 10.2.0.0 S0 1
10.4.0.0 S0 2 10.1.0.0 S0 1 10.1.0.0 S0 2

 Slow convergence produces inconsistent routing


Information Problem—Routing
Loops
10.1.0.0 10.2.0.0 10.3.0.0 10.4.0.0
E0 A S0 S0 B S1 S0 C E0 X

Routing Table Routing Table Routing Table


10.1.0.0 E0 0 10.2.0.0 S0 0 10.3.0.0 S0 0
10.2.0.0 S0 0 10.3.0.0 S1 0 10.4.0.0 S0 2
10.3.0.0 S0 1 10.4.0.0 S1 1 10.2.0.0 S0 1
10.4.0.0 S0 2 10.1.0.0 S1 1 10.1.0.0 S0 2

Router C concludes that the best path to network


10.4.0.0 is through Router B
Information Problem—Routing
Loops
10.1.0.0 10.2.0.0 10.3.0.0 10.4.0.0
E0 A S0 S0 B S1 S0 C E0 X

Routing Table Routing Table Routing Table


10.1.0.0 E0 0 10.2.0.0 S0 0 10.3.0.0 S0 0
10.2.0.0 S0 0 10.3.0.0 S1 0 10.4.0.0 S0 2
10.3.0.0 S0 1 10.4.0.0 S1 3 10.2.0.0 S0 1
10.4.0.0 S0 4 10.1.0.0 S0 1 10.1.0.0 S0 2

Router A updates its table to reflect the new but


erroneous hop count
Symptom: Counting to
Infinity
10.1.0.0 10.2.0.0 10.3.0.0 10.4.0.0
E0 A S0 S0 B S1 S0 C E0 X

Routing Table Routing Table Routing Table


10.1.0.0 E0 0 10.2.0.0 S0 0 10.3.0.0 S0 0
10.2.0.0 S0 0 10.3.0.0 S1 0 10.4.0.0 S0 4
10.3.0.0 S0 1 10.4.0.0 S1 5 10.2.0.0 S0 1
10.4.0.0 S0 6 10.1.0.0 S0 1 10.1.0.0 S0 2

• Packets for network 10.4.0.0 bounce between routers A, B,


and C
• Hop count for network 10.4.0.0 counts to infinity
Solution: Defining a
Maximum
10.1.0.0 10.2.0.0 10.3.0.0 10.4.0.0
E0 A S0 S0 B S1 S0 C E0 X

Routing Table Routing Table Routing Table


10.1.0.0 E0 0 10.2.0.0 S0 0 10.3.0.0 S0 0
10.2.0.0 S0 0 10.3.0.0 S1 0 10.4.0.0 S0 16
10.3.0.0 S0 1 10.4.0.0 S1 16 10.2.0.0 S0 1
10.4.0.0 S0 16 10.1.0.0 S0 1 10.1.0.0 S0 2

 Define a limit on the number of hops to prevent infinite


loops
Solution: Split Horizon
10.1.0.0 10.2.0.0 10.3.0.0 10.4.0.0
E0 A S0 S0 B S1 S0 C E0 X
X X
Routing Table Routing Table Routing Table
10.1.0.0 E0 0 10.2.0.0 S0 0 10.3.0.0 S0 0
10.2.0.0 S0 0 10.3.0.0 S1 0 10.4.0.0 S0 0
10.3.0.0 S0 1 10.4.0.0 S1 1 10.2.0.0 S0 1
10.4.0.0 S0 2 10.1.0.0 E1 2 10.1.0.0 S0 2

 It is never useful to send information about a route back in


the direction from which the original packet came
Solution: Route Poisoning
10.1.0.0 10.2.0.0 10.3.0.0 10.4.0.0
E0 A S0 S0 B S1 S0 C E0 X

Routing Table Routing Table Routing Table


10.1.0.0 E0 0 10.2.0.0 S0 0 10.3.0.0 S0 0
10.2.0.0 S0 0 10.3.0.0 S1 0 10.4.0.0 S0 Infinity
10.3.0.0 S0 1 10.4.0.0 S1 1 10.2.0.0 S0 1
10.4.0.0 S0 2 10.1.0.0 E1 2 10.1.0.0 S0 2

 Routers set the distance of routes that have gone down to


infinity
Solution: Poison Reverse
10.1.0.0 10.2.0.0 10.3.0.0 10.4.0.0
E0 A S0 S0 B S1 S0 C E0 X
Poison
Reverse
Routing Table Routing Table Routing Table
10.1.0.0 E0 0 10.2.0.0 S0 0 10.3.0.0 S0 0
10.2.0.0 S0 0 10.3.0.0 S1 0 10.4.0.0 S0 Infinity
Possibly
10.3.0.0 S0 1 10.4.0.0 S1 Down 10.2.0.0 S0 1
10.4.0.0 S0 2 10.1.0.0 E1 2 10.1.0.0 S0 2

 Poison Reverse overrides split horizon


Solution: Hold-Down
Timers
Network 10.4.0.0
Update after is unreachable
hold-down Time
10.1.0.0 10.2.0.0 10.3.0.0 10.4.0.0
E0 A S0 S0 B S1 S0 C E0 X
Update after
hold-down Time Network 10.4.0.0 is down
then back up
then back down

 Router keeps an entry for the network possibly down state,


allowing time for other routers to recompute for this topology
change
Solution: Triggered Updates
Network 10.4.0.0 Network 10.4.0.0 Network 10.4.0.0
is unreachable is unreachable is unreachable

10.1.0.0 10.2.0.0 10.3.0.0 10.4.0.0


E0 A S0 S0 B S1 S0 C E0 X

 Router sends updates when a change in its routing table


occurs
Implementing Solutions in
Multiple Routes

10.4.0.0

E B X C

A
Implementing Solutions in
Multiple Routes (cont.)
Holddown

10.4.0.0

E B X C

Holddown

Holddown
Implementing Solutions in
Multiple Routes (cont.)
Holddown

Poison Reverse
D
Poison Reverse

10.4.0.0

E B X C

Holddown

Poison Reverse

Poison Reverse
A

Holddown
Implementing Solutions in
Multiple Routes (cont.)
Holddown

10.4.0.0

E B X C

Holddown
Packet for
Packet for Network 10.4.0.0
Network 10.4.0.0
A

Holddown
Implementing Solutions in
Multiple Routes (cont.)

10.4.0.0

E B C
Link up!

A
Implementing Solutions in
Multiple Routes (cont.)

10.4.0.0

E B C
Link up!

A
Link-State Routing
Protocols
B

C A

D
Link-State Packets
Topological
Database
Routing
SPF Table
Algorithm

Shortest Path First Tree


 After initial flood, pass small event-triggered link-state
updates to all other routers
Hybrid Routing
Choose a
routing path based
on distance vectors

Balanced Hybrid Routing

Converge rapidly using


change-based
updates

 Share attributes of both distance-vector


and link-state routing
IGRP Composite Metric
19.2 kbps 19.2 kbps

Source

Destination

Bandwidth
Delay
Reliability
Loading
MTU
IGRP Unequal Multiple
Paths

New Route

Source

Initial
Route Destination

 Maximum six paths (default = 4)


 Within metric variance
 Next-hop router closer to destination
4.5 NAT_PAT
 WANs .

56
4.5 NAT_PAT
 WANs .

57
4.5 NAT_PAT
NAT catergory:
-Static NAT
-Dynamic NAT
-NAT overloading (PAT=port address translation)

58
4.5 NAT_PAT
A NAT implementation

59
4.5 NAT_PAT
Address Translation
 All the outgoing packets go through the NAT
router, which replaces the source address
in the packet with the global NAT address.
 All incoming packets also pass through the
NAT router, which replaces the destination
address in the packet (the NAT router global
address) with the appropriate private address 60
4.5 NAT_PAT

61
4.5 NAT_PAT
Translation Table
 Using One lP Address:
 In its simplest form, a translation table has only two columns: the
private address and the external address (destination address of the
packet).
 When the router translates the source address of the outgoing
packet, it also makes note of the destination address-where the
packet is going. When the response comes back from the
destination, the router uses the source address of the packet (as the
external address) to find the private address of the packet
62
4.5 NAT_PAT
NAT address translation

63
4.5 NAT_PAT
 Using a Pool of lP Addresses:
Since the NAT router has only one global address,
only one private network host can access the same
external host. To remove this restriction, the
NAT router uses a pool of global addresses.

64
4.5 NAT_PAT
 Using Both lP Addresses and Port Numbers: To
allow a many-to-many relationship between
private-network hosts and external server
programs, we need more information in the
translation table

65
4.5 NAT_PAT
 WANs .

66
4.5 NAT_PAT
 WANs .

67
4.5 NAT_PAT
 WANs .

68
4.5 NAT_PAT
 WANs .

69

You might also like