配置步骤:
-----------------------------------------------------------------------------------------------
interface Eth-Trunk 0
trunkport g 0/0/1 to 0/0/2
或
interface g 0/0/1
eth-trunk 0
interface g 0/0/2
eth-trunk 0
[acc-sw1-Ethernet0/0/22]
interface Ethernet0/0/22
port link-type access
stp edged-port enable //stp边缘接口
[acc-sw1-Ethernet0/0/21]display this
interface Ethernet0/0/21
port link-type access
port default vlan 2
stp edged-port enable
[acc-sw1-GigabitEthernet0/0/1]display this
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2
[acc-sw1-GigabitEthernet0/0/2]display this
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2
[con-sw1-GigabitEthernet0/0/3]display this
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2
#
[con-sw1-GigabitEthernet0/0/4]display this
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 2
#
[con-sw1-Eth-Trunk0]display this
#
interface Eth-Trunk0
port link-type trunk
port trunk allow-pass vlan 2
stp mode mstp
stp region-configuration
region-name 3c
instance 1 vlan 1
instance 2 vlan 2
active region-configuration
// 四个交换机上述配置相同,此外汇聚层交换机上还要定义主备根
[con-sw1]
stp instance 1 root primary
stp instance 2 root secondary
[con-sw2]
stp instance 1 root secondary
stp instance 2 root primary
[con-sw1]
interface Vlanif1
ip address 192.168.1.1 255.255.255.0
interface Vlanif2
ip address 192.168.1.2 255.255.255.0
[con-sw2]
interface Vlanif1
ip address 192.168.2.1 255.255.255.0
interface Vlanif2
ip address 192.168.2.2 255.255.255.0
[con-sw1-Vlanif1]
vrrp vrid 1 virtual-ip 192.168.1.254
vrrp vrid 1 priority 120
vrrp vrid 1 track interface GigabitEthernet0/0/7 reduced 30
[con-sw1-Vlanif2]
vrrp vrid 1 virtual-ip 192.168.2.254
[con-sw2-Vlanif1]
vrrp vrid 1 virtual-ip 192.168.1.254
[con-sw2-Vlanif2]
vrrp vrid 2 virtual-ip 192.168.2.254
vrrp vrid 2 priority 120
vrrp vrid 2 track interface GigabitEthernet0/0/7 reduced 30
ip pool v1
gateway-list 192.168.1.254
network 192.168.1.0 mask 255.255.255.0
dns-list 114.114.114.114
#
ip pool v2
gateway-list 192.168.2.254
network 192.168.2.0 mask 255.255.255.0
dns-list 114.114.114.114
// con-sw1和con-sw2配置相同,可以dis curr直接copy过去
// 之后要在svi接口 dhcp select global
[con-sw1-Vlanif100]
ip address 172.16.1.1 255.255.255.0
[con-sw2-Vlanif100]
ip address 172.16.2.1 255.255.255.0
[con-sw1-GigabitEthernet0/0/7]
port link-type access
port default vlan 100
stp edged-port enable
[con-sw2-GigabitEthernet0/0/7]
port link-type access
port default vlan 100
stp edged-port enable
[core-AR1]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.1.1.1/24 up up
GigabitEthernet0/0/1 172.16.1.2/24 up up
GigabitEthernet0/0/2 172.16.2.2/24 up up
NULL0 unassigned up up(s)
[ISP]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.1.1.2/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 2.2.2.2/32 up up(s)
NULL0 unassigned up up(s)
[core-AR1-ospf-1-area-0.0.0.0]
#
area 0.0.0.0
network 172.16.1.2 0.0.0.0
network 172.16.2.2 0.0.0.0
[con-sw1-ospf-1-area-0.0.0.0]
area 0.0.0.0
network 172.16.1.1 0.0.0.0
[con-sw1-ospf-1-area-0.0.0.1]
area 0.0.0.1
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
[con-sw2-ospf-1-area-0.0.0.0]
area 0.0.0.0
network 172.16.2.1 0.0.0.0
[con-sw2-ospf-1-area-0.0.0.1]
area 0.0.0.1
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
abr-summary 192.168.0.0 255.255.0.0
// con-sw1和con-sw2配置相同
ip route-static 0.0.0.0 0 12.1.1.2
[core-AR1-ospf-1]
default-route-advertise
acl number 2000
rule 5 permit source 192.168.0.0 0.0.255.255
[core-AR1-GigabitEthernet0/0/0]
nat outbound 2000
con-sw1和con-sw2的g0/0/3和g0/0/4会一直发hello包
[con-sw1-ospf-1]silent-interface g 0/0/3