实验环境

实验案例1_4s


实验需求:

一、设备管理

1、依据图中拓扑,为不同设备定义主机名。

2、全局关闭域名解析

3、Console和VTY线路下关闭线路超时并开启输出同步。

4、为实现安全登录,要求创建本地用户名bdqn,密码 benet,并将其调用到 console和vty线路下;要求设置特权密码benet,并要求加密存储。

5、所有交换机管理vlan为vlan1,所在网段为192.168.1.0/24,其中sw1的管理IP为192.168.1.1/24,sw2为192.168.1.2/24,sw3为192.168.1.3/24,要求能够实现远程管理。

二、交换技术

1、Trunk技术

   ▶ 所有交换机之间强制启用Trunk,并采用802.1Q进行封装。

   ▶ 全局native vlan定义为vlan10。

   ▶ 要求Trunk上只允许vlan1、10、20的数据通过。

2、VTP技术

   ▶ sw1为Server,其他交换机为client。

   ▶ vtp管理域为bdqn,密码为benet

   ▶ 全局开启vtp修剪

   ▶ 在sw1上创建vlan10/20,并要求同步

   ▶ 将不同用户接口放入相应的vlan 中。

3、STP技术

   ▶ 部署PVST,要求sw1为vlan10的root , vlan20的secondary, sw2为vlan20的root , vlan10的seco         n dary,实现负载均衡。

   ▶ 开启Portfast,加速用户接入网络接口

   ▶ 开启Uplinkfast,加速直连链路收敛

   ▶ 开启Backbonefast,加速骨干链路收敛

4、L3Switching技术

   ▶ sw1作为vlan10的主网关,vlan20的备网关,其中vlan10地址为192.168.10.252/24,vlan20地址           为 192.168.20.252/24 ; sw2作为vlan20的主网关,vlan953/24.。风关为192.168.10.254, vi192.        168.20.253/24.

   ▶ 在sw1和sw2上部署HSRP,vlan10的网关为192.168.10.254,vlan20的网关为192.168.20.254.

   ▶ 在sw1部署DHCP服务,方便不同vlan的主机接入网络,其中主dns为8.8.8.8

   ▶ 在三层交换机上开启三层路由功能,并要求vlan间主机能够互相通信

5、Ethernetchannel技术

   ▶ 为实现链路冗余并提供网络带宽,要求在汇聚层交换机之间部署L2Ethernetchannel技术。

6、Port-Security技术

   ▶ 为实现用户接入安全,要求所有用户接入接口启用端口安全技术。

   ▶ 开启地址学习,并定义最大MAC数为1.

   ▶ 定义用户违反规则为shutdown模式,并要求在30s后自动恢复

三、路由技术

1、在三层交换机sw1、sw2和R1上部署动态路由协议OSPF,并通告到骨干区域中。

2、在边缘路由器R1上部署默认路由,用于访问互联网。

四、安全策略

1、要求只允许管理员地址192.168.10.1/24能够远程访问边缘路由器R1。

2、为实现内网主机访问互联网,要求部署PAT技术。

实验步骤:

一,设备管理

sw1配置如下

IOU2(config)#hostname sw1

sw1(config)#no ip domain-lookup  

sw1(config)#line console 0

sw1(config-line)#logging synchronous  

sw1(config-line)#exec-timeout 0 0

sw1(config-line)#exit

sw1(config)#username bdqn privilege 15 password benet

sw1(config)#;onm          

sw1(config)#line console 0

sw1(config-line)#login local  

sw1(config-line)#exit

sw1(config)#enable secret benet

sw1(config)#interface vlan 1

sw1(config-if)#ip address 192.168.1.1 255.255.255.0

sw1(config-if)#no shutdown 

sw2配置如下

IOU3(config)#hostname sw2

sw2(config)#username bdqn privilege 15 password benet

sw2(config)#enable secret benet

sw2(config)#line console 0

sw2(config-line)#login local  

sw2(config-line)#exit

sw2(config)#interface vlan 1

sw2(config-if)#ip address 192.168.1.2 255.255.255.0

sw2(config-if)#no shutdown

sw3配置如下

IOU4(config)#hostname sw3

sw3(config)#interface vlan 1

sw3(config-if)#ip address 192.168.1.3 255.255.255.0

sw3(config-if)#no shutdown

Trunk技术

sw1配置如下

sw1(config)#interface range ethernet 0/0-2

sw1(config-if-range)#switchport trunk encapsulation dot1q  

sw1(config-if-range)#switchport mode trunk  

sw1(config-if-range)#switchport trunk native vlan 10

sw1(config-if-range)#switchport trunk allowed vlan 1,10,20

sw2配置如下

sw2(config)#interface range ethernet 0/0-2

sw2(config-if-range)#switchport trunk encapsulation dot1q  

sw2(config-if-range)#switchport mode trunk  

sw2(config-if-range)#switchport trunk native vlan 10

sw2(config-if-range)#switchport trunk allowed vlan 1,10,20

sw3配置如下

sw3(config)#interface range ethernet 0/0-1

sw3(config-if-range)#switchport trunk encapsulation dot1q  

sw3(config-if-range)#switchport mode trunk  

sw3(config-if-range)#switchport trunk native vlan 10

sw3(config-if-range)#switchport trunk allowed vlan 1,10,20

使用show interface trunk命令查看 

实验案例1_ide_02

VTP技术

sw1配置如下

sw1(config)#vtp domain bdqn

sw1(config)#vtp mode server  

sw1(config)#vtp password benet

sw1(config)#vtp pruning 

sw1(config)#vlan 10,20

sw1(config-vlan)#ex

sw2配置如下

sw2(config)#vtp domain bdqn

sw2(config)#vtp mode client  

sw2(config)#vtp password benet

实验案例1_4s_03

sw3配置如下

sw3(config)#vtp domain bdqn

sw3(config)#vtp mode client  

sw3(config)#vtp password benet

STP技术

sw1配置如下

sw1(config)#spanning-tree vlan 10 root primary  

sw1(config)#spanning-tree vlan 20 root secondary 

sw1(config)#spanning-tree backbonefast 

sw2配置如下

sw2(config)#spanning-tree vlan 10 root secondary  

sw2(config)#spanning-tree vlan 20 root primary 

sw2(config)#spanning-tree backbonefast 

sw3配置如下

sw3(config)#interface ethernet 0/3

sw3(config-if)#switchport mode access  

sw3(config-if)#switchport access vlan 10

sw3(config-if)#spanning-tree portfast edge  

sw3(config-if)#exit

sw3(config)#interface ethernet 0/2

sw3(config-if)#switchport mode access  

sw3(config-if)#switchport access vlan 20

sw3(config-if)#spanning-tree portfast edge 

sw3(config-if)#exit

sw3(config)#spanning-tree uplinkfast  

sw3(config)#spanning-tree backbonefast 

L3Switching技术

sw1配置如下

sw1(config)#interface vlan 10

sw1(config-if)#standby 10 ip 192.168.10.254

sw1(config-if)#standby 10 priority 110

sw1(config-if)#standby 10 preempt  

sw1(config-if)#no shutdown  

sw1(config-if)#ex

sw1(config)#track 100 interface ethernet 0/3 line-protocol  

sw1(config-track)#ex

sw1(config)#interface vlan 10

sw1(config-if)#standby 10 track 100 decrement 30  

sw1(config-if)#ex

sw1(config)#interface vlan 20

sw1(config-if)#standby 20 ip 192.168.20.254

sw1(config-if)#standby 20 priority 90

sw1(config-if)#standby 20 preempt  

sw1(config-if)#no shutdown 

sw1(config)#ip dhcp pool vlan10

sw1(dhcp-config)#network 192.168.10.0 /24

sw1(dhcp-config)#default-router 192.168.10.254

sw1(dhcp-config)#dns-server 8.8.8.8

sw1(dhcp-config)#ex

sw1(config)#ip dhcp pool vlan20

sw1(dhcp-config)#network 192.168.20.0 /24

sw1(dhcp-config)#default-router 192.168.20.254

sw1(dhcp-config)#dns-server 8.8.8.8

sw1(dhcp-config)#ex

sw1(config)#ip routing 

sw2配置如下

sw2(config)#interface vlan 10

sw2(config-if)#standby 10 ip 192.168.10.254

sw2(config-if)#standby 10 priority 90

sw2(config-if)#standby 10 preempt  

sw2(config-if)#ex

sw2(config)#track 100 interface ethernet 0/3 line-protocol  

sw2(config-track)#ex

sw2(config)#interface vlan 10

sw2(config-if)#no shutdown  

sw2(config-if)#ex

sw2(config)#interface vlan 20

sw2(config-if)#standby 20 ip 192.168.20.254

sw2(config-if)#standby 30 priority 110

sw2(config-if)#standby 30 preempt  

sw2(config-if)#no shutdown  

sw2(config-if)#standby 20 track 100 decrement 30

sw2(config-if)#no shutdown  

sw2(config-if)#ex

Ethernetchannel技术

sw1配置如下

sw1(config)#interface range ethernet 0/0-1

sw1(config-if-range)#channel-group 1 mode on

sw1(config-if-range)#ex

sw1(config)#interface port-channel 1

sw1(config-if)#switchport trunk encapsulation dot1q  

sw1(config-if)#switchport mode trunk  

sw1(config-if)#switchport trunk native vlan 10

sw1(config-if)#switchport trunk allowed vlan 1,10,20

sw2配置如下

sw2(config)#interface range ethernet 0/0-1

sw2(config-if-range)#channel-group 1 mode on  

sw2(config-if-range)#ex

sw2(config)#interface port-channel 1

sw2(config-if)#switchport trunk encapsulation dot1q  

sw2(config-if)#switchport mode trunk  

sw2(config-if)#switchport trunk native vlan 10

sw2(config-if)#switchport trunk allowed vlan 1,10,20

sw2(config-if)#ex

Port-Security技术

使用show standby brief 命令查看一下

实验案例1_链路_04

sw3配置如下

sw3(config)#interface range ethernet 0/2-3  

sw3(config-if-range)#switchport port-security  

sw3(config-if-range)#switchport port-security mac-address sticky

sw3(config-if-range)#switchport port-security maximum 1  

sw3(config-if-range)#switchport port-security violation shutdown  

sw3(config-if-range)#exit  

sw3(config)#errdisable recovery cause all

sw3(config)#errdisable recovery interval 30

路由技术

sw1配置如下

sw1(config)#interface ethernet 0/3

sw1(config-if)#no switchport  

sw1(config-if)#ip address 172.16.1.1 255.255.255.0

sw1(config-if)#no shutdown  

sw1(config-if)#ex

sw1(config)#router ospf 1

sw1(config-router)#router-id 3.3.3.3    

sw1(config-router)#network 172.16.1.0 0.0.0.255 area 0

sw1(config-router)#redistribute connected subnets 

sw2配置如下

sw2(config)#interface ethernet 0/3

sw2(config-if)#no switchport  

sw2(config-if)#ip address 172.16.2.1 255.255.255.0

sw2(config-if)#no shutdown  

sw2(config-if)#ex

sw2(config)#router ospf 1

sw2(config-router)#router-id 4.4.4.4

sw2(config-router)#network 172.16.2.0 0.0.0.255 area 0

sw2(config-router)#redistribute connected subnets 

iou1配置如下

IOU1(config)#interface ethernet 0/0

IOU1(config-if)#duplex full

IOU1(config-if)#ip address 172.16.1.2 255.255.255.0

IOU1(config-if)#no shutdown  

IOU1(config-if)#ex

IOU1(config)#interface ethernet 0/1

IOU1(config-if)#duplex full  

IOU1(config-if)#ip address 172.16.2.2 255.255.255.0

IOU1(config-if)#no shutdown  

IOU1(config-if)#ex

IOU1(config)#interface loopback 0

IOU1(config-if)#ip address 1.1.1.1 255.255.255.255

IOU1(config-if)#ex

IOU1(config)#router ospf 1

IOU1(config-router)#router-id 1.1.1.1

IOU1(config-router)#network 172.16.1.0 0.0.0.255 area 0

IOU1(config-router)#network 172.16.2.0 0.0.0.255 area 0

IOU1(config-router)#network 1.1.1.1 0.0.0.0 area 0

IOU1(config-router)#ex

IOU1(config)#interface ethernet 0/2

IOU1(config-if)#ip address 100.0.0.1 255.255.255.0

IOU1(config-if)#duplex full  

IOU1(config-if)#no shutdown  

IOU1(config-if)#ex

IOU1(config)#ip route 0.0.0.0 0.0.0.0 100.0.0.2

IOU1(config)#router ospf 1

IOU1(config-router)#default-information originate  

IOU1(config-router)#ex

在sw1和sw2查看路由表

实验案例1_4s_05

实验案例1_4s_06


安全策略

iou1配置如下

IOU1(config)#access-list 1 permit host 192.168.10.1    

IOU1(config)#username bdqn privilege 15 password benet

IOU1(config)#line vty 0 4

IOU1(config-line)#login local  

IOU1(config-line)#transport input telnet  

IOU1(config-line)#access-class 1 in

IOU1(config-line)#exit

IOU1(config)#ip nat inside source list 2 interface ethernet 0/2 overload  

IOU1(config)#interface ethernet 0/1

IOU1(config-if)#ip nat inside  

IOU1(config-if)#ex

IOU1(config)#interface ethernet 0/2

IOU1(config-if)#ip nat inside