BGP综合配置

BGP综合配置
4.1 问题
如图配置 IP 和 OSPF
构建BGP邻居关系,R1-R2之间是直连接口建立;
R4-R5、R2-R4 均建立稳定的 BGP 邻居关系
确保Loopback10和Loopback50互通
4.2 方案
使用eNSP搭建实验环境,如图-4所示。

BGP综合配置_第1张图片
图-4

4.3 步骤
实现此案例需要按照如下步骤进行。

1)配置网络设备- R1

>undo terminal monitor 
>system-view 
[Huawei]sysname R1    
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address  192.168.12.1 24
[R1-GigabitEthernet0/0/0]quit
[R1]interface LoopBack  10
[R1-LoopBack10]ip address 10.10.10.10 24
[R1-LoopBack10]quit
[R1]bgp 100
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 192.168.12.2 as-number  234
[R1-bgp]network 10.10.10.0 255.255.255.0
[R1-bgp]quit

2)配置网络设备R2

>undo terminal monitor 
>system-view 
[Huawei]sysname R2    
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address  192.168.23.2 24
[R2-GigabitEthernet0/0/0]quit
[R2]interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]ip address  192.168.12.2 24
[R2-GigabitEthernet0/0/1]quit
[R2]interface LoopBack   0
[R2-LoopBack0]ip address 10.10.2.2 32
[R2-LoopBack0]quit
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area  0 
[R2-ospf-1-area-0.0.0.0]network  10.10.2.2  0.0.0.0
[R2-ospf-1-area-0.0.0.0]network  192.168.23.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]quit
[R2]bgp 234
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 192.168.12.1 as-number  100
[R2-bgp]peer 10.10.4.4 as-number 234
[R2-bgp]peer 10.10.4.4 connect-interface loopback 0
[R2-bgp]peer 10.10.4.4 next-hop-local
[R2-bgp]quit

3)配置网络设备R3

>undo terminal monitor 
>system-view 
[Huawei]sysname R3    
[R3]interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1]ip address  192.168.23.3 24
[R3-GigabitEthernet0/0/1]quit
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ip address  192.168.34.3 24
[R3-GigabitEthernet0/0/0]quit
[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.23.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network  192.168.34.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]quit

4)配置网络设备 R4

>undo terminal monitor 
>system-view 
[Huawei]sysname R4    
[R4]interface GigabitEthernet 0/0/1
[R4-GigabitEthernet0/0/1]ip address  192.168.34.4 24
[R4-GigabitEthernet0/0/1]quit
[R4]interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0]ip address  192.168.44.4 24
[R4-GigabitEthernet0/0/0]quit
[R4]interface GigabitEthernet 0/0/2
[R4-GigabitEthernet0/0/2]ip address  192.168.55.4 24
[R4-GigabitEthernet0/0/2]quit
[R4]interface LoopBack  0
[R4-LoopBack0]ip address 10.10.4.4 32
[R4-LoopBack0]quit
[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.34.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network  10.10.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]quit
[R4]ip route-static 10.10.5.5 32 192.168.44.5
[R4]ip route-static 10.10.5.5 32 192.168.55.5
[R4]bgp 234
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 10.10.2.2 as-number 234
[R4-bgp]peer 10.10.2.2 connect-interface loopback 0
[R4-bgp]peer 10.10.2.2 next-hop-local
[R4-bgp]peer 10.10.5.5 as-number  500
[R4-bgp]peer 10.10.5.5 connect-interface loopback 0
[R4-bgp]peer 10.10.5.5 ebgp-max-hop 2
[R4-bgp]quit

5)配置网络设备 R5

>undo terminal monitor 
>system-view 
[Huawei]sysname R5    
[R5]interface GigabitEthernet 0/0/0
[R5-GigabitEthernet0/0/0]ip address  192.168.44.5 24
[R5-GigabitEthernet0/0/0]quit
[R5]interface GigabitEthernet 0/0/2
[R5-GigabitEthernet0/0/2]ip address  192.168.55.5 24
[R5-GigabitEthernet0/0/2]quit
[R5]interface LoopBack  0
[R5-LoopBack0]ip address 10.10.5.5 32
[R5-LoopBack0]quit
[R5]interface LoopBack  50
[R5-LoopBack50]ip address 10.10.50.50 24
[R5-LoopBack50]quit
[R5]ip route-static 10.10.4.4 32 192.168.44.4
[R5]ip route-static 10.10.4.4 32 192.168.55.4
[R5]bgp 500
[R5-bgp]router-id 5.5.5.5
[R5-bgp]peer 10.10.4.4 as-number  234
[R5-bgp]peer 10.10.4.4 connect-interface loopback 0
[R5-bgp]peer 10.10.4.4 ebgp-max-hop 
[R5-bgp]import-route direct
[R5-bgp]quit

6)在 R2 上将BGP引入到 OSPF

[R2]ospf 1 
[R2-ospf-1]import-route bgp

7)在 R4 上将BGP引入到 OSPF

[

R4]ospf 1
[R4-ospf-1]import-route bgp

8)测试 R1 与 R5 之间的连通性

>ping -a 10.10.10.10  10.10.50.50
  PING 10.10.50.50: 56  data bytes, press CTRL_C to break
    Reply from 10.10.50.50: bytes=56 Sequence=1 ttl=255 time=30 ms
    Reply from 10.10.50.50: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 10.10.50.50: bytes=56 Sequence=3 ttl=255 time=10 ms
    Reply from 10.10.50.50: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 10.10.50.50: bytes=56 Sequence=5 ttl=255 time=10 ms
  --- 10.10.50.50 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 10/20/30 ms

你可能感兴趣的:(操作实例,理论,华为路由器)