华为的BGP路由技术(1)

BGP的基本配置、控制BGP选路

华为的BGP路由技术(1)_第1张图片
 要求实现两个AS之间的互相通信
 配置所有设备IP地址及AS200内部的ospf协议
 在R2、R3和R4上配置ospfd协议,使R2、R3和R4之间可以互访
 在R1和R2、R1和R3上配置EBGP邻居关系,使R1、R2和R3之间可以互通过EBGP相互传递路由。
 在R2、R3和R4配置IBGP邻居关系,使R2、R3和R4之间可以通过IBGP互相传递路由
 通过修改BGP属性实现业务需求的路径冲R2切换到R3
一、路由器配置IP地址

[R1]interface GigabitEthernet0/0/0	
[R1-GigabitEthernet0/0/0]ip address 10.0.12.1 24
[R1]interface GigabitEthernet0/0/1
[R1-GigabitEthernet0/0/1]ip address 10.0.13.1 24
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 1.1.1.1 32

[R2]interface GigabitEthernet0/0/0	
[R2-GigabitEthernet0/0/0]ip address 10.0.12.2 24
[R2]interface GigabitEthernet0/0/1
[R2-GigabitEthernet0/0/1]ip address 10.0.24.2 24
[R2]interface LoopBack 0
[R2-LoopBack0]ip address 2.2.2.2 32

[R3]interface GigabitEthernet0/0/1	
[R3-GigabitEthernet0/0/1]ip address 10.0.13.3 24
[R3]interface GigabitEthernet0/0/0
[R3-GigabitEthernet0/0/0]ip address 10.0.34.3 24
[R3]interface LoopBack 0
[R3-LoopBack0]ip address 3.3.3.3 32

[R4]interface GigabitEthernet0/0/1	
[R4-GigabitEthernet0/0/1]ip address 10.0.24.4 24
[R4]interface GigabitEthernet0/0/0	
[R4-GigabitEthernet0/0/0]ip address 10.0.34.4 24
[R4]interface LoopBack 0
[R4-LoopBack0]ip address 4.4.4.4 32

二、在R2、R3和R4上配置ospfd协议

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]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]ospf 1 router-id 3.3.3.3	
[R3-ospf-1]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]ospf 1 router-id 4.4.4.4
[R4-ospf-1]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

三、在R1和R2、R1和R3上配置EBGP邻居关系,R2、R3和R4配置IBGP邻居关系。

[R1]bgp 100	
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 10.0.12.2 as-number 200
[R1-bgp]peer 10.0.13.3 as-number 200
[R1-bgp]network 1.1.1.1 32

[R2]bgp 200
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 10.0.12.1 as-number 100
[R2-bgp]peer 10.0.24.4 as-number 200
[R2-bgp]peer 10.0.24.4 next-hop-local

[R3]bgp 200
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 10.0.13.1 as-number 100
[R3-bgp]peer 10.0.34.4 as-number 200
[R3-bgp]peer 10.0.34.4 next-hop-local

[R4]bgp 200
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 10.0.24.2 as-number 200
[R4-bgp]peer 10.0.34.3 as-number 200
[R4-bgp]network 4.4.4.4 32

四、查看BGP路由
华为的BGP路由技术(1)_第2张图片
华为的BGP路由技术(1)_第3张图片
五、使用本地优先级控制路由,使R4去往R1从R2改走R3

[R3]route-policy lop  permit node 10
[R3-route-policy]apply local-preference 222
[R3-route-policy]quit 	
[R3]bgp 20
[R3-bgp]peer 10.0.34.4 route-policy lop export
[R3-bgp]quit
[R3]quit
reset bgp all

华为的BGP路由技术(1)_第4张图片
五、验证
华为的BGP路由技术(1)_第5张图片

你可能感兴趣的:(BGP路由技术)