Huawei Device BGP configuration details

BGP theory about this blog is not to say, directly on the map to start the configuration. About theory can refer to the blog post, what BGP routing technology Huawei equipment is?

Topology is as follows:
Huawei Device BGP configuration details

Requirements are as follows:
For AS100 network (R1: 1.1.1.1) and AS200 (R4: 4.4.4.4) reachable network. You need to run across all the BGP router, R1, and between R2, R3 EBGP connection, establishing a connection between full-IBGP R2, R3 and R4. In AS200, is calculated using the IGP routing protocol (OSPF is used in this example as the IGP).

Start the configuration:

1, the configuration of the IP address of the router according to the topology of FIG.

R1

[R1]int LoopBack 0               #进入loop back 0接口
[R1-LoopBack0]ip add 1.1.1.1 32    #接口配置IP地址
[R1-LoopBack0]quit        #保存并退出
[R1]int g0/0/0              #进入接口
[R1-GigabitEthernet0/0/0]ip add 10.0.12.1 24    #接口配置IP地址
[R1-GigabitEthernet0/0/0]quit       #保存并退出
[R1]int g0/0/1         #进入接口
[R1-GigabitEthernet0/0/1]ip add 10.0.13.1 24    #接口配置IP地址
[R1-GigabitEthernet0/0/1]quit        #保存并退出
[R1]display ip int b       #查看接口状态信息(通常配完一个设备先查看一下配置是否有误,以免后面出错排查不好排查)

Huawei Device BGP configuration details

R2

[R2]int loopback 0        #进入loop back 0接口
[R2-LoopBack0]ip add 2.2.2.2 32      #接口配置IP地址
[R2-LoopBack0]quit      #保存并退出
[R2]int g0/0/0              #进入接口
[R2-GigabitEthernet0/0/0]ip add 10.0.12.2 24      #接口配置IP地址
[R2-GigabitEthernet0/0/0]quit       #保存退出
[R2]int g0/0/1           #进入接口
[R2-GigabitEthernet0/0/1]ip add 10.0.24.1 24     #接口配置IP地址
[R2-GigabitEthernet0/0/1]quit      #保存退出
[R2]display ip int b       #查看接口状态信息

Huawei Device BGP configuration details

R3

[R3]int LoopBack 0        #进入loop back 0接口
[R3-LoopBack0]ip add 3.3.3.3 32     #接口配置IP地址
[R3-LoopBack0]quit      #保存退出
[R3]int g0/0/1        #进入接口
[R3-GigabitEthernet0/0/1]ip add 10.0.34.2 24    #接口配置IP地址
[R3-GigabitEthernet0/0/1]quit     #保存退出
[R3]int g0/0/0        #进入接口
[R3-GigabitEthernet0/0/0]ip add 10.0.13.2 24    #接口配置IP地址
[R3-GigabitEthernet0/0/0]quit     #保存退出
[R3]display ip int b       #查看接口状态信息

Huawei Device BGP configuration details

R4

[R4]int LoopBack 0         #进入loop back 0接口
[R4-LoopBack0]ip add 4.4.4.4 32    #接口配置IP地址
[R4-LoopBack0]quit    #保存退出
[R4]int g0/0/0           #进入接口
[R4-GigabitEthernet0/0/0]ip add 10.0.24.2 24     #接口配置IP地址
[R4-GigabitEthernet0/0/0]quit        #保存退出
[R4]int g0/0/1          #进入接口
[R4-GigabitEthernet0/0/1]ip add 10.0.34.1 24     #接口配置IP地址
[R4-GigabitEthernet0/0/1]quit        #保存退出
[R4]display ip int b       #查看接口状态信息

Huawei Device BGP configuration details

2, OSPF area

R2

[R2]ospf 1       #进入OSPF1进程
[R2-ospf-1]area 0     #进入area 0 (骨干区域)
[R2-ospf-1-area-0.0.0.0]network 10.0.24.0 0.0.0.255   #宣告直连网络
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0          #宣告虚拟接口网络

R3

[R3]ospf 1         #进入OSPF1进程
[R3-ospf-1]area 0      #进入area 0(骨干区域)
[R3-ospf-1-area-0.0.0.0]network 10.0.34.0 0.0.0.255    #宣告直连网络
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0         #宣告虚拟接口网络

R4

[R4]ospf 1        #进入OSPF1进程
[R4-ospf-1]area 0      #进入area 0 (骨干区域)
[R4-ospf-1-area-0.0.0.0]network 10.0.24.0 0.0.0.255   #宣告直连网络
[R4-ospf-1-area-0.0.0.0]network 10.0.34.0 0.0.0.255   #宣告直连网络
[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0       #宣告虚拟接口网络

3. Configure BGP

R1

[R1]bgp 100   创建bgp编号为100 (也就是AS100)
[R1-bgp]router-id 1.1.1.1       #指定router-id
[R1-bgp]peer 10.0.12.2 as-number 200    #和邻居网络建立邻接关系
[R1-bgp]peer 10.0.13.2 as-number 200     #和邻居网络建立邻接关系
[R1-bgp]network 1.1.1.1 32      #宣告虚拟接口网络
[R1-bgp]quit      #保存退出

R2

[R2]bgp 200       #创建bgp编号200 (AS200)
[R2-bgp]router-id 2.2.2.2    #指定router-id
[R2-bgp]peer 10.0.24.2 as-number 200     #和邻居网络建立邻接关系
[R2-bgp]peer 10.0.12.1 as-number 100     #和邻居网络建立邻接关系
[R2-bgp]peer 10.0.24.2 next-hop-local #要将BGP路由发送给10.0.24.2这个邻居时,
将路由的下一跳设置成自己的地址,这个地址是与10.0.24.2建立邻居所使用的源地址
[R2-bgp]quit         #保存退出

R3

[R3]bgp 200     #创建bgp编号200 (AS200)
[R3-bgp]router-id 3.3.3.3     #指定router-id
[R3-bgp]peer 10.0.34.1 as-number 200    #和邻居网络建立邻接关系
[R3-bgp]peer 10.0.13.1 as-number 100    #和邻居网络建立邻接关系
[R3-bgp]peer 10.0.34.1 next-hop-local #要将BGP路由发送给10.0.34.1这个邻居时,
将路由的下一跳设置成自己的地址,这个地址是与10.0.34.1建立邻居所使用的源地址
[R3-bgp]quit      #保存退出

R4

[R4]bgp 200      #创建bgp编号200 (AS200)
[R4-bgp]router-id 4.4.4.4   指定router-id
[R4-bgp]peer 10.0.24.1 as-number 200    #和邻居网络建立邻接关系
[R4-bgp]peer 10.0.34.2 as-number 200    #和邻居网络建立邻接关系
[R4-bgp]network 4.4.4.4 32     #宣告虚拟接口网络
[R4-bgp]quit     #保存退出

4, routing configuration, according to the needs, the route R4 from the reformer go away R1 R2 R3 from

1) according to the local routing priority control

[R3]route-policy lop permit node 10     #创建名为lop的路由策略
Info: New Sequence of this List.
[R3-route-policy]apply local-preference 222    #设置本地优先级为222
[R3-route-policy]quit    #保存退出
[R3]bgp 200    #进入bgp 200
[R3-bgp]peer 10.0.34.1 route-policy lop export     #应用策略 
[R3-bgp]quit   #保存退出
[R3]quit       #退出到用户视图
<R3>reset bgp all    #刷新路由属性

2) controlled by the MED routing
if R4 is desired to change the route R1 destined to go R3, R1 may be used to control the MED of the route selection, so go R1 R2 R4 change away from R3. By default, the R1 R2 R4's go to 4.4.4.4. By modifying the properties on the MED and outgoing R2 to R1, R1 can be made to change the route destined to go R4 R3.

[R2]route-policy med permit node 10     #创建名为med的路由策略
Info: New Sequence of this List.
[R2-route-policy]apply cost + 500     #设置路由开销为500
[R2-route-policy]quit      #保存退出
[R2]bgp 200     #进入bgp200
[R2-bgp]peer 10.0.12.1 route-policy med export  #应用策略
[R2-bgp]quit     #保存退出

6, see the R1 BGP attribute modification results
Huawei Device BGP configuration details

7. Experimental results
Huawei Device BGP configuration details
Huawei Device BGP configuration details
Huawei Device BGP configuration details

8, BGP peer configuration

R1

[R1]bgp 100        #进入bgp100
[R1-bgp]peer 4.4.4.4 as-number 200     #4.4.4.4要可达,即有路由条目
[R1-bgp]peer 4.4.4.4 ebgp-max-hop 2    #R1到达4.4.4.4建立邻居关系需要经过2个路由

R4

[R4]bgp 200        #进入bgp200
[R4-bgp]peer 1.1.1.1 as-number 100    #1.1.1.1要可达,即有路由条目
[R4-bgp]peer 1.1.1.1 ebgp-max-hop 2   #R4到达1.1.1.1建立邻居关系需要经过2个路由

Briefly about some of the problems I encountered it, when we would be less configuration problems, BGP configuration, be sure to look carefully neighbor relationship of each device is correct, whether declared virtual interface, the neighbor relationship can not be set up if BGP also achieve any effect.

Bowen see next, thanks for reading, any questions please leave a message.

Guess you like

Origin blog.51cto.com/14156658/2429025