1、实验要求:
2、实验拓扑
3、分析过程
1、创建eth-trunk,VLAN
2、将接口划入对应的VLAN
3、trunk干道
4、选择生成树类型并定义事件
5、对生成树进行干预,达到实验最优根
6、配置svi接口
7、VRRP配置
8、dhcp
4、配置内容
1、创建eth-trunk,VLAN
2、将接口划入对应的VLAN
3、trunk干道
4、选择生成树类型并定义事件
[sw1]stp enable
[sw1]stp mode mstp
[sw1]stp region-configuration
[sw1-mst-region]region-name a
[sw1-mst-region]instance 1 vlan 1 --定义事件1
[sw1-mst-region]instance 2 vlan 2 --定义事件2
[sw1-mst-region]active region-configuration
[sw1-mst-region]q
[sw1]stp instance 1 root primary --定义事件1的主根
[sw1]stp instance 2 root secondary --定义事件2的备用根
5、对生成树进行干预,达到实验最优根
[sw1]stp instance 1 root primary --定义事件1的主根
[sw1]stp instance 2 root secondary --定义事件2的备用根
6、配置svi接口
[sw1]int vlan1
[sw1-Vlanif1]ip add 172.16.1.1 25
[sw1-Vlanif1]q
[sw1]int vlan 2
7、VRRP配置
[sw1]int vlanif 1 --在vlanif1 vrrp
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[sw1-Vlanif1]vrrp vrid 1 priority 105
[sw1-Vlanif1]vrrp vrid 1 track interface Ethernet 0/0/1 reduced 6
[sw1-Vlanif1]q
8、dhcp
SW1(SW2与SW1相似)
[sw1]interface Eth-Trunk 0
[sw1-Eth-Trunk0]q
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]eth-t
[sw1-GigabitEthernet0/0/1]eth-trunk 0
[sw1]int g0/0/2
[sw1-GigabitEthernet0/0/2]eth-trunk 0
[sw1-GigabitEthernet0/0/2]q
[sw1]int e0/0/2
[sw1-Ethernet0/0/2]port link-type trunk
[sw1-Ethernet0/0/2]port trunk allow-pass vlan 2
[sw1-Ethernet0/0/2]q
[sw1]int e0/0/3
[sw1-Ethernet0/0/3]port link-type trunk
[sw1-Ethernet0/0/3] port trunk allow-pass vlan 2
[sw1-Ethernet0/0/3]q
[sw1]int Eth-Trunk 0
[sw1-Eth-Trunk0]port link-type trunk
[sw1-Eth-Trunk0]port trunk allow-pass vlan 2
[sw1-Eth-Trunk0]q
[sw1]stp enable
[sw1]stp mode mstp
[sw1]stp region-configuration
[sw1-mst-region]region-name a
[sw1-mst-region]instance 1 vlan 1 --- 定义事件1
[sw1-mst-region]instance 2 vlan 2 --- 定义事件2
[sw1-mst-region]active region-configuration
[sw1-mst-region]q
[sw1]stp instance 1 root primary --- 定义事件1的主根
[sw1]stp instance 2 root secondary --- 定义事件2的备用根
[sw1]int vlan 1
[sw1-Vlanif1]ip add 172.16.1.1 25
[sw1-Vlanif1]q
[sw1]int vlan 2
[sw1-Vlanif2]ip add 172.16.1.129 25
[sw1]int vlan 1 ----- 在vlanif1 vrrp
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[sw1-Vlanif1]vrrp vrid 1 priority 105
[sw1-Vlanif1]vrrp vrid 1 track interface Ethernet 0/0/1 reduced 6
[sw1-Vlanif1]q
[sw1]int vlan 2
[sw1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
[sw1-Vlanif2]q
[sw1]dhcp enable
[sw1]ip pool v1
[sw1-ip-pool-v1]network 172.16.1.0 mask 25
[sw1-ip-pool-v1]gateway-list 172.16.1.126
[sw1-ip-pool-v1]dns-list 114.114.114.114
[sw1-ip-pool-v1]q
[sw1]ip pool v2
[sw1-ip-pool-v2]network 172.16.1.128 mask 25
[sw1-ip-pool-v2]gateway-list 172.16.1.254
[sw1-ip-pool-v2]dns-list 114.114.114.114
[sw1-ip-pool-v2]q
[sw1]int vlan 1
[sw1-Vlanif1]dhcp select global
[sw1-Vlanif1]q
[sw1]int vlan 2
[sw1-Vlanif2]dhcp select global
[sw1]vlan 99
[sw1-vlan99]int vlan 99
[sw1-Vlanif99]ip add 172.16.0.2 30
[sw1-Vlanif99]q
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 99
[sw1-Ethernet0/0/1]q
[sw1]ospf 1 router-id 2.2.2.2
[sw1-ospf-1]area 0
[sw1-ospf-1-area-0.0.0.0]net 172.16.0.2 0.0.0.0
[sw1-ospf-1-area-0.0.0.0]q
[sw1-ospf-1]area 1
[sw1-ospf-1-area-0.0.0.1]net 172.16.1.1 0.0.0.0
[sw1-ospf-1-area-0.0.0.1]net 172.16.1.129 0.0.0.0
[sw1-ospf-1-area-0.0.0.1]q
[sw1-ospf-1]q
[sw1]ospf 1
[sw1-ospf-1]silent-interface all
[sw1-ospf-1]undo silent-interface Ethernet 0/0/1
[sw1-ospf-1]undo silent-interface Eth-Trunk 0
[sw1-ospf-1]undo silent-interface vlanif 1
[sw1-ospf-1]undo silent-interface vlanif 99
[sw1-ospf-1]area 1
[sw1-ospf-1-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0
[sw1-ospf-1-area-0.0.0.1]q
[sw1]ip route-static 172.16.1.0 4 NULL 0
SW3(SW4与3相似)
[sw3]vlan 2
[sw3-vlan2]q
[sw3]int e0/0/1
[sw3-Ethernet0/0/1]port link-type trunk
[sw3-Ethernet0/0/1]port trunk allow-pass vlan 2
[sw3-Ethernet0/0/1]q
[sw3]int e0/0/2
[sw3-Ethernet0/0/2]port link-type trunk
[sw3-Ethernet0/0/2]port trunk allow-pass vlan 2
[sw3-Ethernet0/0/2]q
[sw3]int e0/0/4
[sw3-Ethernet0/0/4]port link-type access
[sw3-Ethernet0/0/4]port default vlan 2
[sw3-Ethernet0/0/4]q
[sw3]stp enable --- 进入生成树
[sw3]stp mode mstp
[sw3]stp region-configuration
[sw3-mst-region]stp region-configuration
[sw3-mst-region] region-name a
[sw3-mst-region] instance 1 vlan 1
[sw3-mst-region] instance 2 vlan 2
[sw3-mst-region] active region-configuration
[sw3-mst-region]q
[sw3]int e0/0/3
[sw3-Ethernet0/0/3]stp edged-port enable
[sw3-Ethernet0/0/3]q
[sw3]int e0/0/4
[sw3-Ethernet0/0/4]stp edged-port enable
[sw3-Ethernet0/0/4]q
路由器
[r1]int g0/0/2
[r1-GigabitEthernet0/0/2]ip add 12.1.1.1 24
[r1-GigabitEthernet0/0/2]q
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 172.16.0.1 30
[r1-GigabitEthernet0/0/0]q
[r1]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 172.16.0.5 30
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]net 172.16.0.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]net 172.16.0.5 0.0.0.0
[r1]ip route-static 0.0.0.0 0 12.1.1.2
[r1]ospf 1
[r1-ospf-1]default-route-advertise --- 导入缺省
[r1-ospf-1]q
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[r1-acl-basic-2000]int g0/0/2
[r1-GigabitEthernet0/0/2]nat outbound 2000
5、结果验证
2.2.2.2为运营商的环回地址