新浪科技

配置Cisco交换机端□和MAC地址表的设置

比特网ChinaByte

关注

3.3 实验2:交换机端□和MAC地址表的设置

本实验是对Cisco Catalyst 1900系列交换机的端口和MAC地址表相关的项目进行设置。

1.实验目的

通过本实验,读者可以掌握以下技能:

设置交涣机端口属性;

查看交换机端口配置和统计信息;

设置静态MAC地址和查看MAC地址表。

2. 设备需求

本实验需要以下设备:

Cisco Catalyst 1900系列交换机1台,型号不限,企业版软件,本实验中使用了1912交换机;

带网卡的PC机2台,网线2条;

PC机1台,操作系统为Windows系列,装有超级终端程序;

Console电缆1条及相应的接口转换器。

3. 线缆连接及配置说明

如图3.2所示,把PC机连接在交换机的EO/9和EO/11两个端口上。连接PC机的目的是为了进行MAC地址表方面的实验,当然此处的PC机也可以便用路由器来代替。

图示中略去了作为超级终端的PC机及控制电缆。

  

4. 实验配置及监测结果

按实验2的图示把设备连接好后,给所有设备加电,开始实验。

监测清单3-2记录了本实验的操作。

监测清单3-2配置端口属性及MAC地址表

第1段:配置端口属性及MAC地址表

SW1912#conf t

Enter configuration commands, one per line. End with CNTL/Z

SW1912(config)#mterface ethernet 0/1

SW1912(config-if)#?

Interface configuration commands:

cdp Cdp interface subcommands

description Interface specific description

duplex Con-figureduplexoperation

exit Exit from interface configuration mode

help Description of the interactive help system

no Negate a conanaand or set its defaults

port Perform switch port configuration

shutdown Shutdown the selected interface

spantree Spanning tree subsystem

vlan-membership VLAN membership configuration

SW1912(config-if)#description PC_1

SW1912(config-if)#duplex ?

auto Enable auto duplex-configuration

full Force full duplex operation

full-flow-control Force full duplex with flow contro1

half Forcehalfduplexoperation

SW 1912(config-if)#duplex full

SW1912(config-if)#port secure ?

max-mac-count Maxirnum number of addresses allowed on the port

SW1912(config-if)#port secure max-mac-couist 1

SW1912(config-if)#end

SW1912#sh mac-address-table ?

address MAC address

aging-time Show aging time of dynamic entries

dynamic Show 802.1 d dynamic address

interface Interface name

permanent Show 802.1 d permanent address

restricted Show 802. 1 d restricted static addresses

security Show addressing security information

SW1912#sh mac-address-table security

Action upon address violation : Suspend

Interface Addressing Security Address Table Size Clear Address

Ethernet 0/1 Enabled 1 No

Ethernet 0/2 Disabled N/A No

Ethernet 0/3 Disabled N/A No

Ethernet 0/4 Disabled N/A No

Ethernet 0/5 Disabled N/A No

Ethernet 0/6 Disabled N/A No

Ethernet 0/7 Disabled N/A No

Ethernet 0/8 Disabled N/A No

Ethernet 0/9 Disabled N/A No

Ethernet 0/10 Disabled N/A No

Ethernet 0/11 Disabled N/A No

Ethernet 0/12 Disabled N/A No

Ethernet 0/25 Disabled N/A No

FastEthernet 0/26 Disabled N/A No

FastEthernet 0/27 Disabled N/A No

SW1912#

第2段:配置和查看MAC地址表

SW1912(config)#mac-address-table ?

aging-time Aging time of dynamic addresses

permanent Configure a permanent address

restricted Configure a restricted static address

SW1912(config)#mac-address-table aging-time ?

SW1912(config)#mac-address-table permanent ?

H.H.H 48 bit hardware address

SW1912(config)#mac"address-tabae permanent 0000.0c10.aabb ?

Ethernet IEEE 802.3

FastEthernet FastEthernet IEEE 802.3

SW1912(config)#mac-address-table permanent 0000.0cl0.aabb e0/3

SW1912(config)#mac-address-table restricted static OOOO.Oc11.aacc e0/6 e0/7

SW1912(config)#end

SW1912#sh mac-address-table

Number of permanent addresses : 1

Number of restricted static addresses : 1

Number of dynamic addresses : 2

Address Dest Interface Type Source Interface List

---------------------------------------

0000.0C10.AABB Ethernet0/3 Permanent All

0000.0C11.AACC Ethernet0/6 Static Et0/7

0000.0C8E.CDD2 Ethernet0/11 Dynamic All

0000.0C76.F737 Ethernet0/9 Dynamic All

SW1912#clear mac-addr restric static

SW1912#sh mac-addr

Number of permanent addresses:1

Number of restricted static add resses:0

Number of dynamic addresses:2

Address Dest Interface Type Source Interface List

---------------------------------------------------------------------

0000.0C10.AABB Ethernet0/3 Permanent All

0000.0C8E.CDD2 Ethernet0/11 Dynamic All

0000.0C76.F737 Ethernet0/9 Dynamic All

(1)进入接口配置模式。键入问号,列出所有此接口下可以进行的设置命令和简短的说明。

(2)使用description PC_1命令设置了EO/1接口的描述为"PC_1",这样在交换机上就可以方便地查到与对应端口相连的设备是什么。

(3)一个端口的双工模式可以分为由duplex?命令所列出的几种:

auto:自动匹配双工模式;

full:强制为全双工模式;

full-flow-control:带流量控制的全双工模式;

half:强制为半双工模式。

(4)端口安全性命令ponsecufe启动了端口安全特性。缺省情况下,可最多有132个目的MAC地址与设置了port secure命令的端口相对应。该端口所对应的MAC地址在MAC地址中(MAC Address Table)不会以动态类型出现,而是自动转换成为静态类型,直到达到所设定的最大值(缺省为132)时为止。到达最大值之后,新的MAC地址不再被接收。

(5)在接口配置模式下发出的port sccure max-mac-count命令限定对应本端口的MAC地址的最大数量,实验中设置为1,即只允许1个MAC地址通过此端口连入网络。

(6)使用show mac-address-table security命令可以查看被设置了安全性的端口的状态,可以看到端口EO/1己经被设置为安全端口,其地址表大小为1。

(7)在第2段中,演示了对MAC地址表的有关配置。

在全局配置模式下,有关MAC地址表的配置有3个:即超时时间、永久地址和限制性地址。

(8)使用mac、address-table aging-time命令可以设置MAC地址表超时时间,交换机学习到的动态MAC地址的超时时间缺省为300s,可以通过命令更改这一数值。

(9)mac、address-table permanent 0000.0c10.aabbe0/3命令对于端口e0/3设置了1个静态MAC地址,这个地址永久存在于MAC地址表中。不会超时,所有的端口均可转发以太网帧给e0/3端口。

(10)所谓限制性静态(restricted static)地址是在永久地址的基础上,同时限制了源端口,其安全性更高。

通过mac-address-table restricted static 0000.0c11.aacc e0/6e0/7命令设置对于E0/6端口的静态MAC地址为0000.0c11.aacc,其限制性端口为E0/7,即只有E0/7端口可以转发以太网帧给这个MAC地址。

(1l)show mac-address-table命令用来查看整个MAC地址表。可以看到,永久地址有1个,设置在E0/3端口上;限定性静态地址有1个,设置的目标端口为E0/6,源端口为E0/7;动态类型的MAC地址有2个。分别是PC1和PC2网卡上的MAC地址。

(12)用clear mac-address restric static命令清除了限定性静态地址之后,show mac-address-table显示限定性静态地址已不在MAC地址表中出现。

加载中...