BGP之IBGP水平分割之路由反射
6.1 问题 如图配置IP地址和OSPF AS 234 使用联盟和路由反射,解决路由传递问题 AS 100 和 AS 234 配置 EBGP 邻居 AS 500 和 AS 234 配置稳定 EBGP 邻居 确保 Loopback10和Loopback50互通
配置思路: 1.数据传到R1-R2-R3再往下传的时候需要把R3做成路由反射器。 -需要配置客户机可以是R2或者是R6或者同时都做成客户机,但是不能都不是客户机。. 2.R4不用管如果是出现相应的需要分割情况也按照这个方式进行配置就可以的 3.IP 地址OSPF,R2 R3 R6 R4之间BGP邻居关系设置 4.R1 直连EBGP设置, R5稳定import模式引入设置 4.非直联的使用LOOPBACK接口稳定连接的时候必须使用 [R4-bgp]peer 10.10.6.6 ebgp-max-hop 直连检测机制需要用的命令
4.[R3-bgp]peer 10.10.6.6 reflect-client //设置R3到R6的路由反射器
R1路由设置
[R1-GigabitEthernet0/0/0]ip add 192.168.12.1 24 [R1-GigabitEthernet0/0/0]q [R1]int LoopBack 10 [R1-LoopBack10]ip add 10.10.10.10 24 [R1-LoopBack10]q [R1]bgp 100 [R1-bgp]router-id 1.1.1.1 [R1-bgp]peer 192.168.12.2 as-number 234 Warning: Local interface is already configured with this address. [R1-bgp]dis this [V200R003C00]
bgp 100 router-id 1.1.1.1 peer 192.168.12.2 as-number 234
ipv4-family unicast undo synchronization peer 192.168.12.1 enable
return [R1-bgp]network 10.10.10.0 255.255.255.0 [R1-bgp]dis this [V200R003C00]
bgp 100 router-id 1.1.1.1 peer 192.168.12.1 as-number 234
ipv4-family unicast undo synchronization network 10.10.10.0 255.255.255.0 peer 192.168.12.2 enable
R2:R1,R3邻居设置 [R2]bgp 64523 [R2-bgp]dis this [V200R003C00]
bgp 64523 router-id 2.2.2.2 confederation id 234 confederation peer-as 64544 peer 10.10.3.3 as-number 64523 peer 10.10.3.3 connect-interface LoopBack0 peer 192.168.12.1 as-number 100
ipv4-family unicast undo synchronization peer 10.10.3.3 enable peer 10.10.3.3 next-hop-local peer 192.168.12.1 enable
return
R3:R2,R6邻居设置 [R3-bgp]peer 10.10.6.6 as-number 64523 [R3-bgp]peer 10.10.6.6 connect-interface LoopBack 0 [R3]bgp 64523 [R3]dis bgp routing-table peer 10.10.6.6 advertised-routes [R3]bgp 64523
[R3-bgp]peer 10.10.6.6 reflect-client /设置R3到R6的路由反射器 [R3-bgp]dis bgp routing-table peer 10.10.6.6 advertised-routes [R3]bgp 64523 [R3-bgp]dis this [V200R003C00]
bgp 64523 router-id 3.3.3.3 confederation id 234 confederation peer-as 64544 peer 10.10.2.2 as-number 64523 peer 10.10.2.2 connect-interface LoopBack0 peer 10.10.6.6 as-number 64523 peer 10.10.6.6 connect-interface LoopBack0
ipv4-family unicast undo synchronization peer 10.10.2.2 enable peer 10.10.6.6 enable peer 10.10.6.6 reflect-client
return
R6:R3,R4邻居设置
[R6]int g0/0/0 [R6-GigabitEthernet0/0/0]ip add 192.168.64.6 24 [R6-GigabitEthernet0/0/0]int g0/0/1 [R6-GigabitEthernet0/0/1]ip add 192.168.36.6 24 [R6-GigabitEthernet0/0/1]q [R6]int LoopBack 0 [R6-LoopBack0]ip add 10.10.6.6 32 [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.36.0 0.0.0.255 [R6-ospf-1-area-0.0.0.0]network 192.168.64.0 0.0.0.255 [R6-ospf-1-area-0.0.0.0]network 10.10.6.6 0.0.0.0 [R6-ospf-1-area-0.0.0.0]q [R6]bgp 64523 [R6-bgp]confederation id 234
[R6-bgp]confederation peer-as 64544
[R6-bgp]router-id 6.6.6.6
[R6-bgp]peer 10.10.3.3 as-number 64523
[R6-bgp]peer 10.10.3.3 connect-interface LoopBack 0
[R6-bgp]peer 10.10.4.4 as-number 64544
[R6-bgp]peer 10.10.4.4 connect-interface LoopBack 0
[R6-bgp]peer 10.10.4.4 ebgp-max-hop <R6>dis bgp peer
[R6]bgp 64523 [R6-bgp]dis this [V200R003C00]
bgp 64523 router-id 6.6.6.6 confederation id 234 confederation peer-as 64544 peer 10.10.3.3 as-number 64523 peer 10.10.3.3 connect-interface LoopBack0 peer 10.10.4.4 as-number 64544 peer 10.10.4.4 ebgp-max-hop 255 peer 10.10.4.4 connect-interface LoopBack0
ipv4-family unicast undo synchronization peer 10.10.3.3 enable peer 10.10.4.4 enable
return
R4:R6,R5邻居设置
[R4]bgp 64544 [R4-bgp]dis this [V200R003C00]
bgp 64544 router-id 4.4.4.4 confederation id 234 confederation peer-as 64523 peer 10.10.5.5 as-number 500 peer 10.10.5.5 ebgp-max-hop 255 peer 10.10.5.5 connect-interface LoopBack0 peer 10.10.6.6 as-number 64523 peer 10.10.6.6 ebgp-max-hop 255 peer 10.10.6.6 connect-interface LoopBack0
ipv4-family unicast undo synchronization peer 10.10.5.5 enable peer 10.10.6.6 enable peer 10.10.6.6 next-hop-local
return
R5的BGP设置
[R5]bgp 500 [R5-bgp]dis this [V200R003C00]
bgp 500 router-id 5.5.5.5 peer 10.10.4.4 as-number 234 peer 10.10.4.4 ebgp-max-hop 255 peer 10.10.4.4 connect-interface LoopBack0
ipv4-family unicast undo synchronization import-route direct peer 10.10.4.4 enable
return
6 案例6:BGP路由反射器配置 6.1 问题 如图配置IP地址和OSPF AS 234 使用联盟和路由反射,解决路由传递问题 AS 100 和 AS 234 配置 EBGP 邻居 AS 500 和 AS 234 配置稳定 EBGP 邻居 确保 Loopback10和Loopback50互通 6.2 方案 使用eNSP搭建实验环境,如图-6所示。
图-6
6.3 步骤 实现此案例需要按照如下步骤进行。
1)配置网络设备- R1
<Huawei>undo terminal monitor
<Huawei>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
<Huawei>undo terminal monitor
<Huawei>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 64523
[R2-bgp]router-id 2.2.2.2
[R2-bgp]confederation id 234
[R2-bgp]confederation peer-as 64544
[R2-bgp]peer 192.168.12.1 as-number 100
[R2-bgp]peer 10.10.3.3 as-number 64523
[R2-bgp]peer 10.10.3.3 connect-interface loopback 0
[R2-bgp]peer 10.10.3.3 next-hop-local
3)配置网络设备R3
<Huawei>undo terminal monitor
<Huawei>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.36.3 24
[R3-GigabitEthernet0/0/0]quit
[R3]interface LoopBack 0
[R3-LoopBack0]ip address 10.10.3.3 32
[R3-LoopBack0]quit
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 10.10.3.3 0.0.0.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.36.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]quit
[R3]bgp 64523
[R3-bgp]router-id 3.3.3.3
[R3-bgp]confederation id 234
[R3-bgp]confederation peer-as 64544
[R3-bgp]peer 10.10.2.2 as-number 64523
[R3-bgp]peer 10.10.2.2 connect-interface loopback 0
[R3-bgp]peer 10.10.6.6 as-number 64523
[R3-bgp]peer 10.10.6.6 connect-interface loopback 0
[R3-bgp]peer 10.10.6.6 reflect-client
4)配置网络设备 R6
<Huawei>undo terminal monitor
<Huawei>system-view
[Huawei]sysname R6
[R6]interface GigabitEthernet 0/0/1
[R6-GigabitEthernet0/0/1]ip address 192.168.36.6 24
[R6-GigabitEthernet0/0/1]quit
[R6]interface GigabitEthernet 0/0/0
[R6-GigabitEthernet0/0/0]ip address 192.168.46.6 24
[R6-GigabitEthernet0/0/0]quit
[R6]interface LoopBack 0
[R6-LoopBack0]ip address 10.10.6.6 32
[R6-LoopBack0]quit
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 10.10.6.6 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 192.168.36.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]network 192.168.46.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]quit
[R6]bgp 64523
[R6-bgp]router-id 6.6.6.6
[R6-bgp]confederation id 234
[R6-bgp]confederation peer-as 64544
[R6-bgp]peer 10.10.3.3 as-number 64523
[R6-bgp]peer 10.10.3.3 connect-interface loopback 0
[R6-bgp]peer 10.10.4.4 as-number 64544
[R6-bgp]peer 10.10.4.4 connect-interface loopback 0
[R6-bgp]peer 10.10.4.4 ebgp-max-hop
5)配置网络设备 R4
<Huawei>undo terminal monitor
<Huawei>system-view
[Huawei]sysname R4
[R4]interface GigabitEthernet 0/0/1
[R4-GigabitEthernet0/0/1]ip address 192.168.46.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 64544
[R4-bgp]router-id 4.4.4.4
[R4-bgp]confederation id 234
[R4-bgp]confederation peer-as 64523
[R4-bgp]peer 10.10.6.6 as-number 64523
[R4-bgp]peer 10.10.6.6 connect-interface loopback 0
[R4-bgp]peer 10.10.6.6 next-hop-local
[R4-bgp]peer 10.10.6.6 ebgp-max-hop
[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
6)配置网络设备 R5
<Huawei>undo terminal monitor
<Huawei>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
7)测试 R1 与 R5 之间的连通性
<R1>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