题目:
我的拓扑图:
1、创建Eth-Trunk将多个接口逻辑的整合为一个接口,实现带宽的叠加
[sw1]interface Eth-Trunk 0
[sw1-GigabitEthernet0/0/4]eth-trunk 0
[sw1-GigabitEthernet0/0/5]eth-trunk 0
[sw2]interface Eth-Trunk 0
[sw2-GigabitEthernet0/0/4]eth-trunk 0
[sw2-GigabitEthernet0/0/5]eth-trunk 0
2、创建Trunk干道和vlan
[sw1]vlan 2
[sw1]port-group group-member g0/0/2 to g0/0/3 Eth-Trunk 0
[sw1-port-group]port link-type trunk
[sw1-port-group]port trunk allow-pass vlan 2
[sw2]vlan 2
[sw2]port-group group-member g0/0/2 to g0/0/3 Eth-Trunk 0
[sw2-port-group]port link-type trunk
[sw2-port-group]port trunk allow-pass vlan 2
[sw3]vlan 2
[sw3-Ethernet0/0/1]port link-type access
[sw3-Ethernet0/0/1]port default vlan 1
[sw3-Ethernet0/0/2]port link-type access
[sw3-Ethernet0/0/2]port default vlan 2
[sw4]vlan 2
[sw4-Ethernet0/0/1]port link-type access
[sw4-Ethernet0/0/1]port default vlan 1
[sw4-Ethernet0/0/2]port link-type access
[sw4-Ethernet0/0/2]port default vlan 2
3、启用MSTP生成树
[sw1]stp mode mstp
[sw1]stp enable
[sw1]stp region-configuration
[sw1-mst-region]region-name a
[sw1-mst-region]instance 1 vlan 1
[sw1-mst-region]instance 2 vlan 2
[sw1-mst-region]active region-configuration
[sw1]stp instance 1 root primary //让sw1成为组1的根网桥
[sw1]stp instance 2 root secondary //让sw1成为组2的备份根网桥
[sw2]stp mode mstp
[sw2]stp enable
[sw2]stp region-configuration
[sw2-mst-region]region-name a
[sw2-mst-region]instance 1 vlan 1
[sw2-mst-region]instance 2 vlan 2
[sw2-mst-region]active region-configuration
[sw2]stp instance 1 root secondary //让sw2成为组1的备份根网桥
[sw2]stp instance 2 root primary //让sw2成为组2的根网桥
[sw3]stp mode mstp
[sw3]stp enable
[sw3]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
[sw4]stp mode mstp
[sw4]stp enable
[sw4]stp region-configuration
[sw4-mst-region]region-name a
[sw4-mst-region]instance 1 vlan 1
[sw4-mst-region]instance 2 vlan 2
[sw4-mst-region]active region-configuration
4、创建SVI
[sw1]interface Vlanif 1
[sw1-Vlanif1]ip address 172.16.1.1 25
[sw1]interface Vlanif 2
[sw1-Vlanif2]ip address 172.16.1.129 25
[sw2]interface Vlanif 1
[sw2-Vlanif1]ip address 172.16.1.2 25
[sw2]interface Vlanif 2
[sw2-Vlanif2]ip address 172.16.1.130 25
5、启用VRRP
[sw1]interface Vlanif 1
[sw1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.3
[sw1-Vlanif2]vrrp vrid 1 priority 120
[sw1-Vlanif2]vrrp vrid 1 track interface g0/0/1 reduced 30
[sw1]interface Vlanif 2
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.131
[sw2]interface Vlanif 1
[sw2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.3
[sw2]interface Vlanif 2
[sw2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.131
[sw2-Vlanif2]vrrp vrid 1 priority 120
[sw2-Vlanif2]vrrp vrid 1 track interface g0/0/1 reduced 30
6、创建DHCP
[sw1]ip pool v1
[sw1-ip-pool-v1]network 172.16.1.0 mask 25
[sw1-ip-pool-v1]gateway-list 172.16.1.3
[sw1-ip-pool-v1]dns-list 8.8.8.8
[sw1]interface Vlanif 1
[sw1-Vlanif1]dhcp select global
[sw2]ip pool v2
[sw2-ip-pool-v2]network 172.16.1.128 mask 25
[sw2-ip-pool-v2]gateway-list 172.16.1.131
[sw2-ip-pool-v2]dns-list 114.114.114.114
[sw2]interface Vlanif 2
[sw2-Vlanif2]dhcp select global
检测是否成功
7、三层配置
[sw1]vlan 100
[sw1]interface Vlanif 100
[sw1-Vlanif100]ip address 172.16.0.1 30
[sw1-GigabitEthernet0/0/1]port link-type access
[sw1-GigabitEthernet0/0/1]port default vlan
[sw2]vlan 100
[sw2]interface Vlanif 100
[sw2-Vlanif100]ip address 172.16.0.5 30
[sw2]interface g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type access
[sw2-GigabitEthernet0/0/1]port default vlan 100
8、启用ospf协议
[sw1]ospf 1 rou
[sw1]ospf 1 router-id 11.11.11.11
[sw1-ospf-1]area 0
[sw1-ospf-1-area-0.0.0.0]network 172.16.0.1 0.0.0.0
[sw1-ospf-1]area 1
[sw1-ospf-1-area-0.0.0.1]network 172.16.1.0 0.0.0.255
[sw2]ospf 1 router-id 2.2.2.2
[sw2-ospf-1]area 0
[sw2-ospf-1-area-0.0.0.0]network 172.16.0.5 0.0.0.0
[sw2-ospf-1]area 1
[sw2-ospf-1-area-0.0.0.1]network 172.16.1.0 0.0.0.255
[R1]ospf 1 router-id 1.1.1.1
[R-ospf-1]area 0
[R-ospf-1-area-0.0.0.0]network 172.16.0.2 0.0.0.0
[R-ospf-1-area-0.0.0.0]network 172.16.0.6 0.0.0.0
9、开启静默接口
//打开所有静默接口
[sw1-ospf-1]silent-interface all
//关闭需要通过的静默接口
[sw1-ospf-1]undo silent-interface GigabitEthernet 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 100
//打开所有静默接口
[sw2-ospf-1]silent-interface all
//关闭需要通过的静默接口
[sw2-ospf-1]undo silent-interface GigabitEthernet 0/0/1
[sw2-ospf-1]undo silent-interface Eth-Trunk 0
[sw2-ospf-1]undo silent-interface Vlanif 1
[sw2-ospf-1]undo silent-interface Vlanif 100
10、制定规则,访问外网
[R1]ip route-static 0.0.0.0 0 12.1.1.2 //缺省指向外网
[R1-ospf-1]default-route-advertise //下放缺省
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255 //创建acl
[R1]interface g0/0/0 //调用acl规则
[R1-GigabitEthernet0/0/0]nat outbound 2000
11、最终结果测试
1)关闭sw1可以正常上网
2)关闭sw2可也正常上网
其余测试省略!