实验要求如下:
1、拓扑设计
2、在LSW1和LSW2间进行Eth-trunk配置
[SW1]int Eth-Trunk 0
[SW1-Eth-Trunk0]int g0/0/2
[SW1-GigabitEthernet0/0/2]eth-trunk 0
[SW1-GigabitEthernet0/0/2]int g0/0/3
[SW1-GigabitEthernet0/0/3]eth-trunk 0
[SW2]int Eth-Trunk 0
[SW2-Eth-Trunk0]int g0/0/2
[SW2-GigabitEthernet0/0/2]eth-trunk 0
[SW2-Eth-Trunk0]int g0/0/3
[SW2-GigabitEthernet0/0/3]eth-trunk 0
3、对所有交换机创建VLAN,划分VLAN和配置Trunk干道
[SW1]vlan 2
[SW1]port-group group-member g0/0/4 to g0/0/5 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/4 to g0/0/5 Eth-Trunk 0
[SW2-port-group]port link-type trunk
[SW2-port-group]port trunk allow-pass vlan 2
[SW3]vlan 2
[SW3]int e0/0/4
[SW3-Ethernet0/0/4]port link-type access
[SW3-Ethernet0/0/4]port default vlan 2
[SW3]port-group group-member e0/0/1 to e0/0/2
[SW3-port-group]port link-type trunk
[SW3-port-group]port trunk allow-pass vlan 2
[SW4]vlan 2
[SW4]int e0/0/4
[SW4-Ethernet0/0/4]port link-type access
[SW4-Ethernet0/0/4]port default vlan 2
[SW4-Ethernet0/0/4]q
[SW4]port-group group-member e0/0/1 to e0/0/2
[SW4-port-group]port link-type trunk
[SW4-port-group]port trunk allow-pass vlan 2
4、配置STP
[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]stp instance 2 root secondary
[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]stp instance 2 root primary
[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 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
5、配置SVI
[SW1]interface vlan 1
[SW1-Vlanif1]ip address 172.16.1.1 25
[SW1]interface vlan 2
[SW1-Vlanif2]ip address 172.16.1.129 25
[SW2]interface vlan 1
[SW2-Vlanif1]ip address 172.16.1.2 25
[SW2]interface vlan 2
[SW2-Vlanif2]ip address 172.16.1.130 25
6、配置VRRP
[SW1]interface vlan 1
[SW1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[SW1-Vlanif1]vrrp vrid 1 priority 105
[SW1-Vlanif1]vrrp vrid 1 track int g0/0/1 reduced 10
[SW1]int vlan 2
[SW1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
[SW2]int vlan 2
[SW2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
[SW2-Vlanif2]vrrp vrid 1 priority 105
[SW2-Vlanif2]vrrp vrid 1 track interface g0/0/1 reduced 10
[SW2]int vlan 1
[SW2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
7、配置DHCP
[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 8.8.8.8
[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 8.8.8.8
[SW1]int vlan 1
[SW1-Vlanif1]dhcp select global
[SW1-Vlanif1]int vlan 2
[SW1-Vlanif2]dhcp select global
SW2配置同上
8、配置路由器和交换机上
1)配置链路IP
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
[R1-GigabitEthernet0/0/0]int lo0
[R1-LoopBack0]ip address 1.1.1.1 24
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip address 172.16.0.1 30
[R2-GigabitEthernet0/0/1]int g0/0/2
[R2-GigabitEthernet0/0/2]ip address 172.16.0.5 30
[SW1]vlan 10
[SW1-vlan10]int g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 10
[SW1]int vlan 10
[SW1-Vlanif10]ip address 172.16.0.2 30
[SW2]vlan 10
[SW2-vlan10]int g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type access
[SW2-GigabitEthernet0/0/1]port default vlan 10
[SW2]int vlan 10
[SW2-Vlanif10]ip address 172.16.0.6 30
2)配置ospf
[R2]ospf 1 router-id 1.1.1.1
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 172.16.0.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.0.5 0.0.0.0
[SW1]ospf 1 router-id 2.2.2.2
[SW1-ospf-1]area 0
[SW1-ospf-1-area-0.0.0.0]network 172.16.0.2 0.0.0.0
[SW1-ospf-1]area 1
[SW1-ospf-1-area-0.0.0.1]network 172.16.1.1 0.0.0.0
[SW1-ospf-1-area-0.0.0.1]network 172.16.1.129 0.0.0.0
[SW2]ospf 1 router-id 3.3.3.3
[SW2-ospf-1]area 0
[SW2-ospf-1-area-0.0.0.0]network 172.16.0.6 0.0.0.0
[SW2-ospf-1]area 1
[SW2-ospf-1-area-0.0.0.1]network 172.16.1.2 0.0.0.0
[SW2-ospf-1-area-0.0.0.1]network 172.16.1.130 0.0.0.0
3)汇总
[SW1]ospf 1
[SW1-ospf-1]area 1
[SW1-ospf-1-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0
[SW2]ospf 1
[SW2-ospf-1]area 1
[SW2-ospf-1-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0
4)R2上配置缺省,NAT
[R2]ip route-static 0.0.0.0 0.0.0.0 12.1.1.1
[R2]ospf 1
[R2-ospf-1]default-route-advertise
[R2]acl 2000
[R2-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R2-acl-basic-2000]int g0/0/0
[R2-GigabitEthernet0/0/0]nat outbound 2000
5)在SW1,SW2上配置沉默接口(因为SVI接口每隔10s会给每个Trunk干道发送hello包,如果数量过多,就会影响到干道,因此需要沉默接口)
[SW1]ospf 1
[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 10
[SW2]ospf 1
[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 10
实验到此结束
验证: