一、实验拓扑图
二、实验步骤
应为交换机和路由器都需要配置,故先配置交换机
1、eth-trunk
2、vlan
3、stp
4、svi
5、vrrp
6、dhcp
三、实验配置命令
1、eth-trunk配置
SW1
[sw1]int Eth-tr
[sw1]int Eth-Trunk 0
[sw1-Eth-Trunk0]int e0/0/1
[sw1-Ethernet0/0/1]eth-trunk 0
[sw1-Ethernet0/0/4]eth-tr
[sw1-Ethernet0/0/4]eth-trunk 0
SW2
[sw2]int Eth-Trunk 0
[sw2-Eth-Trunk0]int e0/0/1
[sw2-Ethernet0/0/1]eth-trunk 0
[sw2-Ethernet0/0/1]int e0/0/4
[sw2-Ethernet0/0/4]eth-trunk 0
2、vlan配置
SW1
interface Eth-Trunk0
port link-type trunk
port trunk allow-pass vlan 2 to 4094
interface Ethernet0/0/2
port hybrid tagged vlan 1 to 2
interface Ethernet0/0/3
port hybrid tagged vlan 1 to 2
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
SW2
interface Eth-Trunk0
port link-type trunk
port trunk allow-pass vlan 2 to 4094
interface Ethernet0/0/2
port hybrid tagged vlan 1 to 2
interface Ethernet0/0/3
port hybrid tagged vlan 1 to 2
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
SW3
interface Ethernet0/0/1
port link-type access
interface Ethernet0/0/2
port hybrid tagged vlan 1 to 2
interface Ethernet0/0/3
port hybrid tagged vlan 1 to 2
interface Ethernet0/0/4
port link-type access
port default vlan 2
SW4
interface Ethernet0/0/1
port link-type access
interface Ethernet0/0/2
port hybrid tagged vlan 1 to 2
interface Ethernet0/0/3
port hybrid tagged vlan 1 to 2
interface Ethernet0/0/4
port link-type access
port default vlan 2
3、stp
[sw1]stp region-configuration
[sw1-mst-region]region-name haha
[sw1-mst-region]instance 1 vlan 1
[sw1-mst-region]instance 2 vlan 2
[sw1-mst-region]active region-configuration
[sw1-mst-region]q
[sw1]stp instance 1 root primary
[sw1]stp instance 2 root secondary
LSW 2
[sw2]stp region-configuration
[sw2-mst-region]region-name xixi
[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]q
[sw2]stp instance 1 root secondary
[sw2]stp instance 2 root primar
LSW3
[LSW3]stp re
[LSW3]stp region-configuration
[LSW3-mst-region]region-name ha
[LSW3-mst-region]instance 1 vlan 1
[LSW3-mst-region]instance 2 vlan 2
[LSW3-mst-region]active region-configuration
LSW4
[sw4]stp region-configuration
[sw4-mst-region]region-name xi
[sw4-mst-region]instance 1 vlan 1
[sw4-mst-region]instance 2 vlan 2
[sw4-mst-region]active region-configuration
4、svi
LSW1
[LSW1]interface vlan 1
[LSW1-Vlanif1]ip address 172.16.1.1 24
[LSW1]interface vlan 2
[LSW1-Vlanif2]ip address 172.16.2.1 24
LSW2
[LSW2]interface vlan 1
[LSW2-Vlanif1]ip address 172.16.1.2 24
LSW2]interface vlan 2
[LSW2-Vlanif2]ip address 172.16.2.2 24
5、vrrp
LSW1
[LSW1]interface vlan 1
[LSW1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.254
[LSW1-Vlanif1]vrrp vrid 1 priority 120
[LSW1-Vlanif1]vrrp vrid 1 track int g 0/0/5 reduced 20
[LSW1]interface vlan 2
[LSW1-Vlanif2]vrrp vrid 2 virtual-ip 172.16.2.254
[LSW1-Vlanif2]vrrp vrid 2 priority 120
[LSW1-Vlanif2]vrrp vrid 2 track interface GigabitEthernet 0/0/5 reduced 20
6、dhcp
LSW1
[LSW1]dhcp enable
[LSW1]ip pool ha
[LSW1-ip-pool-ha]network 172.16.1.0 mask 255.255.255.0
[LSW1-ip-pool-ha]gateway-list 172.16.1.254
[LSW1-ip-pool-ha]dns-list 114.114.114.114 8.8.8.8
[LSW1-ip-pool-ha]q
[LSW1]ip pool xi
Info:It’s successful to create an IP address pool.
[LSW1-ip-pool-xi]network 172.16.2.0 mask 255.255.255.0
[LSW1-ip-pool-xi]gateway-list 172.16.2.254
[LSW1-ip-pool-xi]dns-list 114.114.114.114 8.8.8.8
[LSW1]int v1
[LSW1-Vlanif1]dhcp select global
[LSW1-Vlanif1]int v2
[LSW1-Vlanif2]dhcp select global
LSW2
[LSW2]dhcp enable
[LSW2]ip pool haha
[LSW2-ip-pool-haha]network 172.16.1.0 mask 255.255.255.0
[LSW2-ip-pool-haha]gateway-list 172.16.1.253
[LSW2-ip-pool-haha]dns-list 114.114.114.114 8.8.8.8
[LSW2-ip-pool-haha]q
[LSW2]ip pool xixi
[LSW2-ip-pool-xixi]network 172.16.2.0 mask 255.255.255.0
[LSW2-ip-pool-xixi]gateway-list 172.16.2.253
[LSW2-ip-pool-xixi]dns-list 114.114.114.114 8.8.8.8
[LSW2-ip-pool-xixi]q
[LSW2]int v1
[LSW2-Vlanif1]dhcp select global
[LSW2-Vlanif1]int v2
[LSW2-Vlanif2]dhcp select globa