R3#sh ip route
………………
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 1 subnets
B 172.16.1.0 [20/0] via 192.168.1.1, 01:13:17
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial1/1
130.130.0.0/24 is subnetted, 1 subnets
B 130.130.1.0 [20/0] via 192.168.1.1, 01:13:17
(选择了EBGP路由作为下一跳)
C 192.168.1.0/24 is directly connected, Serial1/0
B 192.168.2.0/24 [200/0] via 10.1.1.2, 01:11:39
150.150.0.0/24 is subnetted, 1 subnets
B 150.150.1.0 [20/0] via 192.168.1.1, 01:13:17
R3#
R4#sh ip route
………………
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 1 subnets
B 172.16.1.0 [20/0] via 192.168.2.2, 01:22:55
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial1/0
130.130.0.0/24 is subnetted, 1 subnets
B 130.130.1.0 [20/0] via 192.168.2.2, 01:22:55
B 192.168.1.0/24 [200/0] via 10.1.1.1, 01:24:12
C 192.168.2.0/24 is directly connected, FastEthernet0/0
150.150.0.0/24 is subnetted, 1 subnets
B 150.150.1.0 [20/0] via 192.168.2.2, 01:22:55
(都选择了EBGP路由作为下一跳)
|
R4(config)#access-list 10 per 130.130.1.0 0.0.0.255 (
建立一个ACL)
R4(config)#route-map pbr per 10 (
建立一个名为pbr的路由图)
R4(config-route-map)#match ip add 10 (
匹配ACL 10)
R4(config-route-map)#set local-preference 150 (
匹配之后把本地优先级改成150)
R4(config)#router bgp 64513
(进入bgp进程)
R4(config-router)#nei 192.168.2.2 route-map pbr in
(指定邻居匹配路由图)
R4(config-route-map)#exit
R4(config)#route-map pbr permit 20 (
建立空的路由图,让整个网络的其它路由都按默认方式通告)
R4(config)#router bgp 64513
R4(config-router)#nei 10.1.1.1 next-hop-self
(指定下一跳为自我)
|
R3#sh ip bgp
…………
Network Next Hop Metric LocPrf Weight Path
* i10.1.1.0/24 10.1.1.2 0 100 0 i
*> 0.0.0.0 0 32768 i
* 130.130.1.0/24 192.168.1.1 0 64512 i
*>i 10.1.1.2
0 150 0 64512 i
(配置路由图增加了R4优先级)
* i150.150.1.0/24 10.1.1.2 0 100 0 64512 i
*> 192.168.1.1
0 0 64512 i
(同时R3现在选择了走R2)
* i172.16.1.0/24 10.1.1.2 0 100 0 64512 i
*> 192.168.1.1 0 0 64512 i
* 192.168.1.0 192.168.1.1 0 0 64512 i
*> 0.0.0.0 0 32768 i
* 192.168.2.0 192.168.1.1 0 64512 i
*>i 10.1.1.2 0 100 0 i
R4#sh ip bgp
…………
Network Next Hop Metric LocPrf Weight Path
*> 10.1.1.0/24 0.0.0.0 0 32768 i
* i 10.1.1.1 0 100 0 i
*> 130.130.1.0/24 192.168.2.2
0 150 0 64512 i
*> 150.150.1.0/24 192.168.2.2
0 64512 i
(加了空路由图,不影响R4)
* i 192.168.1.1 0 100 0 64512 i
*> 172.16.1.0/24 192.168.2.2 0 0 64512 i
* i 192.168.1.1 0 100 0 64512 i
* 192.168.1.0 192.168.2.2 0 64512 i
*>i 10.1.1.1 0 100 0 i
* 192.168.2.0 192.168.2.2 0 0 64512 i
*> 0.0.0.0 0 32768 i
|
R3#sh ip route
…………
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 1 subnets
B 172.16.1.0 [20/0] via 192.168.1.1, 00:58:13
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial1/1
130.130.0.0/24 is subnetted, 1 subnets
B 130.130.1.0 [200/0] via 10.1.1.2, 00:35:56
C 192.168.1.0/24 is directly connected, Serial1/0
B 192.168.2.0/24 [200/0] via 10.1.1.2, 00:58:14
150.150.0.0/24 is subnetted, 1 subnets
B 150.150.1.0 [20/0] via 192.168.1.1, 00:58:13
R3#traceroute 150.150.1.1
Type escape sequence to abort.
Tracing the route to 150.150.1.1
1 192.168.1.1 40 msec * 44 msec
R3#
R4#sh ip route
…………
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 1 subnets
B 172.16.1.0 [20/0] via 192.168.2.2, 00:29:55
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial1/0
130.130.0.0/24 is subnetted, 1 subnets
B 130.130.1.0 [20/0] via 192.168.2.2, 00:59:43
B 192.168.1.0/24 [200/0] via 10.1.1.1, 00:59:45
C 192.168.2.0/24 is directly connected, FastEthernet0/0
150.150.0.0/24 is subnetted, 1 subnets
B 150.150.1.0 [20/0] via 192.168.2.2, 00:29:55
R4#
|