【华为】路由综合实验
- 实验需求
- 拓扑
- 配置
- AR1
- AR2
- AR3
- AR4
- AR5
- PC1
- PC2
- 查看
- 通信
- OSPF
- 邻居
- OSPF路由表
- BGP
- BGP邻居
- BGP 路由表
- 配置文档
实验需求
① 自行规划IP地址
② 在区域1里面 启用OSPF
③ 在区域1和区域2 启用BGP,使AR4和AR3成为eBGP,AR4和AR5成为iBGP对等体
④ 成功让PC1 ping 通 PC2
拓扑
配置
AR1
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.[Huawei]sysname AR1 [AR1]undo info-center enable
Info: Information center is disabled.[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip address 192.168.100.254 24
[AR1-GigabitEthernet0/0/0]quit[AR1]int g0/0/1
[AR1-GigabitEthernet0/0/1]ip address 12.12.12.1 24
[AR1-GigabitEthernet0/0/1]quit[AR1]int g0/0/2
[AR1-GigabitEthernet0/0/2]ip address 13.13.13.1 24
[AR1-GigabitEthernet0/0/2]quit## 启用OSPF,设置RID为1.1.1.1
[AR1]ospf 110 router-id 1.1.1.1
[AR1-ospf-110]area 0 ## 进入区域0(骨干区域)
[AR1-ospf-110-area-0.0.0.0]network 192.168.100.0 0.0.0.255 ## 宣告内容
[AR1-ospf-110-area-0.0.0.0]network 12.12.12.0 0.0.0.255
[AR1-ospf-110-area-0.0.0.0]network 13.13.13.0 0.0.0.255
[AR1-ospf-110-area-0.0.0.0]quit
[AR1-ospf-110]quit
AR2
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.[Huawei]sysname AR2[AR2]undo info-center enable
Info: Information center is disabled.[AR2]int g0/0/0
[AR2-GigabitEthernet0/0/0]ip address 12.12.12.2 24
[AR2-GigabitEthernet0/0/0]quit[AR2]int g0/0/1
[AR2-GigabitEthernet0/0/1]ip address 23.23.23.2 24
[AR2-GigabitEthernet0/0/1]quit[AR2]ospf 110 router-id 2.2.2.2
[AR2-ospf-110]area 0
[AR2-ospf-110-area-0.0.0.0]network 12.12.12.0 0.0.0.255
[AR2-ospf-110-area-0.0.0.0]network 23.23.23.0 0.0.0.255
[AR2-ospf-110-area-0.0.0.0]quit
[AR2-ospf-110]quit
AR3
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.[Huawei]sysname AR3[AR3]undo info-center enable
Info: Information center is disabled.[AR3]int g0/0/0
[AR3-GigabitEthernet0/0/0]ip address 34.34.34.3 24
[AR3-GigabitEthernet0/0/0]quit[AR3]int g0/0/1
[AR3-GigabitEthernet0/0/1]ip address 13.13.13.3 24
[AR3-GigabitEthernet0/0/1]quit[AR3]int g0/0/2
[AR3-GigabitEthernet0/0/2]ip address 23.23.23.3 24
[AR3-GigabitEthernet0/0/2]quit[AR3]ospf 110 router-id 3.3.3.3
[AR3-ospf-110]area 0
[AR3-ospf-110-area-0.0.0.0]network 13.13.13.0 0.0.0.255
[AR3-ospf-110-area-0.0.0.0]network 23.23.23.0 0.0.0.255
[AR3-ospf-110-area-0.0.0.0]quit
[AR3-ospf-110]quit[AR3]bgp 100 ## 进入BGP,指定本地AS号为100
[AR3-bgp]peer 34.34.34.4 as-number 200 ## 部署R3和R4建立eBGP的连接(指定对等体IP地址和as号)
[AR3-bgp]ipv4-family unicast ## 配置IPv4单播路由
[AR3-bgp-af-ipv4]network 192.168.100.0 24 ## 把该网段宣告进入BGP
[AR3-bgp-af-ipv4]quit
[AR3-bgp]quit[AR3]ospf 110
[AR3-ospf-110]import-route bgp ## 进入OSPF进程,把BGP导入OSPF当中
[AR3-ospf-110]quit
AR4
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.[Huawei]sysname AR4[AR4]undo info-center enable
Info: Information center is disabled.[AR4]int g0/0/0
[AR4-GigabitEthernet0/0/0]ip address 34.34.34.4 24
[AR4-GigabitEthernet0/0/0]quit [AR4]int g0/0/1
[AR4-GigabitEthernet0/0/1]ip address 45.45.45.4 24
[AR4-GigabitEthernet0/0/1]quit[AR4]bgp 200 ## 进入BGP,指定本地AS号为200
[AR4-bgp]peer 34.34.34.3 as-number 100 ## 配置R3和R4建立eBGP的连接(指定对等体IP地址和as号)
[AR4-bgp]peer 45.45.45.5 as-number 200 ## 配置R4和R5建立iBGP的连接(指定对等体IP地址和as号)
[AR4-bgp]quit[AR4]bgp 200
[AR4-bgp]ipv4-family unicast ## 配置IPv4单播路由
[AR4-bgp-af-ipv4]peer 45.45.45.5 next-hop-local
## R4向对等体R5通告BGP路由的时候,把下一跳设置成自己的接口
## 不然R5是不能把R3宣告的内容写进路由表,因为默认情况下,R3宣告的内容下一跳就是R3
## 我们需要手动去把R5学到的路由的下一跳为R4(iBGP)
[AR4-bgp-af-ipv4]quit
[AR4-bgp]quit
AR5
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.[Huawei]sysname AR5[AR5]undo info-center enable
Info: Information center is disabled.[AR5]int g0/0/0
[AR5-GigabitEthernet0/0/0]ip address 45.45.45.5 24
[AR5-GigabitEthernet0/0/0]quit[AR5]int g0/0/1
[AR5-GigabitEthernet0/0/1]ip address 192.168.200.254 24
[AR5-GigabitEthernet0/0/1]quit[AR5]bgp 200 ## 进入BGP,指定本地AS号为200
[AR5-bgp]peer 45.45.45.4 as-number 200 ## 建立R4和R5的iBGP连接
[AR5-bgp]ipv4-family unicast ## 配置IPv4单播路由
[AR5-bgp-af-ipv4]network 192.168.200.0 24 ## 将网络宣告进BGP中
[AR5-bgp-af-ipv4]quit
[AR5-bgp]quit
PC1
PC2
查看
通信
实验完成啦
PC1 → PC2
OSPF
邻居
display ospf peer brief
OSPF路由表
display ip routing-table protocol ospf
BGP
BGP邻居
display bgp peer
BGP 路由表
display bgp routing-table
display ip routing-table protocol bgp
配置文档
AR1
#sysname AR1
#
interface GigabitEthernet0/0/0ip address 192.168.100.254 255.255.255.0
#
interface GigabitEthernet0/0/1ip address 12.12.12.1 255.255.255.0
#
interface GigabitEthernet0/0/2ip address 13.13.13.1 255.255.255.0
#
ospf 110 router-id 1.1.1.1 area 0.0.0.0 network 12.12.12.0 0.0.0.255 network 13.13.13.0 0.0.0.255 network 192.168.100.0 0.0.0.255
AR2
#sysname AR2
#
interface GigabitEthernet0/0/0ip address 12.12.12.2 255.255.255.0
#
interface GigabitEthernet0/0/1ip address 23.23.23.2 255.255.255.0
#
ospf 110 router-id 2.2.2.2 area 0.0.0.0 network 12.12.12.0 0.0.0.255 network 23.23.23.0 0.0.0.255
#
AR3
#sysname AR3#
interface GigabitEthernet0/0/0ip address 34.34.34.3 255.255.255.0
#
interface GigabitEthernet0/0/1ip address 13.13.13.3 255.255.255.0
#
interface GigabitEthernet0/0/2ip address 23.23.23.3 255.255.255.0
#
bgp 100peer 34.34.34.4 as-number 200 #ipv4-family unicastnetwork 192.168.100.0
#
ospf 110 router-id 3.3.3.3 import-route bgparea 0.0.0.0 network 13.13.13.0 0.0.0.255 network 23.23.23.0 0.0.0.255
AR4
#sysname AR4
#
interface GigabitEthernet0/0/0ip address 34.34.34.4 255.255.255.0
#
interface GigabitEthernet0/0/1ip address 45.45.45.4 255.255.255.0
#
bgp 200peer 34.34.34.3 as-number 100 peer 45.45.45.5 as-number 200 #ipv4-family unicastpeer 45.45.45.5 next-hop-local
AR5
#sysname AR5
#
interface GigabitEthernet0/0/0ip address 45.45.45.5 255.255.255.0
#
interface GigabitEthernet0/0/1ip address 192.168.200.254 255.255.255.0
#
bgp 200peer 45.45.45.4 as-number 200 #ipv4-family unicastnetwork 192.168.200.0