
目的:
让3.1.1.1/24、3.2.1.1/24、3.3.1.1/24到1.1.1.1/24的路由走R4到R1;
让3.4.1.1/24、3.5.1.1/24、3.6.1.1/24到1.1.1.1/24的路由走R3到R1。
第一步:网络互通(略)
第二步:在R3上配制PBR(policy-based routing)
R3(config)#acce
R3(config)#access-list 1 per
R3(config)#access-list 1 permit 3.1.1.1
R3(config)#access-list 1 permit 3.2.1.1
R3(config)#access-list 1 permit 3.3.1.1
R3(config)#acce
R3(config)#access-list 2 per
R3(config)#access-list 2 permit 3.4.1.1
R3(config)#access-list 2 permit 3.5.1.1
R3(config)#access-list 2 permit 3.6.1.1
R3(config)#
R3(config)#route
R3(config)#route-
R3(config)#route-map
R3(config)#route-map PBR permit 10
R3(config-route-map)#ma
R3(config-route-map)#match ip add 1
R3(config-route-map)#se
R3(config-route-map)#set ip nex
R3(config-route-map)#set ip next-hop
34.0.0.4
R3(config-route-map)#exit
R3(config)#route-map PBR permit 20
R3(config-route-map)#match ip add 2
R3(config-route-map)#set ip next-hop
23.0.0.2
R3(config-route-map)#exit
R3(config)#route-map PBR permit 30
R3(config-route-map)#exit
R3(config)#int s 2/1
R3(config-if)#ip pol
R3(config-if)#ip policy ro
R3(config-if)#ip policy route-map PBR
R3(config-if)#EXIT
R3(config)#int s 2/2
R3(config-if)#ip policy route-map PBR
R3(config-if)#end
R3#
第三步:使用traceroute
命令进行测试
R3#traceroute
Protocol [ip]:
Target IP address: 1.1.1.1
Source address: 3.4.1.1
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live [30]:
Port Number [33434]:
Loose, Strict, Record, Timestamp,
Verbose[none]:
Type escape sequence to abort.
Tracing the route to 1.1.1.1
1 34.0.0.4 168 msec 144 msec 96 msec
2 14.0.0.1
264 msec * 192 msec
R3#tr
R3#traceroute
Protocol [ip]:
Target IP address: 1.1.1.1
Source address: 3.5.1.1
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live [30]:
Port Number [33434]:
Loose, Strict, Record, Timestamp,
Verbose[none]:
Type escape sequence to abort.
Tracing the route to 1.1.1.1
1 34.0.0.4 120 msec 136 msec 96 msec
2 14.0.0.1
192 msec * 192 msec
R3#
R3#traceroute
Protocol [ip]:
Target IP address: 1.1.1.1
Source address: 3.1.1.1
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live
[30]:
Port Number [33434]:
Loose, Strict, Record,
Timestamp, Verbose[none]:
Type escape sequence to
abort.
Tracing the route to 1.1.1.1
1 34.0.0.4 120 msec 120 msec 72 msec
2 14.0.0.1
168 msec * 168 msec
R3#tr
R3#traceroute
Protocol [ip]:
Target IP address: 1.1.1.1
Source address: 3.2.1.1
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live
[1]:
Maximum Time to Live
[30]:
Port Number [33434]:
Loose, Strict, Record,
Timestamp, Verbose[none]:
Type escape sequence to
abort.
Tracing the route to 1.1.1.1
1 34.0.0.4 92 msec 72 msec 120 msec
2 14.0.0.1
168 msec * 168 msec
R3#
转载于:https://blog.51cto.com/davidsergent/89654