r1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />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
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

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/8 is variably subnetted, 2 subnets, 2 masks
S       2.2.2.2/32 is directly connected, Serial1/1
B       2.2.2.0/24 [20/0] via 2.2.2.2, 00:22:33
     3.0.0.0/24 is subnetted, 1 subnets
B       3.3.3.0 [20/0] via 2.2.2.2, 00:22:33
B    193.1.1.0/24 [20/0] via 2.2.2.2, 00:22:33
C    192.1.1.0/24 is directly connected, Serial1/1
r1#show ip bgp
BGP table version is 6, 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       2.2.2.2                  0             0 23 i
*> 3.3.3.0/24       2.2.2.2                                0 23 i
*  192.1.1.0        2.2.2.2                  0             0 23 i
*>                  0.0.0.0                  0         32768 i
*> 193.1.1.0        2.2.2.2                                0 23 i
r1#show run
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
interface Serial1/1
 ip address 192.1.1.1 255.255.255.0
 serial restart-delay 0
!
router bgp 1
 no synchronization
 bgp log-neighbor-changes
 network 1.1.1.0 mask 255.255.255.0
 network 192.1.1.0
 neighbor 2.2.2.2 remote-as 23
 neighbor 2.2.2.2 ebgp-multihop 255
 neighbor 2.2.2.2 update-source Loopback0
 no auto-summary
!
ip classless
ip route 2.2.2.2 255.255.255.255 Serial1/1

 

 

 

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/8 is variably subnetted, 2 subnets, 2 masks
S       1.1.1.1/32 is directly connected, Serial1/0
B       1.1.1.0/24 [20/0] via 1.1.1.1, 00:23:10
     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
R       3.3.3.0 [120/1] via 193.1.1.2, 00:00:23, Serial1/1
C    193.1.1.0/24 is directly connected, Serial1/1
C    192.1.1.0/24 is directly connected, Serial1/0
r2#show ip bgp su
BGP router identifier 2.2.2.2, local AS number 23
BGP table version is 8, main routing table version 8
5 network entries using 505 bytes of memory
6 path entries using 288 bytes of memory
3 BGP path attribute entries using 180 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 997 total bytes of memory
BGP activity 12/7 prefixes, 15/9 paths, scan interval 60 secs

 

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1         4     1     199     351        8    0    0 00:23:13        2
3.3.3.3         4    23     187     193        8    0    0 00:23:42        2
r2#show ip bgp
BGP table version is 8, 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       1.1.1.1                  0             0 1 i
*> 2.2.2.0/24       0.0.0.0                  0         32768 i
r>i3.3.3.0/24       3.3.3.3                  0    100      0 i
*  192.1.1.0        1.1.1.1                  0             0 1 i
*>                  0.0.0.0                  0         32768 i
r>i193.1.1.0        3.3.3.3                  0    100      0 i
r2#show run
interface Loopback0
 ip address 2.2.2.2 255.255.255.0
 ip ospf network point-to-point
!
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 rip
 version 2
 network 2.0.0.0
 network 192.1.1.0
 network 193.1.1.0
 no auto-summary
!
router bgp 23
 no synchronization
 bgp log-neighbor-changes
 network 2.2.2.0 mask 255.255.255.0
 network 192.1.1.0
 neighbor 1.1.1.1 remote-as 1
 neighbor 1.1.1.1 ebgp-multihop 255
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 3.3.3.3 remote-as 23
加上下面这句话,就不会出现下面的那种情况了!!!
neighbor 3.3.3.3 next-hop-self
 neighbor 3.3.3.3 update-source Loopback0
 no auto-summary
!
ip classless
ip route 1.1.1.1 255.255.255.255 Serial1/0
no ip http server
!
!
!
!
!
!
!
!
!
gatekeeper
 shutdown
!
!
line con 0
 exec-timeout 0 0
 logging synchronous
 stopbits 1
line aux 0
 stopbits 1
line vty 0 4
!
!
End

 

 

 

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

 

这里缺少路由条目!!原因是在R2的BGP协议里没有指认下一跳
     2.0.0.0/24 is subnetted, 1 subnets
R       2.2.2.0 [120/1] via 193.1.1.1, 00:00:15, Serial1/0
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
C    193.1.1.0/24 is directly connected, Serial1/0
R    192.1.1.0/24 [120/1] via 193.1.1.1, 00:00:15, Serial1/0
r3#show ip bgp
BGP table version is 7, 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网段的路由条目,所以不会被写入BGP表中,故前面没有大于号!
* i1.1.1.0/24       1.1.1.1                  0    100      0 1 i
r>i2.2.2.0/24       2.2.2.2                  0    100      0 i
*> 3.3.3.0/24       0.0.0.0                  0         32768 i
r>i192.1.1.0        2.2.2.2                  0    100      0 i
*> 193.1.1.0        0.0.0.0                  0         32768 i
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
!
router rip
 version 2
 network 3.0.0.0
 network 193.1.1.0
 no auto-summary
!
router bgp 23
 no synchronization
 bgp log-neighbor-changes
 network 3.3.3.0 mask 255.255.255.0
 network 193.1.1.0
 neighbor 2.2.2.2 remote-as 23
 neighbor 2.2.2.2 update-source Loopback0
 no auto-summary
!
ip classless
no ip http server
!
!
!
!
!
!
!
!
!
gatekeeper
 shutdown
!
!
line con 0
 exec-timeout 0 0
 logging synchronous
 stopbits 1
line aux 0
 stopbits 1
line vty 0 4
!
!
end