网络工程训练 下载本文

实验4 跨交换机的VLAN划分

一、实验环境

在交换机 A 和交换机 B 上分别划分两个基于端口的 VLAN:VLAN100(1~8端口),VLAN200(9~16端口),Trunk口(24端口)。使得交换机之间 VLAN100 的成员能够互相访问,VLAN200 的成员能够互相访问;VLAN100 和 VLAN200 成员之间不能互相访问。 PC1 和 PC2 的网络设置为:

PC1、PC2 分别接在不同交换机 VLAN100 的成员端口 1~8 上,两台 PC 互相可以 ping 通;PC1、PC2 分别接在不同交换机 VLAN 的成员端口 9~16 上,两台 PC 互相可以 ping 通; PC1 和 PC2 接在不同 VLAN 的成员端口上则互相 ping 不通。 若实验结果和理论相符,则本实验完成。

二、实验步骤

第一步:交换机恢复出厂设置。 switch#set default switch#write switch#reload

第二步:给交换机设置标示符和管理 IP。 交换机 A:

switch(Config)#hostname switchA switchA(Config)#interface vlan 1

switchA(Config-If-Vlan1)#ip address 192.168.1.11 255.255.255.0 switchA(Config-If-Vlan1)#no shutdown switchA(Config-If-Vlan1)#exit switchA(Config)# 交换机 B:

switch(Config)#hostname switchB switchB(Config)#interface vlan 1

switchB(Config-If-Vlan1)#ip address 192.168.1.12 255.255.255.0 switchB(Config-If-Vlan1)#no shutdown switchB(Config-If-Vlan1)#exit switchB(Config)#

第三步:在交换机中创建 vlan100 和 vlan200,并添加端口。 交换机 A:

switchA(Config)#vlan 100 switchA(Config-Vlan100)#

switchA(Config-Vlan100)#switchport interface ethernet 0/0/1-8 switchA(Config-Vlan100)#exit switchA(Config)#vlan 200

switchA(Config-Vlan200)#switchport interface ethernet 0/0/9-16 switchA(Config-Vlan200)#exit switchA(Config)# switchA#show vlan 交换机 B:

配置与交换机 A 一样。

第四步:设置交换机 trunk 端口。 交换机 A:

switchA(Config)#interface ethernet 0/0/24

switchA(Config-Ethernet0/0/24)#switchport mode trunk Set the port Ethernet0/0/24 mode TRUNK successfully

switchA(Config-Ethernet0/0/24)#switchport trunk allowed vlan all set the port Ethernet0/0/24 allowed vlan successfully switchA(Config-Ethernet0/0/24)#exit switchA(Config)# switchA#show vlan 交换机 B: 配置同交换机 A

第五步:验证实验。

交换机 Aping 交换机 B: switchA#ping 192.168.1.12 Type ^c to abort.

Sending 5 56-byte ICMP Echos to 192.168.1.12, timeout is 2 seconds.

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms switchA#

表明交换机之前的 trunk 链路已经成功建立。

三、实验要求

(1) (2) (3) (4) (5)

掌握跨交换机的vlan配置方法和指令。

掌握802.1Q VLAN的作用和802.1Q帧结构。

掌握不同的数据帧进出不同的端口所需要进行的动作。 掌握PVID和VID的概念。 完成实验报告。

实验5 交换机配置MAC与IP绑定

一、实验环境

交换机 IP 地址为 192.168.1.11/24,PC1 的地址为 192.168.1.101/24;PC2 的地址为 192.168.1.102/24。在交换机 0/0/1 端口上作 PC1 的 IP、MAC 与端口绑定。

二、实验步骤

第一步:得到PC1主机的mac地址:00-A0-D1-D1-07-FF。 第二步:交换机全部恢复出厂设置,配置交换机的IP地址 switch(Config)#interface vlan 1

switch(Config-If-Vlan1)#ip address 192.168.1.11 255.255.255.0 switch(Config-If-Vlan1)#no shut switch(Config-If-Vlan1)#exit switch(Config)# 第三步:使能am功能

switch(Config)#am enable

switch(Config)#interface ethernet 0/0/1

switch(Config-Ethernet0/0/1)#am mac-ip-pool 00-A0-D1-D1-07-FF 192.168.1.101 switch(Config-Ethernet0/0/1)#exit switch#show am

第四步:解锁其他端口

Switch(Config)#interface ethernet 0/0/2 Switch(Config-Ethernet0/0/2)#no am port Switch(Config)#interface ethernet 0/0/3-20 Switch(Config-Ethernet0/0/3-20)#no am port 第五步:使用ping命令验证

三、实验要求

(1) 了解交换机AM(access management)功能的作用和原理。 (2) 完成实验报告。