第一步:配置接入交换机
LSW3: [sw3]vlan batch 2 3 20 30 interface GigabitEthernet0/0/1 port link-type access port default vlan 2 interface GigabitEthernet0/0/2 port link-type access port default vlan 3 interface GigabitEthernet0/0/3 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 2 to 3 20 30 interface GigabitEthernet0/0/4 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 2 to 3 20 30 LSW4: [sw4]vlan batch 2 3 20 30 interface GigabitEthernet0/0/1 port link-type access port default vlan 20 interface GigabitEthernet0/0/2 port link-type access port default vlan 30 interface GigabitEthernet0/0/3 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 2 to 3 20 30 interface GigabitEthernet0/0/4 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 2 to 3 20 30LSW3:
LSW4:
第二步:配置汇聚层
LSW1: [sw1]vlan batch 2 3 20 30 interface GigabitEthernet0/0/3 port link-type trunk port trunk allow-pass vlan 2 to 3 20 30 interface GigabitEthernet0/0/4 port link-type trunk port trunk allow-pass vlan 2 to 3 20 30 将0/0/1和0/0/2接口链路聚合 [sw1-Eth-Trunk0]trunkport GigabitEthernet 0/0/1 to 0/0/2 interface Eth-Trunk0 port link-type trunk port trunk allow-pass vlan 2 to 3 20 30 300 LSW2: [sw2]vlan batch 2 3 20 30 interface GigabitEthernet0/0/3 port link-type trunk port trunk allow-pass vlan 2 to 3 20 30 interface GigabitEthernet0/0/4 port link-type trunk port trunk allow-pass vlan 2 to 3 20 30 将0/0/1和0/0/2接口链路聚合 [sw2-Eth-Trunk0]trunkport GigabitEthernet 0/0/1 to 0/0/2 interface Eth-Trunk0 port link-type trunk port trunk allow-pass vlan 2 to 3 20 30 300第三步:创建VLANIF并配置VRRP
LSW1: interface Vlanif2 ip address 10.0.2.253 255.255.255.0 vrrp vrid 2 virtual-ip 10.0.2.254 vrrp vrid 2 priority 120 vrrp vrid 2 preempt-mode timer delay 20 vrrp vrid 2 track interface GigabitEthernet0/0/5 reduced 30 dhcp select global interface Vlanif3 ip address 10.0.3.253 255.255.255.0 vrrp vrid 3 virtual-ip 10.0.3.254 vrrp vrid 3 priority 120 vrrp vrid 3 preempt-mode timer delay 20 vrrp vrid 3 track interface GigabitEthernet0/0/5 reduced 30 dhcp select global interface Vlanif20 ip address 10.0.20.252 255.255.255.0 vrrp vrid 20 virtual-ip 10.0.20.254 dhcp select global interface Vlanif30 ip address 10.0.30.252 255.255.255.0 vrrp vrid 30 virtual-ip 10.0.30.254 dhcp select global LSW2: interface Vlanif2 ip address 10.0.2.252 255.255.255.0 vrrp vrid 2 virtual-ip 10.0.2.254 dhcp select global interface Vlanif3 ip address 10.0.3.252 255.255.255.0 vrrp vrid 3 virtual-ip 10.0.3.254 dhcp select global interface Vlanif20 ip address 10.0.20.253 255.255.255.0 vrrp vrid 20 virtual-ip 10.0.20.254 vrrp vrid 20 priority 120 vrrp vrid 20 preempt-mode timer delay 20 vrrp vrid 20 track interface GigabitEthernet0/0/5 reduced 30 dhcp select global interface Vlanif30 ip address 10.0.30.253 255.255.255.0 vrrp vrid 30 virtual-ip 10.0.30.254 vrrp vrid 30 priority 120 vrrp vrid 30 preempt-mode timer delay 20 vrrp vrid 30 track interface GigabitEthernet0/0/5 reduced 30 dhcp select global第四步:配置MSTP
LSW1: stp region-configuration region-name HCIP instance 1 vlan 2 to 3 instance 2 vlan 20 30 active region-configuration [sw1]stp instance 0 root primary [sw1]stp instance 1 root primary [sw1]stp instance 2 root secondary LSW2: stp region-configuration region-name HCIP instance 1 vlan 2 to 3 instance 2 vlan 20 30 active region-configuration [sw2]stp instance 2 root primary [sw2]stp instance 1 root secondary [sw2]stp instance 0 root secondary LSW3: stp region-configuration region-name HCIP instance 1 vlan 2 to 3 instance 2 vlan 20 30 active region-configuration LSW4: stp region-configuration region-name HCIP instance 1 vlan 2 to 3 instance 2 vlan 20 30 active region-configuration第五步:配置汇聚层上层接口
[sw1]vlan 100 interface GigabitEthernet0/0/5 port link-type access port default vlan 100 interface Vlanif100 ip address 10.0.0.1 255.255.255.252 [sw1]vlan 300 interface Vlanif300 ip address 10.0.0.9 255.255.255.252 [sw2]vlan 200 interface GigabitEthernet0/0/5 port link-type access port default vlan 200 interface Vlanif200 ip address 10.0.0.5 255.255.255.252 [sw2]vlan 300 interface Vlanif300 ip address 10.0.0.10 255.255.255.252第六步:配置DHCP
LSW1: [sw1]dhcp enable ip pool vlan2 gateway-list 10.0.2.254 network 10.0.2.0 mask 255.255.255.0 excluded-ip-address 10.0.2.1 10.0.2.128 dns-list 8.8.8.8 [sw1-Vlanif2]dhcp select global ip pool vlan3 gateway-list 10.0.3.254 network 10.0.3.0 mask 255.255.255.0 excluded-ip-address 10.0.3.1 10.0.3.128 dns-list 8.8.8.8 [sw1-Vlanif3]dhcp select global ip pool vlan20 gateway-list 10.0.20.254 network 10.0.20.0 mask 255.255.255.0 excluded-ip-address 10.0.20.129 10.0.20.253 dns-list 8.8.8.8 [sw1-Vlanif20]dhcp select global ip pool vlan30 gateway-list 10.0.30.254 network 10.0.30.0 mask 255.255.255.0 excluded-ip-address 10.0.30.129 10.0.30.253 dns-list 8.8.8.8 [sw1-Vlanif30]dhcp select global LSW2: [sw2]dhcp enable ip pool vlan2 gateway-list 10.0.2.254 network 10.0.2.0 mask 255.255.255.0 excluded-ip-address 10.0.2.129 10.0.2.253 dns-list 8.8.8.8 [sw2]dhcp select global ip pool vlan3 gateway-list 10.0.3.254 network 10.0.3.0 mask 255.255.255.0 excluded-ip-address 10.0.3.129 10.0.3.253 dns-list 8.8.8.8 [sw2-Vlanif3]dhcp select global ip pool vlan20 gateway-list 10.0.20.254 network 10.0.20.0 mask 255.255.255.0 excluded-ip-address 10.0.20.1 10.0.20.128 dns-list 8.8.8.8 [sw2-Vlanif20]dhcp select global ip pool vlan30 gateway-list 10.0.30.254 network 10.0.30.0 mask 255.255.255.0 excluded-ip-address 10.0.30.1 10.0.30.128 dns-list 8.8.8.8 [sw2-Vlanif30]dhcp select global第七步:配置路由器接口的ip
r1: Interface IP Address/Mask Physical Protocol GigabitEthernet0/0/0 202.1.1.1/30 up up GigabitEthernet0/0/1 10.0.0.2/30 up up GigabitEthernet0/0/2 10.0.0.6/30 up up ISP: GigabitEthernet0/0/0 202.1.1.2/30 up up LoopBack0 100.100.100.100/24 up up(s)第八步:配置RIP
LSW1: rip 1 version 2 network 10.0.0.0 silent-interface Vlanif2 silent-interface Vlanif3 silent-interface Vlanif20 silent-interface Vlanif30 LSW2: rip 1 version 2 network 10.0.0.0 silent-interface Vlanif2 silent-interface Vlanif3 silent-interface Vlanif20 silent-interface Vlanif30 r1: rip 1 default-route originate version 2 network 10.0.0.0第九步:用NAT将源IP从私网地址转化为公网地址并用ACL抓取流量
r1: [r1]ip route-static 0.0.0.0 0 202.1.1.2 [r1]acl 2000 [r1-acl-basic-2000]rule permit source 10.0.2.0 0.0.0.255 [r1-acl-basic-2000]rule permit source 10.0.3.0 0.0.0.255 [r1-acl-basic-2000]rule permit source 10.0.20.0 0.0.0.255 [r1-acl-basic-2000]rule permit source 10.0.30.0 0.0.0.255 [r1]int g 0/0/0 [r1-GigabitEthernet0/0/0]nat outbound 2000第十步:调试