BGP实验(3)

实验拓扑图

实验配置

r1

<Huawei>sys
[Huawei]sys r1
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[r1-GigabitEthernet0/0/1]q
[r1]int LoopBack 0
[r1-LoopBack0]ip add 1.1.1.1 24


[r1]bgp 100
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 192.168.1.2 as    
[r1-bgp]peer 192.168.1.2 as-number 200

<r1>display bgp routing-table 

 BGP Local router ID is 1.1.1.1 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 22
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   1.1.1.0/24         0.0.0.0         0                     0      ?
 *>   1.1.1.1/32         0.0.0.0         0                     0      ?
 *>   2.2.2.0/24         192.168.1.2     0                     0      200?
 *>   3.3.3.3/32         192.168.1.2     1                     0      200?
 *>   4.4.4.4/32         192.168.1.2     2                     0      200?
 *>   5.5.5.5/32         192.168.1.2     1                     0      200?
 *>   6.6.6.6/32         192.168.1.2     2                     0      200?
 *>   7.7.7.0/24         192.168.1.2                           0      200?
 *>   7.7.7.7/32         192.168.1.2     3                     0      200?
 *>   8.8.8.0/24         192.168.1.2                           0      200 300?
 *>   127.0.0.0          0.0.0.0         0                     0      ?
 *>   127.0.0.1/32       0.0.0.0         0                     0      ?
 *>   192.168.1.0        0.0.0.0         0                     0      ?
                         192.168.1.2     0                     0      200?
 *>   192.168.1.1/32     0.0.0.0         0                     0      ?
 *>   192.168.2.0        192.168.1.2     0                     0      200?
 *>   192.168.3.0        192.168.1.2     2                     0      200?
 *>   192.168.4.0        192.168.1.2     0                     0      200?
 *>   192.168.5.0        192.168.1.2     2                     0      200?
 *>   192.168.6.0        192.168.1.2     3                     0      200?
 *>   192.168.7.0        192.168.1.2     3                     0      200?
 *>   192.168.8.0        192.168.1.2                           0      200?
<r1>ping 8.8.8.8
  PING 8.8.8.8: 56  data bytes, press CTRL_C to break
    Reply from 8.8.8.8: bytes=56 Sequence=1 ttl=251 time=60 ms
    Reply from 8.8.8.8: bytes=56 Sequence=2 ttl=251 time=60 ms
    Reply from 8.8.8.8: bytes=56 Sequence=3 ttl=251 time=50 ms
    Reply from 8.8.8.8: bytes=56 Sequence=4 ttl=251 time=50 ms
    Reply from 8.8.8.8: bytes=56 Sequence=5 ttl=251 time=60 ms

  --- 8.8.8.8 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 50/56/60 ms

r2

<Huawei>sys
[Huawei]sys r2
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 24
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 192.168.2.1 24
[r2-GigabitEthernet0/0/1]int g0/0/2
[r2-GigabitEthernet0/0/2]ip add 192.168.4.1 24
[r2-GigabitEthernet0/0/2]q
[r2]int LoopBack 0
[r2-LoopBack0]ip add 2.2.2.2 24
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 2.2.2.0 0.0.0.255

[r2]bgp 64512
[r2-bgp]router-id 2.2.2.2
[r2-bgp]confederation id 200
[r2-bgp]peer 3.3.3.3 as-number 64512
[r2-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[r2-bgp]confederation peer-as 64513  
[r2-bgp]peer 5.5.5.5 as-number 64513
[r2-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[r2-bgp]peer 5.5.5.5 ebgp-max-hop
[r2-bgp]peer 192.168.1.1 as-number 100
[r2-bgp]peer 3.3.3.3 next-hop-local
[r2-bgp]import-route ospf 1
[r2-bgp]import-route direct 

r3

<Huawei>sys
[Huawei]sys r3
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.2.2 24
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.3.1 24
[r3-GigabitEthernet0/0/1]q
[r3]int LoopBack 0
[r3-LoopBack0]ip add 3.3.3.3 24

[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 3.3.3.0 0.0.0.255

[r3]bgp 64512
[r3-bgp]router-id 3.3.3.3
[r3-bgp]confederation id 200    
[r3-bgp]peer 2.2.2.2 as-number 64512
[r3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r3-bgp]peer 4.4.4.4 as-number 64512 
[r3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[r3-bgp]peer 2.2.2.2 reflect-client
[r3-bgp]peer 4.4.4.4 reflect-client

r4

<Huawei>sys
[Huawei]sys r4
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.3.2 24
[r4-GigabitEthernet0/0/1]q 
[r4]int LoopBack 0
[r4-LoopBack0]ip add 4.4.4.4 24

[r4]ospf 1 r    
[r4]ospf 1 router-id 4.4.4.4 
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 4.4.4.0 0.0.0.255

[r4]bgp 64512
[r4-bgp]router-id 4.4.4.4  
[r4-bgp]confederation id 200
[r4-bgp]peer 3.3.3.3 as    
[r4-bgp]peer 3.3.3.3 as-number 64512
[r4-bgp]confederation peer-as 64513
[r4-bgp]peer 7.7.7.7 as-number 64513
[r4-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[r4-bgp]peer 7.7.7.7 ebgp-max-hop
[r4-bgp]peer 2.2.2.2 ebgp-max-hop
[r4-bgp]peer 3.3.3.3 next-hop-local

r5

<Huawei>sys
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.4.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 192.168.5.1 24
[Huawei]int LoopBack 0
[Huawei-LoopBack0]ip add 5.5.5.5 24

[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]network 5.5.5.0 0.0.0.255

[r5]bgp 64513
[r5-bgp]router-id 5.5.5.5
[r5-bgp]confederation id 200
[r5-bgp]confederation peer-as 64512
[r5-bgp]peer 2.2.2.2 as-number 64512
[r5-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r5-bgp]peer 6.6.6.6 as-number 64513
[r5-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[r5-bgp]peer 2.2.2.2 ebgp-max-hop
[r5-bgp]peer 6.6.6.6 next-hop-local

r6

<Huawei>sys
[Huawei]sys r6
[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip add 192.168.5.2 24
[r6-GigabitEthernet0/0/0]int g0/0/1
[r6-GigabitEthernet0/0/1]ip add 192.168.6.1 24
[r6-GigabitEthernet0/0/1]q
[r6]int LoopBack 0
[r6-LoopBack0]ip add 6.6.6.6 24


[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
[r6-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
[r6-ospf-1-area-0.0.0.0]network 6.6.6.0 0.0.0.255

[r6]bgp 64513
[r6-bgp]router-id 6.6.6.6
[r6-bgp]confederation id 200
[r6-bgp]peer 5.5.5.5 as-number 64513
[r6-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[r6-bgp]peer 7.7.7.7 as-number 64513
[r6-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[r6-bgp]peer 5.5.5.5 reflect-client
[r6-bgp]peer 7.7.7.7 reflect-client

r7

<Huawei>sys
[Huawei]sys r7
[r7]int g0/0/0
[r7-GigabitEthernet0/0/0]ip add 192.168.6.2 24
[r7-GigabitEthernet0/0/0]int g0/0/1
[r7-GigabitEthernet0/0/1]ip add 192.168.7.2 24
[r7-GigabitEthernet0/0/1]int g0/0/2
[r7-GigabitEthernet0/0/2]ip add 192.168.8.1 24
[r7-GigabitEthernet0/0/2]q

[r7]int LoopBack 0
[r7-LoopBack0]ip add 7.7.7.7 24

[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0
[r7-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[r7-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255

[r7-ospf-1-area-0.0.0.0]network 7.7.7.0 0.0.0.255

[r7]bgp 64513   
[r7-bgp]router-id 7.7.7.7
[r7-bgp]confederation id 200  
[r7-bgp]peer 6.6.6.6 as-number 64513
[r7-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[r7-bgp]confederation peer-as 64512
[r7-bgp]peer 4.4.4.4 as-number 64512
[r7-bgp]peer 4.4.4.4 connect-interface LoopBack 0 
[r7-bgp]peer 192.168.8.2 as-number 300
[r7-bgp]peer 4.4.4.4 ebgp-max-hop
[r7-bgp]peer 6.6.6.6 next-hop-local
[r7-bgp]import-route ospf 1
[r7-bgp]import-route direct 

r8

[Huawei]sys r8
[r8]int g0/0/0
[r8-GigabitEthernet0/0/0]ip add 192.168.8.2 24
[r8]int LoopBack 0
[r8-LoopBack0]ip add 8.8.8.8 24
[r8]bgp 300
[r8-bgp]router-id 8.8.8.8
[r8-bgp]peer 192.168.8.1 as-number 200
[r8-bgp]router-id 8.8.8.8
[r8-bgp]peer 192.168.8.1 as    
[r8-bgp]peer 192.168.8.1 as-number 200
[r8-bgp]import-route direct 

实验结果:全网可达

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值