r1#show ip bgp
BGP table version is 8, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 32768 i
*> 2.2.2.0/24 192.1.1.2 0 0 200 i
* 3.3.3.0/24 195.1.1.2 0 400 300 i
*> 192.1.1.2 0 200 300 I
走
R2
* 4.4.4.0/24 192.1.1.2 0 200 300 400 i
*> 195.1.1.2 0 0 400 i
一、在
R1
上设置权重!!!!!!!
r1#conf t
r1(config)#access-list 1 per 3.3.3.0
r1(config)#route-map wei per 10
r1(config-route-map)#match ip add 1
r1(config-route-map)#set wei 1000
r1(config-route-map)#route-map wei per 20
r1(config-route-map)#router bgp 100
r1(config-router)#neighbor 195.1.1.2 route-map wei in
r1#clear ip bgp * s
r1#show ip bgp
BGP table version is 9, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 32768 i
*> 2.2.2.0/24 192.1.1.2 0 0 200 i
*> 3.3.3.0/24 195.1.1.2 1000 400 300 I
走
R4!!!!!!!
* 192.1.1.2 0 200 300 i
* 4.4.4.0/24 192.1.1.2 0 200 300 400 i
*> 195.1.1.2 0 0 400 i
r1#SHOW IP BGP
BGP table version is 9, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 32768 i
*> 2.2.2.0/24 192.1.1.2 0 0 200 i
*> 3.3.3.0/24 195.1.1.2 1000 400 300 i
* 192.1.1.2 0 200 300 i
* 4.4.4.0/24 192.1.1.2 0 200 300 400 i
*> 195.1.1.2 0 0 400 i
r1# SHOW IP ROUTE
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF , IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
B 2.2.2.0 [20/0] via 192.1.1.2, 01:08:21
3.0.0.0/24 is subnetted, 1 subnets
B 3.3.3.0 [20/0] via 195.1.1.2, 00:30:06
4.0.0.0/24 is subnetted, 1 subnets
B 4.4.4.0 [20/0] via 195.1.1.2, 00:33:02
C 192.1.1.0/24 is directly connected, Serial1/1
C 195.1.1.0/24 is directly connected, FastEthernet0/0
r1#SHWO RUN
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 195.1.1.1 255.255.255.0
duplex half
!
interface Serial1/1
ip address 192.1.1.1 255.255.255.0
serial restart-delay 0
router bgp 100
no synchronization
bgp log-neighbor-changes
network 1.1.1.0 mask 255.255.255.0
neighbor 192.1.1.2 remote-as 200
neighbor 195.1.1.2 remote-as 400
neighbor 195.1.1.2 route-map wei in
no auto-summary
!
ip classless
no ip http server
!
!
access-list 1 permit 3.3.3.0
!
route-map wei permit 10
match ip address 1
set weight 1000
!
route-map wei permit 20
!
r2#SHOW IP BGP
BGP table version is 11, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 192.1.1.1 0 0 100 i
*> 2.2.2.0/24 0.0.0.0 0 32768 i
* 3.3.3.0/24 192.1.1.1 0 100 400 300 i
*> 193.1.1.2 0 0 300 i
* 4.4.4.0/24 192.1.1.1 0 100 400 i
*> 193.1.1.2 0 300 400 i
r2# SHOW IP ROUTE
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF , IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
B 1.1.1.0 [20/0] via 192.1.1.1, 01:08:55
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
3.0.0.0/24 is subnetted, 1 subnets
B 3.3.3.0 [20/0] via 193.1.1.2, 01:24:13
4.0.0.0/24 is subnetted, 1 subnets
B 4.4.4.0 [20/0] via 193.1.1.2, 00:33:37
C 193.1.1.0/24 is directly connected, Serial1/1
C 192.1.1.0/24 is directly connected, Serial1/0
r2#SHOW RUN
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface Serial1/0
ip address 192.1.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 193.1.1.1 255.255.255.0
serial restart-delay 0
!
router bgp 200
no synchronization
bgp log-neighbor-changes
network 2.2.2.0 mask 255.255.255.0
neighbor 192.1.1.1 remote-as 100
neighbor 193.1.1.2 remote-as 300
no auto-summary
!
r3#SHOW IP BGP
BGP table version is 10, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 1.1.1.0/24 194.1.1.2 0 400 100 i
*> 193.1.1.1 0 200 100 i
* 2.2.2.0/24 194.1.1.2 0 400 100 200 i
*> 193.1.1.1 0 0 200 i
*> 3.3.3.0/24 0.0.0.0 0 32768 i
*> 4.4.4.0/24 194.1.1.2 0 0 400 i
r3# SHOW IP ROUTE
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF , IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
B 1.1.1.0 [20/0] via 193.1.1.1, 01:09:25
2.0.0.0/24 is subnetted, 1 subnets
B 2.2.2.0 [20/0] via 193.1.1.1, 01:23:58
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
4.0.0.0/24 is subnetted, 1 subnets
B 4.4.4.0 [20/0] via 194.1.1.2, 00:34:20
C 193.1.1.0/24 is directly connected, Serial1/0
C 194.1.1.0/24 is directly connected, Serial1/1
r3#SHOW RUN
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface Serial1/0
ip address 193.1.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 194.1.1.1 255.255.255.0
serial restart-delay 0
!
router bgp 300
no synchronization
bgp log-neighbor-changes
network 3.3.3.0 mask 255.255.255.0
neighbor 193.1.1.1 remote-as 200
neighbor 194.1.1.2 remote-as 400
no auto-summary
!
ip classless
no ip http server
!
r4#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF , IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
B 1.1.1.0 [20/0] via 195.1.1.1, 00:35:03
2.0.0.0/24 is subnetted, 1 subnets
B 2.2.2.0 [20/0] via 195.1.1.1, 00:35:03
3.0.0.0/24 is subnetted, 1 subnets
B 3.3.3.0 [20/0] via 194.1.1.1, 00:35:03
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
C 195.1.1.0/24 is directly connected, FastEthernet0/0
C 194.1.1.0/24 is directly connected, Serial1/0
r4#show ip bgp
BGP table version is 5, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 1.1.1.0/24 194.1.1.1 0 300 200 100 i
*> 195.1.1.1 0 0 100 i
* 2.2.2.0/24 194.1.1.1 0 300 200 i
*> 195.1.1.1 0 100 200 i
*> 3.3.3.0/24 194.1.1.1 0 0 300 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
r4#show run
interface Loopback0
ip address 4.4.4.4 255.255.255.0
!
interface FastEthernet0/0
ip address 195.1.1.2 255.255.255.0
duplex half
!
interface Serial1/0
ip address 194.1.1.2 255.255.255.0
serial restart-delay 0
!
router bgp 400
no synchronization
bgp log-neighbor-changes
network 4.4.4.0 mask 255.255.255.0
neighbor 194.1.1.1 remote-as 300
neighbor 195.1.1.1 remote-as 100
no auto-summary
!
ip classless
no ip http server
!
!
access-list 1 permit 3.3.3.0
!
route-map wei permit 10
match ip address 1
set weight 1000
!
route-map wei permit 20
!