【无标题】

一、实验图及实验要求:

 

 要求:

1、内网IP地址172.16.0.0/16合理分配;
2、SW1/2之间互为备份;
3、VRRP/STP/VLAN/TRUNK均使用;
4、所有PC通过DHCP获取IP地址;
二、实验拓扑:

 

三、配置: 

isp:

 
[Huawei]sys ISP
[ISP]int l0
[ISP-LoopBack0]ip add 1.1.1.1 24
[ISP-LoopBack0]int g0/0/0
[ISP-GigabitEthernet0/0/0]ip add 12.1.1.2 24
 r1:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]
[Huawei]sys R1
[R1]
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]
[R1-GigabitEthernet0/0/2]ip add 12.1.1.1 24
Aug 21 2023 23:58:29-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 
[R1-GigabitEthernet0/0/2]
[R1-GigabitEthernet0/0/2]int g0/0/0
[R1-GigabitEthernet0/0/0]
[R1-GigabitEthernet0/0/0]ip add 172.16.0.1 30
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 172.16.0.5 30
[R1-rip-1]ver 2
[R1-rip-1]network 172.16.0.0
[R1]ip route-static 0.0.0.0 0 12.1.1.2
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 172.16.0.0 0.0.0.255
[R1-acl-basic-2000]int g0/0/2
[R1-GigabitEthernet0/0/2]nat outbound 2000

sw1:

[SW1]interface vlan 2
[SW1-Vlanif2]ip add 172.16.0.193 26
[SW1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.0.254
[SW1-Vlanif2]qu
[SW1]int vlan 100
[SW1-Vlanif100]ip address 172.16.0.2 255.255.255.252
[SW1-Vlanif100]int g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 100
[SW1-GigabitEthernet0/0/1]qu
[SW1]rip 1
[SW1-rip-1]version 2
[SW1-rip-1]network 172.16.0.0
[SW1-rip-1]qu
[SW1]ip route-static 0.0.0.0 0 172.16.0.1
[SW1]dhcp enable
[SW1]ip pool v1
[SW1-ip-pool-v1]network 172.16.0.128 mask 26
[SW1-ip-pool-v1]gateway-list 172.16.0.190
[SW1-ip-pool-v1]dns-list 8.8.8.8 
[SW1-ip-pool-v1]qu
[SW1]ip pool v2
[SW1-ip-pool-v2]network 172.16.0.192 mask 26
[SW1-ip-pool-v2]gateway-list 172.16.0.254
[SW1-ip-pool-v2]dns-list 8.8.8.8
[SW1-ip-pool-v2]qu
[SW1]int vlan 1
[SW1-Vlanif1]dhcp select global
[SW1-Vlanif1]int vlan 2
[SW1-Vlanif2]dhcp select global
[SW1-Vlanif2]sys SW1
[SW1]vlan batch 2 100
[SW1]int Eth-Trunk 0
[SW1-Eth-Trunk0]q
[SW1]int e0/0/1
[SW1-Ethernet0/0/1]eth-trunk 0 
of the trunk.
[SW1-Ethernet0/0/1]int e0/0/2
[SW1-Ethernet0/0/2]eth-trunk 0
[SW1-Ethernet0/0/2]port-group group-member Ethernet 0/0/3 Ethernet 0/0/4 Eth-Tru
nk 0
[SW1-port-group]port link-type trunk
[SW1-Ethernet0/0/3]port link-type trunk
[SW1-Ethernet0/0/4]port link-type trunk
[SW1-Eth-Trunk0]port link-type trunk
[SW1-port-group]port trunk allow-pass vlan all
[SW1-Ethernet0/0/3]port trunk allow-pass vlan all
[SW1-Ethernet0/0/4]port trunk allow-pass vlan all
[SW1-Eth-Trunk0]port trunk allow-pass vlan all
[SW1-port-group]qu
[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
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1-mst-region]qu
[SW1]stp instance 1 root primary
[SW1]stp instance 2 root secondary
[SW1]interface vlan 1 
[SW1-Vlanif1]ip add 172.16.0.129 26
[SW1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.0.190
[SW1-Vlanif1]vrrp vrid 1 priority 120
[SW1-Vlanif1]vrrp vrid 1 track interface GigabitEthernet 0/0/1 reduced 30
[SW1-Vlanif1]interface vlan 2
[SW1-Vlanif2]ip add 172.16.0.193 26
Error: The address already exists.
[SW1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.0.254
[SW1-Vlanif2]qu
[SW1]int vlan 100
[SW1-Vlanif100]ip address 172.16.0.2 255.255.255.252
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 100
[SW1-GigabitEthernet0/0/1]qu
[SW1]rip 1
[SW1-rip-1]version 2
[SW1-rip-1]network 172.16.0.0
[SW1-rip-1]qu
[SW1]ip route-static 0.0.0.0 0 172.16.0.1
[SW1]dhcp enable
[SW1]ip pool v1
[SW1-ip-pool-v1]network 172.16.0.128 mask 26
[SW1-ip-pool-v1]gateway-list 172.16.0.190
[SW1-ip-pool-v1]dns-list 8.8.8.8 
[SW1-ip-pool-v1]qu
[SW1]ip pool v2
[SW1-ip-pool-v2]network 172.16.0.192 mask 26
[SW1-ip-pool-v2]gateway-list 172.16.0.254
[SW1-ip-pool-v2]dns-list 8.8.8.8
[SW1-ip-pool-v2]qu
[SW1]int vlan 1
[SW1-Vlanif1]dhcp select global
[SW1-Vlanif1]int vlan 2
[SW1-Vlanif2]dhcp select global

sw2:

[SW2-Vlanif2]sys SW2
[SW2]vlan batch 2 100
[SW2]int e0/0/1
[SW2-Ethernet0/0/1]eth-trunk 0
Error: The trunk port does not exist.
[SW2-Ethernet0/0/1]int e0/0/2
[SW2-Ethernet0/0/2]eth-trunk 0
Error: The trunk port does not exist.
[SW2-Ethernet0/0/2]port-group group-member Ethernet 0/0/3 Ethernet 0/0/4 Eth-Tru
nk 0              
[SW2-Ethernet0/0/2]port link-type trunk
[SW2-Ethernet0/0/2]port trunk allow-pass vlan all
[SW2-Ethernet0/0/2]qu
[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 
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2-mst-region]qu
[SW2]stp instance 1 root secondary
[SW2]stp instance 2 root primary
[SW2]interface vlan 1 
[SW2-Vlanif1]ip add 172.16.0.130 26
[SW2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.0.190
[SW2-Vlanif1]interface vlan 2
[SW2-Vlanif2]ip add 172.16.0.194 26
Error: The address already exists.
[SW2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.0.254
Error: The virtual IP address already exists.
[SW2-Vlanif2]vrrp vrid 1 priority 120
[SW2-Vlanif2]vrrp vrid 1 track interface GigabitEthernet 0/0/1 reduced 30
Error: The specified interface has been tracked.
[SW2-Vlanif2]qu
[SW2]int vlan 100
[SW2-Vlanif100]ip address 172.16.0.6 255.255.255.252
Error: The address already exists.
[SW2-Vlanif100]interface GigabitEthernet0/0/1
[SW2-GigabitEthernet0/0/1]port link-type access
[SW2-GigabitEthernet0/0/1]port default vlan 100
[SW2-GigabitEthernet0/0/1]qu
[SW2]rip 1
[SW2-rip-1]version 2
[SW2-rip-1]network 172.16.0.0
[SW2-rip-1]qu
[SW2]ip route-static 0.0.0.0 0 172.16.0.5
[SW2]dhcp enable
[SW2]ip pool v1
[SW2-ip-pool-v1]network 172.16.0.128 mask 26
[SW2-ip-pool-v1]gateway-list 172.16.0.190.
[SW2-ip-pool-v1]dns-list 8.8.8.8 
[SW2-ip-pool-v1]qu
[SW2]ip pool v2
[SW2-ip-pool-v2]network 172.16.0.192 mask 26
[SW2-ip-pool-v2]gateway-list 172.16.0.254
[SW2-ip-pool-v2]dns-list 8.8.8.8
[SW2-ip-pool-v2]qu
[SW2]int vlan 1
[SW2-Vlanif1]dhcp select global
[SW2-Vlanif1]int vlan 2
[SW2-Vlanif2]dhcp select global

sw3:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys SW3
[SW3]vlan 2
[SW3-vlan2]qu
[SW3]interface e0/0/2
[SW3-Ethernet0/0/2]port link-type access
[SW3-Ethernet0/0/2]port default vlan 2
[SW3-Ethernet0/0/2]port-group group-member Ethernet 0/0/3 Ethernet 0/0/4
[SW3-port-group]port link-type trunk
[SW3-Ethernet0/0/3]port link-type trunk
[SW3-Ethernet0/0/4]port link-type trunk
[SW3-port-group]port trunk allow-pass vlan all
[SW3-Ethernet0/0/3]port trunk allow-pass vlan all
[SW3-Ethernet0/0/4]port trunk allow-pass vlan all
[SW3-port-group]qu
[SW3]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/2
[SW3-port-group]stp edged-port enable
[SW3-Ethernet0/0/1]stp edged-port enable
[SW3-Ethernet0/0/2]stp edged-port enable
[SW3-port-group]qu

sw4:

 
[SW4]vlan 2
[SW4-vlan2]qu
[SW4]interface e0/0/2
[SW4-Ethernet0/0/2]port link-type access
[SW4-Ethernet0/0/2]port default vlan 2
[SW4-Ethernet0/0/2]port-group group-member Ethernet 0/0/3 Ethernet 0/0/4
[SW4-port-group]port link-type trunk
[SW4-Ethernet0/0/3]port link-type trunk
[SW4-Ethernet0/0/4]port link-type trunk
[SW4-port-group]port trunk allow-pass vlan all
[SW4-Ethernet0/0/3]port trunk allow-pass vlan all
[SW4-Ethernet0/0/4]port trunk allow-pass vlan all
[SW4-port-group]qu
[SW4]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/2
[SW4-port-group]stp edged-port enable
[SW4-Ethernet0/0/1]stp edged-port enable
[SW4-Ethernet0/0/2]stp edged-port enable
[SW4-port-group]qu

结果:

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值