预配置 int lo0 ip add 1.1.1.1 255.255.255.255 int s2/1 ip add 12.0.0.1 255.255.255.0 no sh router os 11 net 0.0.0.0 0.0.0.0 a 0

int s2/1 ip add 12.0.0.2 255.255.255.0 no sh int s2/2 ip add 23.0.0.2 255.255.255.0 no sh router os 11 net 0.0.0.0 0.0.0.0 a 0

int s2/1 ip add 23.0.0.3 255.255.255.0 no sh router os 11 net 0.0.0.0 0.0.0.0 a 0


实验过程:R1和R3建立EBGP邻居 第一步:配置R1和R3 R1(config)#router bgp 1 R1(config-router)#nei 23.0.0.3 remot 3 R1(config-router)#nei 23.0.0.3 ebgp-multihop 2 R1(config-router)#end

R3(config)#router bgp 2 R3(config-router)#nei 12.0.0.1 remote-as 1 R3(config-router)#nei 12.0.0.1 ebgp-multihop 2 R3(config-router)#end

第二步:查看R3的路由表 R3#sh ip rou 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/32 is subnetted, 1 subnets O 1.1.1.1 [110/129] via 23.0.0.2, 00:00:03, Serial2/1 //这里为ospf的管理距离为110,过会儿看看后面(第五步的这里) 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/65] via 23.0.0.2, 00:31:44, Serial2/1 3.0.0.0/24 is subnetted, 1 subnets C 3.3.3.0 is directly connected, Loopback0 23.0.0.0/24 is subnetted, 1 subnets C 23.0.0.0 is directly connected, Serial2/1 12.0.0.0/24 is subnetted, 1 subnets O 12.0.0.0 [110/128] via 23.0.0.2, 00:31:44, Serial2/1 第三步:引入:IGP路由 R1(config)#router bgp 1 R1(config-router)#network 1.1.1.1 mask 255.255.255.255 第四步:查看BGP表 R1#sh ip b BGP table version is 2, 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.1/32 0.0.0.0 0 32768 i 第五步:查看路由表 R3#sh ip rou 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/32 is subnetted, 1 subnets B 1.1.1.1 [20/0] via 12.0.0.1, 00:01:31 //这里是EBGP 管理距离为20. 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/65] via 23.0.0.2, 00:26:54, Serial2/1 3.0.0.0/24 is subnetted, 1 subnets C 3.3.3.0 is directly connected, Loopback0 23.0.0.0/24 is subnetted, 1 subnets C 23.0.0.0 is directly connected, Serial2/1 12.0.0.0/24 is subnetted, 1 subnets O 12.0.0.0 [110/128] via 23.0.0.2, 00:26:54, Serial2/1