试验七:发布bgp子网信息
R1,
R1(config)#int fa0/0
R1(config-if)#ip addr 172.16.10.1 255.255.255.0
R1(config-if)#no shut
R1(config-router)#router rip
R1(config-router)#net 172.16.0.0
R1(config-router)#exit
 
R1上测试:
R1#show ip ro
*Apr 22 16:24:47.115: %SYS-5-CONFIG_I: Configured from console by console
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
 
C    202.110.100.0/24 is directly connected, Serial1/0
R    202.110.101.0/24 [120/1] via 202.110.100.2, 00:00:01, Serial1/0
C    192.168.10.0/24 is directly connected, Loopback0
     172.16.0.0/24 is subnetted, 1 subnets  //子网信息
C       172.16.10.0 is directly connected, FastEthernet0/0
R1#
R2上测试:
 
R2#show ip ro
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
 
C    202.110.100.0/24 is directly connected, Serial1/0
C    202.110.101.0/24 is directly connected, Serial1/1
R    192.168.10.0/24 [120/1] via 202.110.100.1, 00:00:17, Serial1/0
R    172.16.0.0/16 [120/1] via 202.110.100.1, 00:00:09, Serial1/0
结论:R2学习不到子网信息。
到这里并没有实现本试验的目的,既然R2学习不到子网信息,那么我们采用什么方法将子网发布出去呢?下面介绍bgp环境下发布子网信息。
语法:
config-router#no  auto-summary   关闭自动汇总
config-router#network  子网号  mask  掩码
 
R1上发布子网信息:
R1(config)#router bgp 64500
R1(config-router)#no auto-summary
R1(config-router)#network 172.16.10.0 mask 255.255.255.0
R1(config-router)#exit
 
R2上测试,
C    202.110.100.0/24 is directly connected, Serial1/0
C    202.110.101.0/24 is directly connected, Serial1/1
R    192.168.10.0/24 [120/1] via 202.110.100.1, 00:00:06, Serial1/0
R    172.16.0.0/16 [120/1] via 202.110.100.1, 00:00:06, Serial1/0
和上面的试验结果一样,也就是发布子网的效果没有,这是不正常的,正常情况应该是发布子网后R2应该能够学到子网的信息,所以要尝试去排错,在做每个试验前要实现什么效果,如果理论没错的话学会排错很重要。我想了好长时间,终于,哦,原来R2R1还不是邻居关系,所以马上建立邻居吧。
 
R2(config)#router bgp 64500
R2(config-router)#neighbor 202.110.100.1 remote-as 64500
R2(config-router)#net 202.110.100.0
R2(config-router)#net 202.110.101.0
R2(config-router)#exit
R2(config)#exit
再次在R2上测试:
 
 
C    202.110.100.0/24 is directly connected, Serial1/0
C    202.110.101.0/24 is directly connected, Serial1/1
R    192.168.10.0/24 [120/1] via 202.110.100.1, 00:00:07, Serial1/0
     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
B       172.16.10.0/24 [200/0] via 202.110.100.1, 00:00:06
R       172.16.0.0/16 [120/1] via 202.110.100.1, 00:00:07, Serial1/0
R2#
故障真的在这里,这样的话今天的问题解决了,还算顺利吧!!!