网络实验实例

9 篇文章 0 订阅
6 篇文章 0 订阅

实验题

需求:全网互通

在这里插入图片描述

思路:

  • 双侧单臂路由
  • MSTP多实例生成树,选择指定的Vlan通过主端口,避免环路产生
  • 静态路由
  • 优先级的选择

LSW7

The device is running!

<Huawei>undo te mo 
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]user- con 0
[Huawei-ui-console0]idle- 0 0       #永不超时
[Huawei-ui-console0]q
[Huawei]vlan bat 10 20 30 40        #创建vlan
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]port link-t acc
[Huawei-Ethernet0/0/1]port def vlan 10        #建立vlan10
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port link-t acc
[Huawei-Ethernet0/0/2]port def vlan 20        #建立vlan20
[Huawei-Ethernet0/0/2]int e0/0/3
[Huawei-Ethernet0/0/3]port link-t tr
[Huawei-Ethernet0/0/3]port tr all vlan all    #创建trunk模式,允许所有vlan通过
[Huawei-Ethernet0/0/3]int e0/0/4
[Huawei-Ethernet0/0/4]port link-t tr
[Huawei-Ethernet0/0/4]port tr all vlan all    #创建trunk模式,允许所有vlan通过
[Huawei-Ethernet0/0/4]q
[Huawei]stp mo mstp                           #stp模式设置mstp
[Huawei]stp re                                #进入mstp
[Huawei-mst-region]reg huawei                 #设置区域名:huawei
[Huawei-mst-region]rev 1                      #设置版本级别: 1
[Huawei-mst-region]ins 1 vlan 10 20           #设置实例1为vlan 10 20
[Huawei-mst-region]ins 2 vlan 30 40           #设置实例2为vlan 30 40
[Huawei-mst-region]act re                     #保存设置
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei-mst-region]dis this
#
stp region-configuration
 region-name huawei
 revision-level 1
 instance 1 vlan 10 20              
 instance 2 vlan 30 40
 active region-configuration
#
return
[Huawei-mst-region]

LSW8

下面展示一些 内联代码片

The device is running!

<Huawei>
<Huawei>undo te mo
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]q
[Huawei]vlan bat 10 20 30 40
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]port link-t acc
[Huawei-Ethernet0/0/1]port def vlan 30
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port link-t acc
[Huawei-Ethernet0/0/2]port def vlan 40
[Huawei-Ethernet0/0/2]int e0/0/3
[Huawei-Ethernet0/0/3]port link-t tr
[Huawei-Ethernet0/0/3]port tr all vlan all
[Huawei-Ethernet0/0/3]int e0/0/4
[Huawei-Ethernet0/0/4]port link-t tr
[Huawei-Ethernet0/0/4]port tr all vlan all
[Huawei-Ethernet0/0/4]q
[Huawei]stp mod mstp
[Huawei]stp re
[Huawei-mst-region]re huawei
[Huawei-mst-region]rev 1
[Huawei-mst-region]ins 1 vlan 10 20
[Huawei-mst-region]ins 2 vlan 30 40
[Huawei-mst-region]act re
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei-mst-region]dis this
#
stp region-configuration
 region-name huawei
 revision-level 1
 instance 1 vlan 10 20
 instance 2 vlan 30 40
 active region-configuration
#
return
[Huawei-mst-region]

LSW5

The device is running!

<Huawei>undo te mo
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]user- con 0 
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]q
[Huawei]vlan bat 10 20 30 40
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]port link-t tr
[Huawei-Ethernet0/0/1]port tr all vlan all
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port link-t tr
[Huawei-Ethernet0/0/2]port tr all vlan all
[Huawei-Ethernet0/0/2]int e0/0/3
[Huawei-Ethernet0/0/3]port link-t tr
[Huawei-Ethernet0/0/3]port tr all vlan all
[Huawei-Ethernet0/0/3]int e0/0/4
[Huawei-Ethernet0/0/4]port link-t tr
[Huawei-Ethernet0/0/4]port tr all vlan all
[Huawei-Ethernet0/0/4]q
[Huawei]stp mo mstp
[Huawei]stp re
[Huawei-mst-region]re huawei
[Huawei-mst-region]rev 1
[Huawei-mst-region]ins 1 vlan 10 20      
[Huawei-mst-region]ins 2 vlan 30 40
[Huawei-mst-region]act re
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei-mst-region]q
[Huawei]stp ins 1 root pri                #设置本交换机为实例1的根
[Huawei]stp ins 2 root sec	              #设置本交换机为实例2的备选根
[Huawei]dis this
#
sysname Huawei
#
vlan batch 10 20 30 40
#
stp instance 1 root primary
stp instance 2 root secondary
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
return

LSW6

The device is running!

<Huawei>undo te mo
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]q
[Huawei]vlan bat 10 20 30 40
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]port link-t tr
[Huawei-Ethernet0/0/1]port tr all vlan all
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port link-t tr
[Huawei-Ethernet0/0/2]port tr all vlan all
[Huawei-Ethernet0/0/2]int e0/0/3
[Huawei-Ethernet0/0/3]port link-t tr
[Huawei-Ethernet0/0/3]port tr all vlan all
[Huawei-Ethernet0/0/3]int e0/0/4
[Huawei-Ethernet0/0/4]port link-t tr
[Huawei-Ethernet0/0/4]port tr all vlan all
[Huawei-Ethernet0/0/4]q
[Huawei]stp mo mstp
[Huawei]stp re
[Huawei-mst-region]re huawei
[Huawei-mst-region]rev 1
[Huawei-mst-region]ins 1 vlan 10 20
[Huawei-mst-region]ins 2 vlan 30 40
[Huawei-mst-region]act re
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei-mst-region]q
[Huawei]stp ins 1 root sec          #设置本交换机为实例1的备选根
[Huawei]stp ins 2 root pri          #设置本交换机为实例2的根
[Huawei]dis this 
#
sysname Huawei
#
vlan batch 10 20 30 40
#
stp instance 1 root secondary
stp instance 2 root primary
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
return

R5

The device is running!

<Huawei>
<Huawei>undo te mo
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]q
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]undo shutd
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[Huawei-GigabitEthernet0/0/0]int g0/0/0.1
[Huawei-GigabitEthernet0/0/0.1]undo shutd
Info: Interface GigabitEthernet0/0/0.1 is not shutdown.
[Huawei-GigabitEthernet0/0/0.1]vlan-t d 10 d
[Huawei-GigabitEthernet0/0/0.1]ip add 192.168.10.1 24
[Huawei-GigabitEthernet0/0/0.1]int g0/0/0.2
[Huawei-GigabitEthernet0/0/0.2]undo shutd
Info: Interface GigabitEthernet0/0/0.2 is not shutdown.
[Huawei-GigabitEthernet0/0/0.2]vlan-t d 20 d
[Huawei-GigabitEthernet0/0/0.2]ip add 192.168.20.1 24
[Huawei-GigabitEthernet0/0/0.2]int g0/0/1
[Huawei-GigabitEthernet0/0/1]undo shutd
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[Huawei-GigabitEthernet0/0/1]ip add 12.1.1.2 24
[Huawei-GigabitEthernet0/0/1]int e0/0/0
[Huawei-Ethernet0/0/0]undo shutd
Info: Interface Ethernet0/0/0 is not shutdown.
[Huawei-Ethernet0/0/0]ip add 21.1.1.2 24
[Huawei-Ethernet0/0/0]int loopb0
[Huawei-LoopBack0]ip add 1.1.1.1 32
[Huawei-LoopBack0]q
[Huawei]ip route-s	
[Huawei]ip route-static 192.168.30.0 24 12.1.1.3         #静态路由配置
[Huawei]ip route-static 192.168.40.0 24 12.1.1.3         #静态路由配置
[Huawei]ip route-static 2.2.2.2 32 12.1.1.3              #静态路由配置
[Huawei]ip route-static 2.2.2.2 32 21.1.1.3 pre 62       #调整优先级
[Huawei]ip route-static 192.168.40.0 24 21.1.1.3 pre 62  #调整优先级
[Huawei]ip route-static 192.168.30.0 24 21.1.1.3 pre 62  #调整优先级
[Huawei]dis this
#
sysname Huawei
#
ip route-static 2.2.2.2 255.255.255.255 12.1.1.3
ip route-static 2.2.2.2 255.255.255.255 21.1.1.3 preference 62
ip route-static 192.168.30.0 255.255.255.0 12.1.1.3
ip route-static 192.168.30.0 255.255.255.0 21.1.1.3 preference 62
ip route-static 192.168.40.0 255.255.255.0 12.1.1.3
ip route-static 192.168.40.0 255.255.255.0 21.1.1.3 preference 62
#
return
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]shutd
[Huawei-GigabitEthernet0/0/1]undo shut

R6

The device is running!

<Huawei>
<Huawei>undo te mo
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]q
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]undo shutd 
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[Huawei-GigabitEthernet0/0/0]int g0/0/0.1
[Huawei-GigabitEthernet0/0/0.1]undo shutd
Info: Interface GigabitEthernet0/0/0.1 is not shutdown.
[Huawei-GigabitEthernet0/0/0.1]vlan-t d 30 d
[Huawei-GigabitEthernet0/0/0.1]ip add 192.168.30.1 24
[Huawei-GigabitEthernet0/0/0.1]int g0/0/0.2
[Huawei-GigabitEthernet0/0/0.2]undo shutd
Info: Interface GigabitEthernet0/0/0.2 is not shutdown.
[Huawei-GigabitEthernet0/0/0.2]vlan-t d 40 d
[Huawei-GigabitEthernet0/0/0.2]ip add 192.168.40.1 24
[Huawei-GigabitEthernet0/0/0.2]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 12.1.1.3 24
[Huawei-GigabitEthernet0/0/1]int e0/0/0
[Huawei-Ethernet0/0/0]ip add 21.1.1.3 24
[Huawei-Ethernet0/0/0]int loopb 0
[Huawei-LoopBack0]ip add 2.2.2.2 32
[Huawei-LoopBack0]q
[Huawei]ip route-static 192.168.30.0 24 12.1.1.3
Error: The next-hop address is invalid.
[Huawei]ip route-static 192.168.10.0 24 12.1.1.2
[Huawei]ip route-static 192.168.20.0 24 12.1.1.2
[Huawei]ip route-static 1.1.1.1 32 12.1.1.2
[Huawei]ip route-static 192.168.10.0 24 21.1.1.2 pre 63
[Huawei]ip route-static 192.168.20.0 24 21.1.1.2 pre 63
[Huawei]ip route-static 1.1.1.1 32 21.1.1.2 pre 63
[Huawei]dis this
#
sysname Huawei
#
ip route-static 1.1.1.1 255.255.255.255 12.1.1.2
ip route-static 1.1.1.1 255.255.255.255 21.1.1.2 preference 63
ip route-static 192.168.10.0 255.255.255.0 12.1.1.2
ip route-static 192.168.10.0 255.255.255.0 21.1.1.2 preference 63
ip route-static 192.168.20.0 255.255.255.0 12.1.1.2
ip route-static 192.168.20.0 255.255.255.0 21.1.1.2 preference 63
#
return
[Huawei]

正常情况下通信结果:

PC5连通性测试:

PC>ping 192.168.20.20

Ping 192.168.20.20: 32 data bytes, Press Ctrl_C to break
From 192.168.20.20: bytes=32 seq=1 ttl=127 time=172 ms
From 192.168.20.20: bytes=32 seq=2 ttl=127 time=109 ms
From 192.168.20.20: bytes=32 seq=3 ttl=127 time=109 ms
From 192.168.20.20: bytes=32 seq=4 ttl=127 time=172 ms
From 192.168.20.20: bytes=32 seq=5 ttl=127 time=157 ms

--- 192.168.20.20 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 109/143/172 ms

PC>ping 192.168.30.30

Ping 192.168.30.30: 32 data bytes, Press Ctrl_C to break
From 192.168.30.30: bytes=32 seq=1 ttl=126 time=218 ms
From 192.168.30.30: bytes=32 seq=2 ttl=126 time=110 ms
From 192.168.30.30: bytes=32 seq=3 ttl=126 time=156 ms
From 192.168.30.30: bytes=32 seq=4 ttl=126 time=125 ms
From 192.168.30.30: bytes=32 seq=5 ttl=126 time=156 ms

--- 192.168.30.30 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 110/153/218 ms

PC>ping 192.168.40.40

Ping 192.168.40.40: 32 data bytes, Press Ctrl_C to break
From 192.168.40.40: bytes=32 seq=1 ttl=126 time=235 ms
From 192.168.40.40: bytes=32 seq=2 ttl=126 time=140 ms
From 192.168.40.40: bytes=32 seq=3 ttl=126 time=125 ms
From 192.168.40.40: bytes=32 seq=4 ttl=126 time=141 ms
From 192.168.40.40: bytes=32 seq=5 ttl=126 time=109 ms

--- 192.168.40.40 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 109/150/235 ms

PC>ping 2.2.2.2

Ping 2.2.2.2: 32 data bytes, Press Ctrl_C to break
From 2.2.2.2: bytes=32 seq=1 ttl=254 time=78 ms
From 2.2.2.2: bytes=32 seq=2 ttl=254 time=78 ms
From 2.2.2.2: bytes=32 seq=3 ttl=254 time=78 ms
From 2.2.2.2: bytes=32 seq=4 ttl=254 time=78 ms
From 2.2.2.2: bytes=32 seq=5 ttl=254 time=47 ms

--- 2.2.2.2 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 47/71/78 ms

断开路由器之间G口后的通信测试

在这里插入图片描述

PC5连通性测试:

PC>ping 192.168.20.20

Ping 192.168.20.20: 32 data bytes, Press Ctrl_C to break
Request timeout!                                         #缓存时间已过
From 192.168.20.20: bytes=32 seq=2 ttl=127 time=125 ms   #重新连接上
From 192.168.20.20: bytes=32 seq=3 ttl=127 time=110 ms   #重新连接上
From 192.168.20.20: bytes=32 seq=4 ttl=127 time=109 ms   #重新连接上
From 192.168.20.20: bytes=32 seq=5 ttl=127 time=109 ms   #重新连接上

--- 192.168.20.20 ping statistics ---
  5 packet(s) transmitted
  4 packet(s) received
  20.00% packet loss
  round-trip min/avg/max = 0/113/125 ms

PC>ping 192.168.30.30

Ping 192.168.30.30: 32 data bytes, Press Ctrl_C to break
Request timeout!                                        #缓存时间已过
From 192.168.30.30: bytes=32 seq=2 ttl=126 time=141 ms  #重新连接上
From 192.168.30.30: bytes=32 seq=3 ttl=126 time=156 ms  #重新连接上
From 192.168.30.30: bytes=32 seq=4 ttl=126 time=125 ms  #重新连接上
From 192.168.30.30: bytes=32 seq=5 ttl=126 time=172 ms  #重新连接上

--- 192.168.30.30 ping statistics ---
  5 packet(s) transmitted
  4 packet(s) received
  20.00% packet loss
  round-trip min/avg/max = 0/148/172 ms

PC>ping 192.168.40.40

Ping 192.168.40.40: 32 data bytes, Press Ctrl_C to break
Request timeout!                                        #缓存时间已过
From 192.168.40.40: bytes=32 seq=2 ttl=126 time=141 ms  #重新连接上
From 192.168.40.40: bytes=32 seq=3 ttl=126 time=125 ms  #重新连接上
From 192.168.40.40: bytes=32 seq=4 ttl=126 time=156 ms  #重新连接上
From 192.168.40.40: bytes=32 seq=5 ttl=126 time=156 ms  #重新连接上

--- 192.168.40.40 ping statistics ---
  5 packet(s) transmitted
  4 packet(s) received
  20.00% packet loss
  round-trip min/avg/max = 0/144/156 ms

PC>ping 2.2.2.2

Ping 2.2.2.2: 32 data bytes, Press Ctrl_C to break
From 2.2.2.2: bytes=32 seq=1 ttl=254 time=125 ms
From 2.2.2.2: bytes=32 seq=2 ttl=254 time=63 ms
From 2.2.2.2: bytes=32 seq=3 ttl=254 time=93 ms
From 2.2.2.2: bytes=32 seq=4 ttl=254 time=79 ms
From 2.2.2.2: bytes=32 seq=5 ttl=254 time=78 ms

--- 2.2.2.2 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 63/87/125 ms
  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小白的成功进阶之路

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值