华为配置BGP的基本示例

2023-12-21 20:11:05
组网需求

如图1所示,需要在所有Switch间运行BGP协议,SwitchA、SwitchB之间建立EBGP连接,SwitchB、SwitchC和SwitchD之间建立IBGP全连接。

说明

请确保该场景下互联接口的STP处于未使能状态。因为在使能STP的环形网络中,如果用交换机的VLANIF接口构建三层网络,会导致某个端口被阻塞,从而导致三层业务不能正常运行

配置BGP基本组网图

?配置思路

采用如下的思路配置BGP的基本功能:

  1. 在SwitchB、SwitchC和SwitchD间配置IBGP连接。
  2. 在SwitchA和SwitchB之间配置EBGP连接

操作步骤

配置各接口所属的VLAN

# 配置SwitchA。SwitchB、SwitchC和SwitchD的配置与SwitchA类似

[zhongwanzhi]interface GigabitEthernet 0/0/1
[zhongwanzhi-GigabitEthernet0/0/1]port link-type trunk 
[zhongwanzhi-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
[zhongwanzhi-GigabitEthernet0/0/1]quit

配置各VLANIF接口的IP地址

# 配置SwitchA。SwitchB、SwitchC和SwitchD的配置与SwitchA类似

[zhongwanzhi]interface Vlanif 10
[zhongwanzhi-Vlanif10]ip add	
[zhongwanzhi-Vlanif10]ip address 192.168.1.2 24
[zhongwanzhi-Vlanif10]quit

配置IBGP连接

# 配置SwitchB

[zhongwanzhib]bgp 65009
[zhongwanzhib-bgp]router-id 172.17.2.2
[zhongwanzhib-bgp]peer 172.16.1.2 as-number 65009
[zhongwanzhib-bgp]peer 172.16.3.1 as-number 65009
[zhongwanzhib-bgp]quit
[zhongwanzhib]

# 配置SwitchC

[zhongwanzhic]bgp 65009
[zhongwanzhic-bgp]router-id 172.17.3.3
[zhongwanzhic-bgp]peer 172.16.3.2 as-number 65009
[zhongwanzhic-bgp]peer 172.16.2.2 as-number 65009
[zhongwanzhic-bgp]
[zhongwanzhic-bgp]quit
[zhongwanzhic]

# 配置SwitchD。

[zhongwanzhid]bgp 65009
[zhongwanzhid-bgp]router-id 172.17.4.4
[zhongwanzhid-bgp]peer 172.16.1.1 as-number 65009
[zhongwanzhid-bgp]peer 172.16.2.1 as-number 65009
[zhongwanzhid-bgp]quit
[zhongwanzhid]

配置EBGP

# 配置SwitchA。

[zhongwanzhi]bgp 65008
[zhongwanzhi-bgp]router-id 172.17.1.1
[zhongwanzhi-bgp]peer 192.168.1.1 as-number 65009
[zhongwanzhi-bgp]quit
[zhongwanzhi]

# 配置SwitchB

[zhongwanzhib]bgp 65009
[zhongwanzhib-bgp]peer 192.168.1.2 as-number 65008
[zhongwanzhib-bgp]quit
[zhongwanzhib]

# 查看BGP对等体的连接状态

[zhongwanzhib]display bgp peer

 BGP local router ID : 172.17.2.2
 Local AS number : 65009
 Total number of peers : 3		  Peers in established state : 2

  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv

  172.16.1.2      4       65009       19       21     0 00:17:39 Established    
   0
  172.16.3.1      4       65009        0        0     0 00:12:54 Established         
   0
  192.168.1.2     4       65008       18       16     0 00:14:59 Established    
   2
[zhongwanzhib]

可以看出,SwitchB其它Switch的BGP连接均已建立

文章来源:https://blog.csdn.net/ZXDNM_zwz/article/details/135129612
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。