当前位置:   article > 正文

【华为】路由综合实验(OSPF+BGP基础)

【华为】路由综合实验(OSPF+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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37

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



  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

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/0
 ip address 192.168.100.254 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 12.12.12.1 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip 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 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

AR2

#
 sysname AR2
#
interface GigabitEthernet0/0/0
 ip address 12.12.12.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip 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 
#
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

AR3

#
 sysname AR3
 #
interface GigabitEthernet0/0/0
 ip address 34.34.34.3 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 13.13.13.3 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip address 23.23.23.3 255.255.255.0 
#
bgp 100
 peer 34.34.34.4 as-number 200 
 #
 ipv4-family unicast
  network 192.168.100.0 
#
ospf 110 router-id 3.3.3.3 
 import-route bgp
 area 0.0.0.0 
  network 13.13.13.0 0.0.0.255 
  network 23.23.23.0 0.0.0.255 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

AR4

#
 sysname AR4
#
interface GigabitEthernet0/0/0
 ip address 34.34.34.4 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 45.45.45.4 255.255.255.0 
#
bgp 200
 peer 34.34.34.3 as-number 100 
 peer 45.45.45.5 as-number 200 
 #
 ipv4-family unicast
  peer 45.45.45.5 next-hop-local 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

AR5

#
 sysname AR5
#
interface GigabitEthernet0/0/0
 ip address 45.45.45.5 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 192.168.200.254 255.255.255.0 
#
bgp 200
 peer 45.45.45.4 as-number 200 
 #
 ipv4-family unicast
  network 192.168.200.0 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/542460
推荐阅读
相关标签
  

闽ICP备14008679号