实验目的
1、理解交换机的工作原理
2、掌握交换机MAC地址表的管理方法
实验拓扑
实验需求
1、根据实验拓扑图,完成设备的基本配置;
2、测试主机之间以及主机和服务器之间的网络连通性;
3、把服务器的MAC地址绑定到SW2的MAC地址表。
实验步骤
步骤1:设备的基本配置
配置PC1:
VPCS> set pcname PC1 //设置主机名
PC1> ip 10.1.1.1/24 //设置IP地址
配置PC2:
VPCS> set pcname PC2
PC2> ip 10.1.1.2/24
配置PC3:
VPCS> set pcname PC3
PC3> ip 10.1.1.3/24
配置PC4:
VPCS> set pcname PC4
PC4> ip 10.1.1.4/24
配置Server:
VPCS> set pcname Server
Server> ip 10.1.1.5/24
配置SW1:
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW1
SW1(config)#no ip domain-lookup
SW1(config)#line console 0
SW1(config-line)#exec-timeout 0 0
SW1(config-line)#logging synchronous
SW1(config-line)#end
SW1#
配置SW2:
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW2
SW2(config)#no ip domain-lookup
SW2(config)#line console 0
SW2(config-line)#exec-timeout 0 0
SW2(config-line)#logging synchronous
SW2(config-line)#end
SW2#
步骤2:绑定服务器的MAC地址到SW2的MAC地址表
配置SW2:
SW2#configure terminal
SW2(config)# mac address-table static 0050.7966.6805 vlan 1 interface Ethernet0/3
实验检查
步骤1:网络连通性测试
PC1> ping 10.1.1.2
84 bytes from 10.1.1.2 icmp_seq=1 ttl=64 time=0.502 ms
84 bytes from 10.1.1.2 icmp_seq=2 ttl=64 time=0.738 ms
84 bytes from 10.1.1.2 icmp_seq=3 ttl=64 time=0.584 ms
84 bytes from 10.1.1.2 icmp_seq=4 ttl=64 time=0.646 ms
84 bytes from 10.1.1.2 icmp_seq=5 ttl=64 time=0.730 ms
PC1与PC2的连通性正常。
PC1> ping 10.1.1.3
84 bytes from 10.1.1.3 icmp_seq=1 ttl=64 time=0.968 ms
84 bytes from 10.1.1.3 icmp_seq=2 ttl=64 time=0.816 ms
84 bytes from 10.1.1.3 icmp_seq=3 ttl=64 time=1.265 ms
84 bytes from 10.1.1.3 icmp_seq=4 ttl=64 time=1.122 ms
84 bytes from 10.1.1.3 icmp_seq=5 ttl=64 time=1.242 ms
PC1与PC3的连通性正常。
PC1> ping 10.1.1.4
84 bytes from 10.1.1.4 icmp_seq=1 ttl=64 time=0.900 ms
84 bytes from 10.1.1.4 icmp_seq=2 ttl=64 time=1.303 ms
84 bytes from 10.1.1.4 icmp_seq=3 ttl=64 time=0.880 ms
84 bytes from 10.1.1.4 icmp_seq=4 ttl=64 time=1.086 ms
84 bytes from 10.1.1.4 icmp_seq=5 ttl=64 time=1.259 ms
PC1与PC4的连通性正常。
PC1> ping 10.1.1.5
84 bytes from 10.1.1.5 icmp_seq=1 ttl=64 time=0.875 ms
84 bytes from 10.1.1.5 icmp_seq=2 ttl=64 time=1.248 ms
84 bytes from 10.1.1.5 icmp_seq=3 ttl=64 time=1.145 ms
84 bytes from 10.1.1.5 icmp_seq=4 ttl=64 time=0.942 ms
84 bytes from 10.1.1.5 icmp_seq=5 ttl=64 time=1.317 ms
PC1与Server的连通性正常。
步骤2:管理交换机的MAC地址表
查看SW1的MAC地址表:
SW1#show mac address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 0050.7966.6801 DYNAMIC Et0/1
1 0050.7966.6802 DYNAMIC Et0/2
1 0050.7966.6803 DYNAMIC Et0/0
1 0050.7966.6804 DYNAMIC Et0/0
1 0050.7966.6805 DYNAMIC Et0/0
1 aabb.cc00.7000 DYNAMIC Et0/0
Total Mac Addresses for this criterion: 6
SW1已经学习到PC1、PC2、PC3、PC4以及Server的MAC地址,学习方式是Dynamic。
清除SW1动态学习到的MAC地址条目:
SW1#clear mac address-table dynamic
SW1#show mac address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 aabb.cc00.7000 DYNAMIC Et0/0
Total Mac Addresses for this criterion: 1
Clear mac address-table dynamic命令能够清除通过Dynamic方式学习到的MAC地址条目。
查看SW2的MAC地址表:
SW2#show mac address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 0050.7966.6801 DYNAMIC Et0/0
1 0050.7966.6803 DYNAMIC Et0/1
1 0050.7966.6804 DYNAMIC Et0/2
1 0050.7966.6805 STATIC Et0/3
1 aabb.cc00.6000 DYNAMIC Et0/0
Total Mac Addresses for this criterion: 5
Server的MAC地址是静态绑定的,所以类型是STATIC。
清除SW2动态学习到的MAC地址条目:
SW2#clear mac address-table dynamic
SW2#show mac address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 0050.7966.6805 STATIC Et0/3
1 aabb.cc00.6000 DYNAMIC Et0/0
Total Mac Addresses for this criterion: 2
Clear mac address-table dynamic命令无法清除静态绑定的MAC地址条目。