LSW1,LSW2:
[LS1]interface Eth-Trunk 0
[LS1-Eth-Trunk0]q
[LS1]interface g0/0/3
[LS1-GigabitEthernet0/0/3]eth-trunk 0
[LS1]interface g0/0/4
[LS1-GigabitEthernet0/0/4]eth-trunk 0
[LS2]interface Eth-Trunk 0
[LS2]interface g0/0/3
[LS2-GigabitEthernet0/0/3]eth-trunk 0
[LS2]interface g0/0/4
[LS2-GigabitEthernet0/0/4]eth-trunk 0
vlan和trunk:
[LS1]vlan batch 2 to 3
[LS1]port-group group-member g0/0/5 to g0/0/7 Eth-Trunk 0
[LS1-port-group]port link-type trunk
[LS1-port-group]port trunk allow-pass vlan all
[LS2]vlan batch 2 to 3
[LS2]port-group group-member g0/0/5 to g0/0/7 Eth-Trunk 0
[LS2-port-group]port link-type trunk
[LS2-port-group]port trunk allow-pass vlan all
[LS3]vlan batch 2 to 3
[LS3]port-group group-member g0/0/1 g0/0/2
[LS3-port-group]port link-type trunk
[LS3-port-group]port trunk allow-pass vlan all
[LS3]port-group group-member e0/0/3 e0/0/4
[LS3-port-group]port link-type access
[LS3-port-group]port default vlan 2
[LS4]vlan batch 2 to 3
[LS4]port-group group-member g0/0/1 g0/0/2
[LS4-port-group]port link-type trunk
[LS4-port-group]port trunk allow-pass vlan all
[LS4]port-group group-member e0/0/3 e0/0/4
[LS4-port-group]port link-type access
[LS4-port-group]port default vlan 3
[LS5]port-group group-member g0/0/1 g0/0/2
[LS5-port-group]port link-type trunk
[LS5-port-group]port trunk allow-pass vlan all
[LS5]port-group group-member e0/0/3 e0/0/4
[LS5-port-group]port link-type access
[LS5-port-group]port default vlan 3
STP:
[LS1]stp enable
[LS1]stp region-configuration
[LS1-mst-region]region-name a
[LS1-mst-region]instance 1 vlan 2
[LS1-mst-region]instance 2 vlan 3
[LS1-mst-region]active region-configuration
[LS2]stp enable
[LS2]stp region-configuration
[LS2-mst-region]region-name a
[LS2-mst-region]instance 1 vlan 2
[LS2-mst-region]instance 2 vlan 3
[LS3]stp enable
[LS3]stp region-configuration
[LS3-mst-region]region-name a
[LS3-mst-region]instance 1 vlan 2
[LS3-mst-region]instance 2 vlan 3
[LS4]stp enable
[LS4]stp region-configuration
[LS4-mst-region]region-name a
[LS4-mst-region]instance 1 vlan 2
[LS4-mst-region]instance 2 vlan 3
[LS5]stp enable
[LS5]stp region-configuration
[LS5-mst-region]region-name a
[LS5-mst-region]instance 1 vlan 2
[LS5-mst-region]instance 2 vlan 3
根与备份根:
[LS1]stp instance 1 root primary
[LS1]stp instance 2 root secondary
[LS2]stp instance 2 root primary
[LS2]stp instance 1 root secondary
SVI
[LS1]interface Vlanif 2
[LS1-Vlanif2]ip address 192.168.2.1 24
[LS1]interface Vlanif 3
[LS1-Vlanif3]ip address 192.168.3.1 24
[LS2]interface Vlanif 2
[LS2-Vlanif2]ip address 192.168.2.2 24
[LS2]interface Vlanif 3
[LS2-Vlanif3]ip address 192.168.3.2 24
vrrp
[LS1]interface Vlanif 2
[LS1-Vlanif2]vrrp vrid 1 virtual-ip 192.168.2.255
[LS1-Vlanif2]vrrp vrid 1 priority 120
[LS1-Vlanif2]vrrp vrid 1 track interface g0/0/24 reduced 30
[LS1]interface Vlanif 3
[LS1-Vlanif3]vrrp vrid 2 virtual-ip 192.168.3.254
[LS2]interface Vlanif 3
[LS2-Vlanif3]vrrp vrid 2 virtual-ip 192.168.3.254
[LS2-Vlanif3]vrrp vrid 2 track interface g0/0/1 reduced 30
[LS2]interface Vlanif 2
[LS2-Vlanif2]vrrp vrid 1 virtual-ip 192.168.2.254
dhcp
[LS1]dhcp enable
[LS1]ip pool v2
[LS1-ip-pool-v2]network 192.168.2.0 mask 24
[LS1-ip-pool-v2]gateway-list 192.168.2.254
[LS1]interface Vlanif 2
[LS1-Vlanif2]dhcp select global
[LS1]ip pool v3
[LS1-ip-pool-v3]network 192.168.3.0 mask 24
[LS1-ip-pool-v3]gateway-list 192.168
[LS1-ip-pool-v3]gateway-list 192.168.3.254
[LS1]interface Vlanif 3
[LS1-Vlanif3]dhcp select global
[LS2]dhcp enable
[LS2]ip pool v2
[LS2-ip-pool-v2]network 192.168.2.0 mask 24
[LS2-ip-pool-v2]gateway-list 192.168.2.254
[LS2]interface Vlanif 2
[LS2-Vlanif2]dhcp select global
[LS2]ip pool v3
[LS2-ip-pool-v3]network 192.168.3.0 mask 24
[LS2-ip-pool-v3]gateway-list 192.168.3.254
[LS2]interface Vlanif 3
[LS2-Vlanif3]dhcp select global
配置IP
[LS1]vlan 4
[LS1]interface g0/0/2
[LS1-GigabitEthernet0/0/2]port link-type access
[LS1-GigabitEthernet0/0/2]port default vlan 4
[LS1]interface Vlanif 4
[LS1-Vlanif4]ip address 192.168.0.2 30
[LS2]vlan 4
[LS2]interface g0/0/1
[LS2-GigabitEthernet0/0/1]port link-type access
[LS2-port-group-default]port default vlan 4
[LS2]interface Vlanif 4
[LS2-Vlanif4]ip address 192.168.0.6 30
R1
[R1]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.0.1 30
[R1-GigabitEthernet0/0/1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip address 192.168.0.5 30
[R1-GigabitEthernet0/0/2]int g0/0/0
[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
R2
[R2]interface LoopBack 0
[R2-LoopBack0]ip address 2.2.2.2 24
[R2]interface g0/0/1
[R2-GigabitEthernet0/0/1]ip address 12.1.1.2 24
启动ospf
[LS1]ospf 1
[LS1-ospf-1]area 0
[LS1-ospf-1-area-0.0.0.0]network 192.168.0.0 0.0.255.255
[LS2]ospf 1
[LS2-ospf-1]area 0
[LS2-ospf-1-area-0.0.0.0]network 192.168.0.0 0.0.255.255
[R1]ospf 1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 192.168.0.0 0.0.255.255
实现公网访问
[R1]ospf 1
[R1-ospf-1]default-route-advertise always
[R1]ip route-static 0.0.0.0 0 12.1.1.2
[R1]acl 200
[R1-acl-basic-2000]rule permit source 192.168.0.0 0.0.255.255
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]nat outbound 2000