一.
2.实验要求
1、内网IP地址使用172.16.0.0/16
2.SW1和SW2之间互为备份;
3、VRRP/STP/VLAN/eth-trunk均使用;
4、所有PC均通过DHCP获取地址;
5、ISP只配置IP地址;
6、所有电脑可以正常访问ISP路由器环回
三.配置接口类型
配置3 4
[sw3]vlan batch 2 3
[sw3]int g 0/0/1
[sw3-GigabitEthernet0/0/1]port link-type access
[sw3-GigabitEthernet0/0/1]port default vlan 2
[sw3-GigabitEthernet0/0/1]int g 0/0/2
[sw3-GigabitEthernet0/0/2]port link-type access
[sw3-GigabitEthernet0/0/2]port default vlan 3
[sw3-GigabitEthernet0/0/3]port link-type trunk
[sw3-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 3
[sw3-GigabitEthernet0/0/4]port link-type trunk
[sw3-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3
[sw4]vlan batch 2 3
[sw4]int g 0/0/1
[sw4-GigabitEthernet0/0/1]p l a
[sw4-GigabitEthernet0/0/1]port default vlan 2
[sw4-GigabitEthernet0/0/2] p l a
[sw4-GigabitEthernet0/0/2]port default vlan 3
[sw4-GigabitEthernet0/0/3]port link-type trunk
[sw4-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 3
[sw4-GigabitEthernet0/0/4]port link-type trunk
[sw4-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3
配置SW2 1
[sw2]vlan batch 2 3 10 20
[sw2-GigabitEthernet0/0/3]p l t[sw2-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 3
[sw2-GigabitEthernet0/0/4]p l t
[sw2-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3
[sw2]int e 0
[sw2-Eth-Trunk0]trunkport GigabitEthernet 0/0/1 to 0/0/2
[sw2-Eth-Trunk0]p l t
[sw2-Eth-Trunk0]port trunk allow-pass vlan 2 3 10 20[sw2-GigabitEthernet0/0/5]p l a
[sw2-GigabitEthernet0/0/5]port default vlan 20
[sw1]vlan batch 2 3 10 20
[sw1-GigabitEthernet0/0/3]p l t
[sw1-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 3
[sw1-GigabitEthernet0/0/4]p l t
[sw1-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3[sw1]int e 0
[sw1-Eth-Trunk0]trunkport GigabitEthernet 0/0/1 to 0/0/2
[sw1-Eth-Trunk0]p l t
[sw1-Eth-Trunk0]port trunk allow-pass vlan 2 3 10 20
[sw1-Eth-Trunk0]in g 0/0/5[sw1-GigabitEthernet0/0/5]port link-type access
[sw1-GigabitEthernet0/0/5]port default vlan 10
配置vlanif
[sw1]interface Vlanif 2
[sw1-Vlanif2]ip add 172.16.0.1 26
[sw1-Vlanif2]int v 3
[sw1-Vlanif3]ip add 172.16.0.65 26
[sw1-Vlanif3]int v 10
[sw1-Vlanif10]ip add 172.16.0.129 26
[sw2]int v 2
[sw2-Vlanif2]ip add 172.16.0.2 26
[sw2-Vlanif2]int v 3
[sw2-Vlanif3]ip add 172.16.0.66 26
[sw2-Vlanif3]int v 20
[sw2-Vlanif20]ip add 172.16.0.193 26
配置mstp
[sw1]stp enable
[sw1]stp mode mstp
[sw1]stp region-configuration
[sw1-mst-region]region-name aa
[sw1-mst-region]instance 1 vlan 2
[sw1-mst-region]instance 2 vlan 3
[sw1-mst-region]active region-configuration
[sw1-mst-region]q
[sw1]stp instance 1 root primary
[sw1]stp instance 2 root secondary
[sw2]stp enable
[sw2]stp mode mstp
[sw2]stp region-configuration
[sw2-mst-region]region-name aa
[sw2-mst-region]instance 1 vlan 2
[sw2-mst-region]instance 2 vlan 3
[sw2-mst-region]active region-configuration
[sw2-mst-region]q
[sw2]stp instance 1 root secondary
[sw2]stp instance 2 root primary
[sw3]stp enable
[sw3]stp mode mstp
[sw3]stp region-configuration
[sw3-mst-region]region-name aa
[sw3-mst-region]instance 1 vlan 2
[sw3-mst-region]instance 2 vlan 3
[sw3-mst-region]active region-configuration
[sw4]stp enable
[sw4]stp mode mstp
[sw4]stp region-configuration
[sw4-mst-region]region-name aa
[sw4-mst-region]instance 1 vlan 2
[sw4-mst-region]instance 2 vlan 3
[sw4-mst-region]active region-configuration
开启dhcp
[sw1]dhcp enable
[sw1]ip pool aa
[sw1-ip-pool-aa]network 172.16.0.0 mask 26
[sw1-ip-pool-aa]gateway-list 172.16.0.62
[sw1-ip-pool-aa]dns-list 8.8.8.8
[sw1-ip-pool-aa]int vl 2
[sw1-Vlanif2]dhcp select global
[sw1-Vlanif2]ip pool bb
[sw1-ip-pool-bb]network 172.16.0.64 mask 26
[sw1-ip-pool-bb]gateway-list 172.16.0.126
[sw1-ip-pool-bb]dns-list 8.8.8.8
[sw1-ip-pool-bb]int v 3
[sw1-Vlanif3]dhcp select global
[sw2]dhcp enable
[sw2]ip pool aa
[sw2-ip-pool-aa]network 172.16.0.0 mask 26
[sw2-ip-pool-aa]gateway-list 172.16.0.62
[sw2-ip-pool-aa]dns-list 8.8.8.8
[sw2-ip-pool-aa]int v 2
[sw2-Vlanif2]dhcp select global
启用vrrp
[sw1]int v 2
[sw1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.0.62
[sw1-Vlanif2]vrrp vrid 1 priority 120
[sw1-Vlanif2]vrrp vrid 1 track interface g0/0/5 reduced 30
[sw1-Vlanif2]int v 3
[sw1-Vlanif3]vrrp vrid 2 virtual-ip 172.16.0.126
[sw2]int v 2
[sw2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.0.62
[sw2-Vlanif2]int v 3
[sw2-Vlanif3]vrrp vrid 2 virtual-ip 172.16.0.126
[sw2-Vlanif3]vrrp vrid 2 priority 120
[sw2-Vlanif3]vrrp vrid 2 track interface Vlanif 20 reduced 30
配置ospf
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]a 0
[r1-ospf-1-area-0.0.0.0]ne 172.16.0.128 0.0.0.63
[r1-ospf-1-area-0.0.0.0]ne 172.16.0.192 0.0.0.63
[sw1]ospf 1 r
[sw1]ospf 1 router-id 2.2.2.2
[sw1-ospf-1]a 0
[sw1-ospf-1-area-0.0.0.0]ne 172.16.0.128 0.0.0.63
[sw1-ospf-1-area-0.0.0.0]ne 172.16.0.0 0.0.0.63
[sw1-ospf-1-area-0.0.0.0]ne 172.16.0.64 0.0.0.63
令pc可以访问lsp
[r1]ip route-static 0.0.0.0 12.0.0.2
[r1-acl-basic-2000]rule permit source 172.16.0.0 0.0.0.255
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]nat outbound 2000
[r1-ospf-1]default-route-advertise
pc端