三层架构实验

一、实验要求 

 

1.内网IP地址172.16.0.0/16合理分配
2.SW1/2之间互为备份
3.VRRP/STP/VLAN/TRUNK均使用
4.所有PC通过DHCP获取ip地址

二、实验拓扑

 

 

三、实验步骤

eth-trunk

The device is running!

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]interface e	
[Huawei]interface Eth-Trunk 0
[Huawei-Eth-Trunk0]q
[Huawei]int	
[Huawei]interface g	
[Huawei]interface GigabitEthernet 0/0/22
[Huawei-GigabitEthernet0/0/22]e	
[Huawei-GigabitEthernet0/0/22]eth-trunk 0
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei-GigabitEthernet0/0/22]
Aug 24 2023 11:11:02-08:00 Huawei %%01IFNET/4/IF_STATE(l)[0]:Interface Eth-Trunk
0 has turned into UP state.
Aug 24 2023 11:11:04-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 4, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/22]int	
[Huawei-GigabitEthernet0/0/22]q
[Huawei]sys sw1
[sw1]int	
[sw1]interface g
Aug 24 2023 11:11:54-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 5, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1]interface g	
[sw1]interface GigabitEthernet 0/0/23
[sw1-GigabitEthernet0/0/23]e	
[sw1-GigabitEthernet0/0/23]eth-trunk 0
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1-GigabitEthernet0/0/23]
[sw1-GigabitEthernet0/0/23]q
The device is running!

<Huawei>
<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys sw2
[sw2]int	
[sw2]interface 
Aug 24 2023 11:16:47-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 4, the c
hange loop count is 0, and the maximum number of records is 4095.	
[sw2]interface e	
[sw2]interface Eth-Trunk 0
[sw2-Eth-Trunk0]q
[sw2]int	
[sw2]interface g	
[sw2]interface GigabitEthernet 0/0/22
[sw2-GigabitEthernet0/0/22]e	
[sw2-GigabitEthernet0/0/22]eth-trunk 0
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2-GigabitEthernet0/0/22]
Aug 24 2023 11:17:22-08:00 sw2 %%01IFNET/4/IF_STATE(l)[0]:Interface Eth-Trunk0 h
as turned into UP state.	
[sw2-GigabitEthernet0/0/22]
Aug 24 2023 11:17:27-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 5, the c
hange loop count is 0, and the maximum number of records is 4095.	
[sw2-GigabitEthernet0/0/22]q
[sw2]int	
[sw2]interface g0/0/23
[sw2-GigabitEthernet0/0/23]e	
[sw2-GigabitEthernet0/0/23]eth-trunk 0
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2-GigabitEthernet0/0/23]
Aug 24 2023 11:17:57-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 6, the c
hange loop count is 0, and the maximum number of records is 4095.	
[sw2-GigabitEthernet0/0/23]q
[sw2]

vlan

sw1,2,3,4创建vlan建立trunk

[sw1]
[sw1]vlan 2
[sw1-vlan2]
Aug 24 2023 11:19:44-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 7, the c
hange loop count is 0, and the maximum number of records is 4095.	
[sw1-vlan2]q
[sw1]port-g	
[sw1]port-group g	
[sw1]port-group group-member g	
[sw1]port-group group-member GigabitEthernet 0/0/1 to e	
[sw1]port-group group-member GigabitEthernet 0/0/1 to g	
[sw1]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2 e	
[sw1]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2 Eth-
Trunk 0       //三个接口统一输入命令
[sw1-port-group]
Aug 24 2023 11:21:24-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 8, the c
hange loop count is 0, and the maximum number of records is 4095.	
[sw1-port-group]port link-type t	
[sw1-port-group]port link-type trunk 
[sw1-GigabitEthernet0/0/1]port link-type trunk 
[sw1-GigabitEthernet0/0/2]port link-type trunk 
[sw1-Eth-Trunk0]port link-type trunk 
[sw1-port-group]
Aug 24 2023 11:22:04-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 11, the 
change loop count is 0, and the maximum number of records is 4095.	
[sw1-port-group]port trunk all	
[sw1-port-group]port trunk allow-pass vlan 2
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
[sw1-Eth-Trunk0]port trunk allow-pass vlan 2
[sw1-port-group]
[sw2]vlan 2
[sw2-vlan2]q
[sw2]i
Aug 24 2023 11:24:57-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 7, the c
hange loop count is 0, and the maximum number of records is 4095	
[sw2]port-g	
[sw2]port-group g	
[sw2]port-group group-member g	
[sw2]port-group group-member GigabitEthernet 0/0/1 to g	
[sw2]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2 e	
[sw2]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2 Eth-
Trunk 0
[sw2-port-group]p
Aug 24 2023 11:25:48-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 8, the c
hange loop count is 0, and the maximum number of records is 4095.	
[sw2-port-group]port link-t	
[sw2-port-group]port link-type t	
[sw2-port-group]port link-type trunk 
[sw2-GigabitEthernet0/0/1]port link-type trunk 
[sw2-GigabitEthernet0/0/2]port link-type trunk 
[sw2-Eth-Trunk0]port link-type trunk 
[sw2-port-group]
Aug 24 2023 11:26:08-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 11, the 
change loop count is 0, and the maximum number of records is 4095.	
[sw2-port-group]port trunk all	
[sw2-port-group]port trunk allow-pass vlan 2
[sw2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2
[sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
[sw2-Eth-Trunk0]port trunk allow-pass vlan 2
[sw2-port-group]
[sw3]vlan 2
[sw3-vlan2]
Aug 24 2023 11:27:58-08:00 sw3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 5, the c
hange loop count is 0, and the maximum number of records is 4095.	
[sw3-vlan2]q
[sw3]	
[sw3]int	
[sw3]interface e0/0/2
[sw3-Ethernet0/0/2]port link-t	
[sw3-Ethernet0/0/2]port link-type ac	
[sw3-Ethernet0/0/2]port link-type access 
[sw3-Ethernet0/0/2]port 
Aug 24 2023 11:28:48-08:00 sw3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 6, the c
hange loop count is 0, and the maximum number of records is 4095.	
[sw3-Ethernet0/0/2]port def	
[sw3-Ethernet0/0/2]port default vlan 2
[sw3-Ethernet0/0/2]q
[sw3]
Aug 24 2023 11:29:08-08:00 sw3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 7, the c
hange loop count is 0, and the maximum number of records is 4095.	
[sw3]port-g	
[sw3]port-group g	
[sw3]port-group group-member g	
[sw3]port-group group-member GigabitEthernet 0/0/1 to g	
[sw3]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2
[sw3-port-group]port link
Aug 24 2023 11:29:48-08:00 sw3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 8, the c
hange loop count is 0, and the maximum number of records is 4095.	
[sw3-port-group]port link-t	
[sw3-port-group]port link-type t	
[sw3-port-group]port link-type trunk 
[sw3-GigabitEthernet0/0/1]port link-type trunk 
[sw3-GigabitEthernet0/0/2]port link-type trunk 
[sw3-port-group]port 
Aug 24 2023 11:30:08-08:00 sw3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 10, the 
change loop count is 0, and the maximum number of records is 4095.tr	
[sw3-port-group]port trunk all	
[sw3-port-group]port trunk allow-pass vlan 2
[sw3-GigabitEthernet0/0/1]port trunk allow-pass vlan 2
[sw3-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
[sw3-port-group]
Aug 24 2023 11:30:28-08:00 sw3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 12, the 
change loop count is 0, and the maximum number of records is 4095.
[sw3-port-group]
The device is running!

<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys sw4
[sw4]vlan 2
Aug 24 2023 11:31:28-08:00 sw4 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 4, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw4-vlan2]q
[sw4]int	
[sw4]interface e	
[sw4]interface Eth
Aug 24 2023 11:31:38-08:00 sw4 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 5, the c
hange loop count is 0, and the maximum number of records is 4095.0/0/2	
[sw4]interface Eth0/0/2
[sw4-Ethernet0/0/2]p l a  //敲代码时可以这样简写port link-type access
[sw4-Ethernet0/0/2]
Aug 24 2023 11:31:58-08:00 sw4 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 6, the c
hange loop count is 0, and the maximum number of records is 4095.	
[sw4-Ethernet0/0/2]p d vlan 2  //简写port default vlan 2
[sw4-Ethernet0/0/2]q
[sw4]po
Aug 24 2023 11:32:18-08:00 sw4 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 7, the c
hange loop count is 0, and the maximum number of records is 4095.rt-	
[sw4]port-g	
[sw4]port-group g	
[sw4]port-group group-member g	
[sw4]port-group group-member GigabitEthernet 0/0/1 to g	
[sw4]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2
[sw4-port-group]
Aug 24 2023 11:32:58-08:00 sw4 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 8, the c
hange loop count is 0, and the maximum number of records is 4095.port link-t	
[sw4-port-group]port link-type tr	
[sw4-port-group]port link-type trunk 
[sw4-GigabitEthernet0/0/1]port link-type trunk 
[sw4-GigabitEthernet0/0/2]port link-type trunk 
[sw4-port-group]port
Aug 24 2023 11:33:28-08:00 sw4 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 10, the 
change loop count is 0, and the maximum number of records is 4095. trunk all	
[sw4-port-group]port trunk allow-pass vlan 2
[sw4-GigabitEthernet0/0/1]port trunk allow-pass vlan 2
[sw4-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
[sw4-port-group]

STP

[sw3]display stp brief
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               DESI  FORWARDING      NONE
   0    Ethernet0/0/2               DESI  FORWARDING      NONE
   0    GigabitEthernet0/0/1        DESI  FORWARDING      NONE
   0    GigabitEthernet0/0/2        DESI  DISCARDING      NONE
//Role全DESI为根
[sw1]stp mode mstp
[sw1]stp enable
[sw1]stp region-configuration
[sw1-mst-region]region-name a
[sw1-mst-region]instance 1 vlan 1
[sw1-mst-region]instance 2 vlan 2
[sw1-mst-region]active region-configuration

[sw1]stp instance 1 root primary
[sw1]stp instance 2 root secondary  //按要求1,2互为备份
[sw2]stp mode mstp
[sw2]stp enable
[sw2]stp region-configuration
[sw2-mst-region]region-name a
[sw2-mst-region]instance 1 vlan 1
[sw2-mst-region]instance 2 vlan 2
[sw2-mst-region]active region-configuration

[sw2]stp instance 1 root s
[sw2]stp instance 2 root primary  //按要求1,2互为备份
[sw3]stp mode mstp
[sw3]stp enable
[sw1]stp region-configuration
[sw3-mst-region]region-name a
[sw3-mst-region]instance 1 vlan 1
[sw3-mst-region]instance 2 vlan 2
[sw3-mst-region]active region-configuration

[sw3]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/2
[sw3-port-group]stp edged-port enable
[sw4]stp mode mstp
[sw4]stp enable
[sw4]stp region-configuration
[sw4-mst-region]region-name a
[sw4-mst-region]instance 1 vlan 1
[sw4-mst-region]instance 2 vlan 2
[sw4-mst-region]active region-configuration

[sw4]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/2
[sw4-port-group]stp edged-port enable

SVI

[sw1]interface vlan 1
[sw1-Vlanif1]ip ad 172.16.1.1 25
[sw1]interface vlan 2
[sw1-Vlanif2]ip ad 172.16.1.129 25
[sw2]interface vlan 1
[sw2-Vlanif1]ip ad 172.16.1.2 25
[sw2]interface vlan 2
[sw2-Vlanif2]ip ad 172.16.1.130 25

VRRP

[sw1]interface vlan 1
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[sw1-Vlanif1]vrrp vrid 1 priority 120
[sw1-Vlanif1]vrrp vrid 1 track interface GigabitEthernet 0/0/1 reduced 30
[sw1]interface vlan 2
[sw1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
[sw2]interface vlan 1
[sw2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[sw2]interface vlan 2
[sw2-Vlanif2]vrrp vrid 1 vir
[sw2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
[sw2-Vlanif2]vrrp vrid 1 priority 120
[sw2-Vlanif2]vrrp vrid 1 track interface GigabitEthernet 0/0/1 reduced 30

DHCP

[sw1]dhcp enable
[sw1]ip pool v1
[sw1-ip-pool-v1]network 172.16.1.0 mask 25
[sw1-ip-pool-v1]gateway-list 172.16.1.126
[sw1-ip-pool-v1]dns-list 114.114.114.114 8.8.8.8
[sw1]ip pool v2
[sw1-ip-pool-v1]network 172.16.1.128 mask 25
[sw1-ip-pool-v1]gateway-list 172.16.1.254
[sw1-ip-pool-v1]dns-list 114.114.114.114 8.8.8.8
[sw1]int vlan 1
[sw1-Vlanif1]dhcp select global
[sw1-Vlanif1]int vlan 2
[sw1-Vlanif2]dhcp select global
[sw2]dhcp enable
[sw2]ip pool v1
[sw2-ip-pool-v1]network 172.16.1.0 mask 25
[sw2-ip-pool-v1]gateway-list 172.16.1.126
[sw2-ip-pool-v1]dns-list 114.114.114.114 8.8.8.8
[sw2]ip pool v2
[sw2-ip-pool-v1]network 172.16.1.128 mask 25
[sw2-ip-pool-v1]gateway-list 172.16.1.254
[sw2-ip-pool-v1]dns-list 114.114.114.114 8.8.8.8
[sw2]int vlan 1
[sw2-Vlanif1]dhcp select global
[sw2-Vlanif1]int vlan 2
[sw2-Vlanif2]dhcp select global

 

四、实验检测

PC端ip

 svi连通

 vrrp

 

 网络连通

 

 

 自此,实验结束,感谢观看

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值