IP地址划分
192.16.0.0/24—骨干
192.16.2.0/24----VLAN1/2
172.16.3.0/24----VLAN3
配置channel
[Huawei]int Eth-Trunk 0
[Huawei-Eth-Trunk0]int g 0/0/22
[Huawei-GigabitEthernet0/0/22]eth-trunk 0
[Huawei-Eth-Trunk0]int g 0/0/23
[Huawei-GigabitEthernet0/0/23]eth-trunk 0
创建VLAN 配置接口模式
[sw1]vlan batch 2 to 3
[sw1]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2 Eth-Trunk 0
[sw1-port-group]port link-type trunk
[sw1-port-group]port trunk allow-pass vlan 1 to 3
[sw2]vlan batch 2 to 3
[sw2-port-group]port-group group-member g 0/0/1 to GigabitEthernet 0/0/2 Eth-Trunk 0
[sw2-port-group]port hybrid tagged vlan 2 to 3
[sw3]vlan ba 2 to 3
[sw3]port-g group-member g0/0/1 to g 0/0/2
[sw3-port-group]port link-type trunk
[sw3-port-group]port trunk allow-pass vlan 2 3
[sw3]int e 0/0/2
[sw3-Ethernet0/0/2]port link-type access
[sw3-Ethernet0/0/2]port default vlan 2
[sw3-Ethernet0/0/2]int e 0/0/3
[sw3-Ethernet0/0/3]port link-type access
[sw3-Ethernet0/0/3]port def vlan 3
[sw4]vlan ba 2 to 3
[sw4]port-group group-member g0/0/1 to g 0/0/2
[sw4-port-group]port hy ta vlan 2 to 4
[sw4]int e 0/0/1
[sw4-Ethernet0/0/1]port default vlan 2
[sw4-Ethernet0/0/1]int e 0/0/2
[sw4-Ethernet0/0/2]port link-type acc
[sw4-Ethernet0/0/2]port de vlan 3
配置stp(mstp)
[sw1]stp mode mstp
[sw1]stp region-configuration
[sw1-mst-region]region-name a
[sw1-mst-region]instance 1 vlan 1 to 2
[sw1-mst-region]instance 2 vlan 3
[sw1-mst-region]ac region-configuration
调节主根和备份根
[sw1]stp instance 1 root primary
[sw1]stp instan[sw2]stp instance 1 root secondary
[sw2]stp instance 1 root secondary
[sw2]stp instance 2 root p
查看
配置SVI
[sw1]int Vlanif 1
[sw1-Vlanif1]ip add 172.16.2.1 25
[sw1]int vlanif 2
[sw1-Vlanif2]ip add 172.16.2.129 25
[sw1]int Vlanif 3
[sw1-Vlanif3]ip add 172.16.3.1 24
查看
vrrp网关冗余
[sw1]int vlan 1
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.2.126
[sw1-Vlanif1]vrrp vrid 1 priority 105
[sw1-Vlanif1]vrrp vrid 1 track interface GigabitEthernet 0/0/24 reduced 10
[sw1]interface Vlanif 2
[sw1-Vlanif2] vrrp vrid 1 virtual-ip 172.16.2.254
[sw1-Vlanif2] vrrp vrid 1 priority 105
[sw1-Vlanif2] vrrp vrid 1 track interface GigabitEthernet0/0/24
[sw1-Vlanif3]int vlan 3
[sw1-Vlanif3]vrrp vrid 1 virtual-ip 172.16.3.254
[sw2]int vlan1
[sw2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.2.126
[sw2-Vlanif1]int vlan 2
[sw2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.2.254
[sw2-Vlanif2]int vlan 3
[sw2-Vlanif3]vrrp vrid 1 virtual-ip 172.16.3.254
[sw2-Vlanif3]vrrp vrid 1 priority 105
[sw2-Vlanif3]vrrp vrid 1 track interface GigabitEthernet 0/0/24 reduced 10
DHCP
ip pool v1
gateway-list 172.16.2.126
network 172.16.2.0 mask 255.255.255.128
dns-list 114.114.114.114
ip pool v2
gateway-list 172.16.2.254
network 172.16.2.128 mask 255.255.255.128
dns-list 114.144.114.114
ip pool v3
gateway-list 172.16.3.254
network 172.16.3.0 mask 255.255.255.0
dns-list 114.114.114.114
接口开启服务
[sw1]int vlan 1
[sw1-Vlanif1]dhcp select global
测试
运行路由协议
配置nat和缺省
[r1]ip route-static 0.0.0.0 0 12.1.1.2
[r1]acl 2000
[r1-acl-basic-2000]rule per sou 172.16.0.0 0.0.255.255
[r1-acl-basic-2000]q
[r1]int g 0/0/1
[r1-GigabitEthernet0/0/1]nat out 2000
测试
Telnet和nat
[sw3]aaa
[sw3-aaa]local-user ceshi password cipher huawei123
[sw3-aaa]local-user ceshi service-type telnet
[sw3-aaa]q
[sw3]user-interface vty 0 4
[sw3-ui-vty0-4]authentication-mode aaa