配置VLAN,VTP,及交换机的端口安全性

 

实验目的:1、掌握VLAN的配置方法,理解VLAN的含义。

2
、理解VTP的工作原理,会配置VTP


3
、会配置交换机端口安全性。

实验设备:CISCO2950交换机三台,PC两台,网线若干。
实验内容:
1、按上图将交换机和PC连接好。
Sw1 port1 ~ sw2 port1
Sw1 port2 ~ sw3 port1
Sw2 port2 ~ sw3 port2
PC1 ~sw1 port 3
PC2 ~sw3 port 3
将三台交换机分别命名为SW1SW2SW3Pc1:ip—192.168.1.4/24
Pc2:ip—192.168.3.5/24
2、查看端口转发模式
Switch#show port system
3、将交换机间互联的端口模式设置trunk.
语法为:switch(config-if)#switchport mode trunk
4、配置三台交换机的console vty密码cisco.
5、配置vtp域名为founder,sw1 的模式为server,sw2sw3的模式为client.配置修剪。
语法为:switch#vlan database

Switch(vlan)#vtp domain domain-name


Switch(vlan)#vtp client|transparent|server


Switch(vlan)#vtp pruning

6、SW1上配置vlan2vlan3。并将Sw1Port3~port10加入Vlan2
语法为:switch(config-if)#switchport mode access


Switch(config-if)#swtichport access vlan number

SW3上的port3~port5加入Vlan3
7、设置vlan 管理ip及网关 vlan1—192.168.2.2/24,网关:192.168.2.1
语法为:switch(config)#interface vlan number

Switch(config-if)#ip address ip netmask


Switch(config-if)#no shutdown


Switch(config)#ip default-gateway ipaddress

8、验证配置。
Switch#Show vtp status
Swtich#Show vlan
9、配置端口安全性。设置Sw1port3端口最大MAC地址数为50
限制Sw1上的port三端口的Pc1 mac地址只有port1port2可以访问。设置sw3上的port3端口为保护的。
配置语法:
Switch(config-if)#switchport port-security maxmum number
Switch(config)# mac-address-table restricted static
{mac-address type module/port src-if-list}

例如:switch(config)#mac-address-table restricted static 002d.0124.0254 f0/1 f0/2
//
限制f0/1端口的mac 002d.0124.0254只有f0/2端口可以访问。

Switch(config-if)#switchport port-security

violation protect|restrict|shutdown
10、
启动http访问
语法:switch(config)#ip http server//启动http访问

Switch(config)#ip http port number //
指定端口