第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)#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地址表的有關配置。