这次来个BGP反射器的简单小实验
前言
一、先把端口简单配置写完(OSPF、RIP、IP)
R1
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 15.0.0.1 24
[Huawei-GigabitEthernet0/0/1]int loop0
[Huawei-LoopBack0]ip add 1.1.1.1 32
[Huawei-LoopBack0]q
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]net 1.1.1.1 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]net 12.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]net 15.0.0.0 0.0.0.255
R2
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 24.0.0.2 24
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 23.0.0.2 24
[Huawei-GigabitEthernet0/0/2]int g1/0/0
[Huawei-GigabitEthernet1/0/0]ip add 25.0.0.2 24
[Huawei-GigabitEthernet1/0/0]int loop0
[Huawei-LoopBack0]ip add 2.2.2.2 32
[Huawei-LoopBack0]q
[Huawei]ip route-s 6.6.6.6 32 56.0.0.6
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]net 5.5.5.5 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]net 45.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]net 15.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]net 25.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]net 56.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]q
[Huawei-ospf-1]import-route static
R3
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 23.0.0.3 24
[Huawei-GigabitEthernet0/0/2]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 37.0.0.3 24
[Huawei-GigabitEthernet0/0/1]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 36.0.0.3 24
[Huawei-GigabitEthernet0/0/0]int loop0
[Huawei-LoopBack0]ip add 3.3.3.3 32
[Huawei-LoopBack0]q
[Huawei]ip route-s 7.7.7.7 32 37.0.0.7
[Huawei]ip route-s 2.2.2.2 32 23.0.0.2
[Huawei]ospf
[Huawei-ospf-1]area 1
[Huawei-ospf-1-area-0.0.0.1]net 3.3.3.3 0.0.0.0
[Huawei-ospf-1-area-0.0.0.1]net 23.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.1]net 36.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.1]q
[Huawei-ospf-1]import-route static
[Huawei-ospf-1]q
R4
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 45.0.0.4 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 24.0.0.4 24
[Huawei-GigabitEthernet0/0/1]int loop0
[Huawei-LoopBack0]ip add 4.4.4.4 32
[Huawei-LoopBack0]q
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]net 4.4.4.4 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]net 24.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]net 45.0.0.0 0.0.0.255
R5
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 45.0.0.5 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 15.0.0.5 24
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 56.0.0.5 24
[Huawei-GigabitEthernet0/0/2]int g1/0/0
[Huawei-GigabitEthernet1/0/0]ip add 25.0.0.5 24
[Huawei-GigabitEthernet1/0/0]int loop0
[Huawei-LoopBack0]ip add 5.5.5.5 32
[Huawei-LoopBack0]q
[Huawei]ip route-s 6.6.6.6 32 56.0.0.6
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]net 5.5.5.5 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]net 45.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]net 15.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]net 25.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]net 56.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]q
[Huawei-ospf-1]import-route static
[Huawei-ospf-1]q
R6
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 68.0.0.6 24
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 56.0.0.6 24
[Huawei-GigabitEthernet0/0/2]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 36.0.0.6 24
[Huawei-GigabitEthernet0/0/0]int loop0
[Huawei-LoopBack0]ip add 6.6.6.6 32
[Huawei-LoopBack0]q
[Huawei]ip route-s 8.8.8.8 32 68.0.0.8
[Huawei]ip route-s 5.5.5.5 32 56.0.0.5
[Huawei]ospf
[Huawei-ospf-1]area 1
[Huawei-ospf-1-area-0.0.0.1]net 56.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.1]net 36.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.1]net 6.6.6.6 0.0.0.0
[Huawei-ospf-1-area-0.0.0.1]q
[Huawei-ospf-1]import-route static
[Huawei-ospf-1]q
R7
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 37.0.0.7 24
[Huawei-GigabitEthernet0/0/1]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 78.0.0.7 24
[Huawei-GigabitEthernet0/0/0]int loop0
[Huawei-LoopBack0]ip add 7.7.7.7 32
[Huawei-LoopBack0]q
[Huawei]ip route-s 3.3.3.3 32 37.0.0.3
[Huawei]rip
[Huawei-rip-1]v 2
[Huawei-rip-1]undo sum
[Huawei-rip-1]net 7.0.0.0
[Huawei-rip-1]net 78.0.0.0
R8
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 68.0.0.8 24
[Huawei-GigabitEthernet0/0/1]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 78.0.0.8 24
[Huawei-GigabitEthernet0/0/0]int loop0
[Huawei-LoopBack0]ip add 8.8.8.8 32
[Huawei-LoopBack0]q
[Huawei]ip route-s 6.6.6.6 32 68.0.0.6
[Huawei]rip
[Huawei-rip-1]v 2
[Huawei-rip-1]undo sum
[Huawei-rip-1]net 8.0.0.0
[Huawei-rip-1]net 78.0.0.0
二、配置BGP及反射器
R1
[Huawei]bgp 100
[Huawei-bgp]router-id 1.1.1.1
[Huawei-bgp]peer 2.2.2.2 as-n 100
[Huawei-bgp]peer 2.2.2.2 connect-interface LoopBack0
[Huawei-bgp]peer 5.5.5.5 as-n 100
[Huawei-bgp]peer 5.5.5.5 connect-interface LoopBack0
[Huawei-bgp]peer 2.2.2.2 re
[Huawei-bgp]net 1.1.1.1 32
[Huawei-bgp]net 2.2.2.2 32
[Huawei-bgp]net 5.5.5.5 32
R2
[Huawei]bgp 100
[Huawei-bgp]router-id 2.2.2.2
[Huawei-bgp]peer 1.1.1.1 as-n 100
[Huawei-bgp]peer 3.3.3.3 as-n 100
[Huawei-bgp]peer 4.4.4.4 as-n 100
[Huawei-bgp]peer 5.5.5.5 as-n 100
[Huawei-bgp]peer 1.1.1.1 connect-interface LoopBack0
[Huawei-bgp]peer 3.3.3.3 connect-interface LoopBack0
[Huawei-bgp]peer 4.4.4.4 connect-interface LoopBack0
[Huawei-bgp]peer 5.5.5.5 connect-interface LoopBack0
[Huawei-bgp]peer 1.1.1.1 reflect-client
[Huawei-bgp]peer 4.4.4.4 reflect-client
[Huawei-bgp]peer 5.5.5.5 reflect-client
[Huawei-bgp]peer 3.3.3.3 reflect-client
[Huawei-bgp]net 1.1.1.1 32
[Huawei-bgp]net 2.2.2.2 32
[Huawei-bgp]net 3.3.3.3 32
[Huawei-bgp]net 4.4.4.4 32
[Huawei-bgp]net 5.5.5.5 32
R3
[Huawei]bgp 100
[Huawei-bgp]router-id 3.3.3.3
[Huawei-bgp]peer 2.2.2.2 as-n 100
[Huawei-bgp]peer 6.6.6.6 as-n 100
[Huawei-bgp]peer 2.2.2.2 con loop0
[Huawei-bgp]peer 6.6.6.6 con loop0
[Huawei-bgp]peer 7.7.7.7 as-n 200
[Huawei-bgp]peer 7.7.7.7 con loop0
[Huawei-bgp]peer 7.7.7.7 ebgp-max-hop 2
[Huawei-bgp]net 2.2.2.2 32
[Huawei-bgp]net 6.6.6.6 32
[Huawei-bgp]net 3.3.3.3 32
[Huawei-bgp]net 7.7.7.7 32
R4
[Huawei]bgp 100
[Huawei-bgp]router-id 4.4.4.4
[Huawei-bgp]peer 2.2.2.2 as-n 100
[Huawei-bgp]peer 5.5.5.5 as-n 100
[Huawei-bgp]peer 2.2.2.2 connect-interface LoopBack0
[Huawei-bgp]peer 5.5.5.5 connect-interface LoopBack0
[Huawei-bgp]net 4.4.4.4 32
[Huawei-bgp]net 5.5.5.5 32
R5
[Huawei]bgp 100
[Huawei-bgp]router-id 5.5.5.5
[Huawei-bgp]peer 1.1.1.1 as-n 100
[Huawei-bgp]peer 2.2.2.2 as-n 100
[Huawei-bgp]peer 4.4.4.4 as-n 100
[Huawei-bgp]peer 6.6.6.6 as-n 100
[Huawei-bgp]peer 1.1.1.1 connect-interface LoopBack0
[Huawei-bgp]peer 2.2.2.2 connect-interface LoopBack0
[Huawei-bgp]peer 4.4.4.4 connect-interface LoopBack0
[Huawei-bgp]peer 6.6.6.6 connect-interface LoopBack0
[Huawei-bgp]peer 1.1.1.1 reflect-client
[Huawei-bgp]peer 2.2.2.2 reflect-client
[Huawei-bgp]peer 4.4.4.4 reflect-client
[Huawei-bgp]peer 6.6.6.6 reflect-client
[Huawei-bgp]net 1.1.1.1 32
[Huawei-bgp]net 2.2.2.2 32
[Huawei-bgp]net 4.4.4.4 32
[Huawei-bgp]net 5.5.5.5 32
[Huawei-bgp]net 6.6.6.6 32
R6
[Huawei]bgp 100
[Huawei-bgp]router-id 6.6.6.6
[Huawei-bgp]peer 5.5.5.5 as-n 100
[Huawei-bgp]peer 3.3.3.3 as-n 100
[Huawei-bgp]peer 3.3.3.3 connect-interface LoopBack0
[Huawei-bgp]peer 5.5.5.5 connect-interface LoopBack0
[Huawei-bgp]peer 8.8.8.8 as-n 200
[Huawei-bgp]peer 8.8.8.8 connect-interface LoopBack0
[Huawei-bgp]peer 8.8.8.8 ebgp-max-hop 2
[Huawei-bgp]net 3.3.3.3 32
[Huawei-bgp]net 5.5.5.5 32
[Huawei-bgp]net 6.6.6.6 32
[Huawei-bgp]net 8.8.8.8 32
R7
[Huawei]bgp 200
[Huawei-bgp]router-id 7.7.7.7
[Huawei-bgp]peer 8.8.8.8 as-n 200
[Huawei-bgp]peer 3.3.3.3 as-n 100
[Huawei-bgp]peer 8.8.8.8 connect-interface LoopBack0
[Huawei-bgp]peer 3.3.3.3 connect-interface LoopBack0
[Huawei-bgp]peer 8.8.8.8 next-hop-local
[Huawei-bgp]peer 3.3.3.3 ebgp-max-hop 2
[Huawei-bgp]net 3.3.3.3 32
[Huawei-bgp]net 7.7.7.7 32
[Huawei-bgp]net 8.8.8.8 32
R8
[Huawei]bgp 200
[Huawei-bgp]router-id 8.8.8.8
[Huawei-bgp]peer 7.7.7.7 as-n 200
[Huawei-bgp]peer 6.6.6.6 as-n 100
[Huawei-bgp]peer 7.7.7.7 connect-interface LoopBack0
[Huawei-bgp]peer 6.6.6.6 connect-interface LoopBack0
[Huawei-bgp]peer 7.7.7.7 next-hop-local
[Huawei-bgp]peer 6.6.6.6 ebgp-max-hop 2
[Huawei-bgp]net 6.6.6.6 32
[Huawei-bgp]net 7.7.7.7 32
[Huawei-bgp]net 8.8.8.8 32
三、连通性(以R8的环回口举例)
[Huawei-bgp]ping -a 8.8.8.8 1.1.1.1
PING 1.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=253 time=40 ms
Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=253 time=40 ms
Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=253 time=30 ms
Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=253 time=30 ms
Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=253 time=40 ms
--- 1.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/36/40 ms
[Huawei-bgp]ping -a 8.8.8.8 2.2.2.2
PING 2.2.2.2: 56 data bytes, press CTRL_C to break
Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=253 time=30 ms
Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=253 time=30 ms
Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=253 time=30 ms
Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=253 time=30 ms
Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=253 time=30 ms
--- 2.2.2.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/30/30 ms
[Huawei-bgp]ping -a 8.8.8.8 3.3.3.3
PING 3.3.3.3: 56 data bytes, press CTRL_C to break
Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=254 time=40 ms
Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=254 time=20 ms
Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=254 time=30 ms
--- 3.3.3.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/28/40 ms
[Huawei-bgp]ping -a 8.8.8.8 4.4.4.4
PING 4.4.4.4: 56 data bytes, press CTRL_C to break
Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=253 time=30 ms
Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=253 time=40 ms
Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=253 time=40 ms
Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=253 time=30 ms
Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=253 time=30 ms
--- 4.4.4.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/34/40 ms
[Huawei-bgp]ping -a 8.8.8.8 5.5.5.5
PING 5.5.5.5: 56 data bytes, press CTRL_C to break
Reply from 5.5.5.5: bytes=56 Sequence=1 ttl=254 time=20 ms
Reply from 5.5.5.5: bytes=56 Sequence=2 ttl=254 time=20 ms
Reply from 5.5.5.5: bytes=56 Sequence=3 ttl=254 time=10 ms
Reply from 5.5.5.5: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 5.5.5.5: bytes=56 Sequence=5 ttl=254 time=20 ms
--- 5.5.5.5 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/18/20 ms
[Huawei-bgp]ping -a 8.8.8.8 6.6.6.6
PING 6.6.6.6: 56 data bytes, press CTRL_C to break
Reply from 6.6.6.6: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 6.6.6.6: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 6.6.6.6: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 6.6.6.6: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 6.6.6.6: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 6.6.6.6 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/26/30 ms
[Huawei-bgp]ping -a 8.8.8.8 7.7.7.7
PING 7.7.7.7: 56 data bytes, press CTRL_C to break
Reply from 7.7.7.7: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 7.7.7.7: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 7.7.7.7: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 7.7.7.7: bytes=56 Sequence=4 ttl=255 time=10 ms
Reply from 7.7.7.7: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 7.7.7.7 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/20/30 ms
总结
做个试验,让大家稍微了解下BGP反射器的配置命令