实验: BGP local-AS应用
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

拓扑

 

ISP-A s1/3  ---------------
   |                                     |             
   | s1/2                              | s1/3
   |                                ISP-C
   | s1/2                               | s1/3
   |                                       |
ISP-B s1/0  -----------------

 

 

期中,AS的分配为:ISP AS100, ISP-B AS200,ISP-C AS300

 

说明:当ISP-AISP-B合并,那么为了统一管理,ISP-BAS号要改为和ISP-AAS号。
但是,因为ISP-CISP-B之间有很多策略,不愿意立即更改,做为临时或者变通的办法,采用BGPlocal-as特性来做变通。
注意:local-as只在ebgp中使用,不能在联邦子系统之间的ebgp使用。
要点:ISP-B as改为100后,ISP-C的配置没有变化

 

合并前配置(省略其他部分):

 

------------------------------------------------
hostname IPS-A
logging buffered 4096000 debugging
interface FastEthernet0/0
 ip address 192.168.1.1 255.255.255.0

 

interface Serial1/2
 ip address 172.16.12.1 255.255.255.0

 

interface Serial1/3
 ip address 172.16.13.1 255.255.255.0

 

router bgp 100
 no synchronization
 bgp log-neighbor-changes
 network 172.16.12.0 mask 255.255.255.0
 network 172.16.13.0 mask 255.255.255.0
 network 192.168.1.0
 neighbor 172.16.12.2 remote-as 200
 neighbor 172.16.13.3 remote-as 300
 no auto-summary
!
------------------------------------------------
hostname ISP-B
!
logging buffered 4096000 debugging
!
interface FastEthernet0/0
 ip address 192.168.2.1 255.255.255.0  
interface Serial1/0
 ip address 172.16.23.2 255.255.255.0
interface Serial1/2
 ip address 172.16.12.2 255.255.255.0
router bgp 200
 no synchronization
 bgp log-neighbor-changes
 network 172.16.12.0 mask 255.255.255.0
 network 172.16.23.0 mask 255.255.255.0
 network 192.168.2.0
 neighbor 172.16.12.1 remote-as 100
 neighbor 172.16.23.3 remote-as 300
 no auto-summary
!
------------------------------------------------
hostname ISP-C
!
logging buffered 4096000 debugging
!
interface FastEthernet0/0
 ip address 192.168.3.1 255.255.255.0
   
interface Serial1/0
 ip address 172.16.23.3 255.255.255.0

 

interface Serial1/3
 ip address 172.16.13.3 255.255.255.0

 

router bgp 300
 no synchronization
 bgp log-neighbor-changes
 network 172.16.13.0 mask 255.255.255.0
 network 172.16.23.0 mask 255.255.255.0
 network 192.168.3.0
 neighbor 172.16.13.1 remote-as 100
 neighbor 172.16.23.2 remote-as 200
 no auto-summary
!
------------------------------------------------
查看

 

IPS-A#sh ip route

 

Gateway of last resort is not set

 

     172.16.0.0/24 is subnetted, 3 subnets
B       172.16.23.0 [20/0] via 172.16.12.2, 00:16:39
C       172.16.12.0 is directly connected, Serial1/2
C       172.16.13.0 is directly connected, Serial1/3
C    192.168.1.0/24 is directly connected, FastEthernet0/0
B    192.168.2.0/24 [20/0] via 172.16.12.2, 00:16:39
B    192.168.3.0/24 [20/0] via 172.16.13.3, 00:16:39
IPS-A#sh ip bgp
BGP table version is 7, local router ID is 192.168.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path
*  172.16.12.0/24   172.16.12.2              0             0 200 i
*                   172.16.13.3                            0 300 200 i
*>                  <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />0.0.0.0                  0         32768 i
*  172.16.13.0/24   172.16.12.2                            0 200 300 i
*                   172.16.13.3              0             0 300 i
*>                  0.0.0.0                  0         32768 i
*> 172.16.23.0/24   172.16.12.2              0             0 200 i
*                   172.16.13.3              0             0 300 i
*> 192.168.1.0      0.0.0.0                  0         32768 i
*> 192.168.2.0      172.16.12.2              0             0 200 i
*                   172.16.13.3                            0 300 200 i
*  192.168.3.0      172.16.12.2                            0 200 300 i
*>                  172.16.13.3              0             0 300 i
IPS-A#sh ip bgp summary
BGP router identifier 192.168.1.1, local AS number 100
......

 

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
172.16.12.2     4   200      22      22        7    0    0 00:16:52        5
172.16.13.3     4   300      22      22        7    0    0 00:16:52        5
IPS-A#

 

ISP-B#sh ip route

 

Gateway of last resort is not set

 

     172.16.0.0/24 is subnetted, 3 subnets
C       172.16.23.0 is directly connected, Serial1/0
C       172.16.12.0 is directly connected, Serial1/2
B       172.16.13.0 [20/0] via 172.16.23.3, 00:17:40
B    192.168.1.0/24 [20/0] via 172.16.12.1, 00:17:20
C    192.168.2.0/24 is directly connected, FastEthernet0/0
B    192.168.3.0/24 [20/0] via 172.16.23.3, 00:17:40
ISP-B#sh ip bgp
BGP table version is 7, local router ID is 192.168.2.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path
*  172.16.12.0/24   172.16.12.1              0             0 100 i
*>                  0.0.0.0                  0         32768 i
*  172.16.13.0/24   172.16.12.1              0             0 100 i
*>                  172.16.23.3              0             0 300 i
*  172.16.23.0/24   172.16.23.3              0             0 300 i
*>                  0.0.0.0                  0         32768 i
*  192.168.1.0      172.16.23.3                            0 300 100 i
*>                  172.16.12.1              0             0 100 i
*> 192.168.2.0      0.0.0.0                  0         32768 i
*  192.168.3.0      172.16.12.1                            0 100 300 i
*>                  172.16.23.3              0             0 300 i
ISP-B#sh ip bgp summary
......

 

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
172.16.12.1     4   100      23      23        7    0    0 00:17:28        4
172.16.23.3     4   300      24      24        7    0    0 00:18:37        4
ISP-B#

 

ISP-C#sh ip route

 

Gateway of last resort is not set

 

     172.16.0.0/24 is subnetted, 3 subnets
C       172.16.23.0 is directly connected, Serial1/0
B       172.16.12.0 [20/0] via 172.16.23.2, 00:18:00
C       172.16.13.0 is directly connected, Serial1/3
B    192.168.1.0/24 [20/0] via 172.16.13.1, 00:17:41
B    192.168.2.0/24 [20/0] via 172.16.23.2, 00:18:00
C    192.168.3.0/24 is directly connected, FastEthernet0/0
ISP-C#sh ip bgp
BGP table version is 7, local router ID is 192.168.3.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path
*  172.16.12.0/24   172.16.13.1              0             0 100 i
*>                  172.16.23.2              0             0 200 i
*  172.16.13.0/24   172.16.13.1              0             0 100 i
*>                  0.0.0.0                  0         32768 i
*  172.16.23.0/24   172.16.13.1                            0 100 200 i
*                   172.16.23.2              0             0 200 i
*>                  0.0.0.0                  0         32768 i
*  192.168.1.0      172.16.23.2                            0 200 100 i
*>                  172.16.13.1              0             0 100 i
*  192.168.2.0      172.16.13.1                            0 100 200 i
*>                  172.16.23.2              0             0 200 i
*> 192.168.3.0      0.0.0.0                  0         32768 i
ISP-C#sh ip bgp summary
......

 

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
172.16.13.1     4   100      23      23        7    0    0 00:17:47        5
172.16.23.2     4   200      24      24        7    0    0 00:18:56        4
ISP-C#

 

合并后配置。

 

------------------------------------------------
hostname IPS-A

 

router bgp 100
 no synchronization
 bgp log-neighbor-changes
 network 172.16.12.0 mask 255.255.255.0
 network 172.16.13.0 mask 255.255.255.0
 network 192.168.1.0
 neighbor 172.16.12.2 remote-as 100

 neighbor 172.16.13.3 remote-as 300
 no auto-summary
------------------------------------------------
hostname ISP-B

 

router bgp 100
 no synchronization
 bgp log-neighbor-changes
 network 172.16.12.0 mask 255.255.255.0
 network 172.16.23.0 mask 255.255.255.0
 network 192.168.2.0
 neighbor 172.16.12.1 remote-as 100

 neighbor 172.16.23.3 remote-as 300

 neighbor 172.16.23.3 local-as 200

------------------------------------------------
注意,ISP-C配置没有变化

hostname ISP-C

 

router bgp 300
 no synchronization
 bgp log-neighbor-changes
 network 172.16.13.0 mask 255.255.255.0
 network 172.16.23.0 mask 255.255.255.0
 network 192.168.3.0
 neighbor 172.16.13.1 remote-as 100
 neighbor 172.16.23.2 remote-as 200
 no auto-summary

 

------------------------------------------------
查看路由相关信息:

 

IPS-A#sh ip route

 

Gateway of last resort is not set

 

     172.16.0.0/24 is subnetted, 3 subnets
B       172.16.23.0 [200/0] via 172.16.12.2, 00:02:42
C       172.16.12.0 is directly connected, Serial1/2
C       172.16.13.0 is directly connected, Serial1/3
C    192.168.1.0/24 is directly connected, FastEthernet0/0
B    192.168.2.0/24 [200/0] via 172.16.12.2, 00:02:42
B    192.168.3.0/24 [20/0] via 172.16.13.3, 00:27:39
IPS-A#sh ip bgp
BGP table version is 12, local router ID is 192.168.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path
* i172.16.12.0/24   172.16.12.2              0    100      0 i
*>                  0.0.0.0                  0         32768 i
*  172.16.13.0/24   172.16.13.3              0             0 300 i
*>                  0.0.0.0                  0         32768 i
*>i172.16.23.0/24   172.16.12.2              0    100      0 i
*                   172.16.13.3              0             0 300 i
*> 192.168.1.0      0.0.0.0                  0         32768 i
*>i192.168.2.0      172.16.12.2              0    100      0 i
*> 192.168.3.0      172.16.13.3              0             0 300 i
IPS-A#sh ip bgp summary
......

 

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
172.16.12.2     4   100      11      11       12    0    0 00:04:02        3
172.16.13.3     4   300      35      36       12    0    0 00:28:58        3
IPS-A#

 

ISP-B#sh ip route

 

Gateway of last resort is not set

 

     172.16.0.0/24 is subnetted, 3 subnets
C       172.16.23.0 is directly connected, Serial1/0
C       172.16.12.0 is directly connected, Serial1/2
B       172.16.13.0 [200/0] via 172.16.12.1, 00:06:48
B    192.168.1.0/24 [200/0] via 172.16.12.1, 00:06:48
C    192.168.2.0/24 is directly connected, FastEthernet0/0
B    192.168.3.0/24 [200/0] via 172.16.13.3, 00:06:23
ISP-B#sh ip bgp
BGP table version is 8, local router ID is 192.168.2.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path
* i172.16.12.0/24   172.16.12.1              0    100      0 i
*>                  0.0.0.0                  0         32768 i
*>i172.16.13.0/24   172.16.12.1              0    100      0 i
*                   172.16.23.3              0             0 200 300 i
*> 172.16.23.0/24   0.0.0.0                  0         32768 i
*                   172.16.23.3              0             0 200 300 i
*>i192.168.1.0      172.16.12.1              0    100      0 i
*> 192.168.2.0      0.0.0.0                  0         32768 i
*>i192.168.3.0      172.16.13.3              0    100      0 300 i
*                   172.16.23.3              0             0 200 300 i
ISP-B#sh ip bgp summary
......

 

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
172.16.12.1     4   100      17      17        8    0    0 00:06:57        4
172.16.23.3     4   300      15      15        8    0    0 00:08:44        3

 

 

ISP-C#sh ip route       

 

Gateway of last resort is not set

 

     172.16.0.0/24 is subnetted, 3 subnets
C       172.16.23.0 is directly connected, Serial1/0
B       172.16.12.0 [20/0] via 172.16.13.1, 00:09:45
C       172.16.13.0 is directly connected, Serial1/3
B    192.168.1.0/24 [20/0] via 172.16.13.1, 00:32:17
B    192.168.2.0/24 [20/0] via 172.16.13.1, 00:07:21
C    192.168.3.0/24 is directly connected, FastEthernet0/0
ISP-C#sh ip bgp         
BGP table version is 11, local router ID is 192.168.3.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path
*  172.16.12.0/24   172.16.23.2              0             0 200 100 i
*>                  172.16.13.1              0             0 100 i
*  172.16.13.0/24   172.16.23.2                            0 200 100 i
*                   172.16.13.1              0             0 100 i
*>                  0.0.0.0                  0         32768 i
*  172.16.23.0/24   172.16.23.2              0             0 200 100 i
*                   172.16.13.1                            0 100 i
*>                  0.0.0.0                  0         32768 i
*  192.168.1.0      172.16.23.2                            0 200 100 i
*>                  172.16.13.1              0             0 100 i
*  192.168.2.0      172.16.23.2              0             0 200 100 i
*>                  172.16.13.1                            0 100 i
*> 192.168.3.0      0.0.0.0                  0         32768 i
ISP-C#sh ip bgp summary 
......

 

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
172.16.13.1     4   100      40      39       11    0    0 00:32:26        5
172.16.23.2     4   200      45      45       11    0    0 00:09:16        5

ISP-C#

 

参考:http://www.cisco.com/en/US/tech/tk365/technologies_configuration_example09186a00800949cd.shtml