互换机端与MAC地址表的设置.docx
《互换机端与MAC地址表的设置.docx》由会员分享,可在线阅读,更多相关《互换机端与MAC地址表的设置.docx(9页珍藏版)》请在冰点文库上搜索。
互换机端与MAC地址表的设置
实验2:
互换机端□和MAC地址表的设置 本实验是对CiscoCatalyst1900系列交换机的端口和MAC地址表相关的项目进行设置。
1.实验目的 通过本实验,读者可以掌握以下技能:
设置交涣机端口属性; 查看交换机端口配置和统计信息; 设置静态MAC地址和查看MAC地址表。
2.设备需求 本实验需要以下设备:
CiscoCatalyst1900系列交换机1台,型号不限,企业版软件,本实验中使用了1912交换机; 带网卡的PC机2台,网线2条; PC机1台,操作系统为Windows系列,装有超级终端程序; Console电缆1条及相应的接口转换器。
3.线缆连接及配置说明 如图所示,把PC机连接在交换机的EO/9和EO/11两个端口上。
连接PC机的目的是为了进行MAC地址表方面的实验,当然此处的PC机也可以便用路由器来代替。
图示中略去了作为超级终端的PC机及控制电缆。
4.实验配置及监测结果 按实验2的图示把设备连接好后,给所有设备加电,开始实验。
监测清单3-2记录了本实验的操作。
监测清单3-2配置端口属性及MAC地址表 第1段:
配置端口属性及MAC地址表 SW1912#conft Enterconfigurationcommands,oneperline.EndwithCNTL/Z SW1912(config)#mterfaceethernet0/1 SW1912(config-if)#?
Interfaceconfigurationcommands:
cdpCdpinterfacesubcommands descriptionInterfacespecificdescription duplexCon-figureduplexoperation exitExitfrominterfaceconfigurationmode helpDescriptionoftheinteractivehelpsystem noNegateaconanaandorsetitsdefaults portPerformswitchportconfiguration shutdownShutdowntheselectedinterface spantreeSpanningtreesubsystem vlan-membershipVLANmembershipconfiguration SW1912(config-if)#descriptionPC_1 SW1912(config-if)#duplex?
autoEnableautoduplex-configuration fullForcefullduplexoperation full-flow-controlForcefullduplexwithflowcontro1 halfForcehalfduplexoperation SW1912(config-if)#duplexfull SW1912(config-if)#portsecure?
max-mac-countMaxirnumnumberofaddressesallowedontheport SW1912(config-if)#portsecuremax-mac-couist1 SW1912(config-if)#end SW1912#shmac-address-table?
addressMACaddress aging-timeShowagingtimeofdynamicentries dynamicShowddynamicaddress interfaceInterfacename permanentShowdpermanentaddress restrictedShow802.1drestrictedstaticaddresses securityShowaddressingsecurityinformation SW1912#shmac-address-tablesecurity Actionuponaddressviolation:
Suspend InterfaceAddressingSecurityAddressTableSizeClearAddress Ethernet0/1Enabled1No Ethernet0/2DisabledN/ANo Ethernet0/3DisabledN/ANo Ethernet0/4DisabledN/ANo Ethernet0/5DisabledN/ANo Ethernet0/6DisabledN/ANo Ethernet0/7DisabledN/ANo Ethernet0/8DisabledN/ANo Ethernet0/9DisabledN/ANo Ethernet0/10DisabledN/ANo Ethernet0/11DisabledN/ANo Ethernet0/12DisabledN/ANo Ethernet0/25DisabledN/ANo FastEthernet0/26DisabledN/ANo FastEthernet0/27DisabledN/ANo SW1912# 第2段:
配置和查看MAC地址表 SW1912(config)#mac-address-table?
aging-timeAgingtimeofdynamicaddresses permanentConfigureapermanentaddress restrictedConfigurearestrictedstaticaddress SW1912(config)#mac-address-tableaging-time?
SW1912(config)#mac-address-tablepermanent?
48bithardwareaddress SW1912(config)#mac"address-tabaepermanent?
EthernetIEEE FastEthernetFastEthernetIEEE SW1912(config)#mac-address-tablepermanente0/3 SW1912(config)#mac-address-tablerestrictedstatice0/6e0/7 SW1912(config)#end SW1912#shmac-address-table Numberofpermanentaddresses:
1 Numberofrestrictedstaticaddresses:
1 Numberofdynamicaddresses:
2 AddressDestInterfaceTypeSourceInterfaceList --------------------------------------- Ethernet0/3PermanentAll Ethernet0/6StaticEt0/7 Ethernet0/11DynamicAll Ethernet0/9DynamicAll SW1912#clearmac-addrrestricstatic SW1912#shmac-addr Numberofpermanentaddresses:
1 Numberofrestrictedstaticaddresses:
0 Numberofdynamicaddresses:
2 AddressDestInterfaceTypeSourceInterfaceList --------------------------------------------------------------------- Ethernet0/3PermanentAll Ethernet0/11DynamicAll Ethernet0/9DynamicAll
(1)进入接口配置模式。
键入问号,列出所有此接口下可以进行的设置命令和简短的说明。
(2)使用descriptionPC_1命令设置了EO/1接口的描述为"PC_1",这样在交换机上就可以方便地查到与对应端口相连的设备是什么。
(3)一个端口的双工模式可以分为由duplex?
命令所列出的几种:
auto:
自动匹配双工模式; full:
强制为全双工模式; full-flow-control:
带流量控制的全双工模式; half:
强制为半双工模式。
(4)端口安全性命令ponsecufe启动了端口安全特性。
缺省情况下,可最多有132个目的MAC地址与设置了portsecure命令的端口相对应。
该端口所对应的MAC地址在MAC地址中(MACAddressTable)不会以动态类型出现,而是自动转换成为静态类型,直到达到所设定的最大值(缺省为132)时为止。
到达最大值之后,新的MAC地址不再被接收。
(5)在接口配置模式下发出的portsccuremax-mac-count命令限定对应本端口的MAC地址的最大数量,实验中设置为1,即只允许1个MAC地址通过此端口连入网络。
(6)使用showmac-address-tablesecurity命令可以查看被设置了安全性的端口的状态,可以看到端口EO/1己经被设置为安全端口,其地址表大小为1。
(7)在第2段中,演示了对MAC地址表的有关配置。
在全局配置模式下,有关MAC地址表的配置有3个:
即超时时间、永久地址和限制性地址。
(8)使用mac、address-tableaging-time命令可以设置MAC地址表超时时间,交换机学习到的动态MAC地址的超时时间缺省为300s,可以通过命令更改这一数值。
(9)mac、address-tablepermanent3命令关于端口e0/3设置了1个静态MAC地址,那个地址永久存在于MAC地址表中。
可不能超时,所有的端口都可转发以太网帧给e0/3端口。
(10)所谓限制性静态(restrictedstatic)地址是在永久地址的基础上,同时限制了源端口,其安全性更高。
通过mac-address-tablerestrictedstatice0/6e0/7命令设置关于E0/6端口的静态MAC地址为,其限制性端口为E0/7,即只有E0/7端口能够转发以太网帧给那个MAC地址。
(1l)showmac-address-table命令用来查看整个MAC地址表。
能够看到,永久地址有1个,设置在E0/3端口上;限定性静态地址有1个,设置的目标端口为E0/6,源端口为E0/7;动态类型的MAC地址有2个。
别离是PC1和PC2网卡上的MAC地址。
(12)用clearmac-addressrestricstatic命令清除了限定性静态地址之后,showmac-address-table显示限定性静态地址已不在MAC地址表中出现。
Cisco3524互换机配置VLAN实例
Cisco3548(3524)互换机:
第一次连接交换机,配置终端参数为:
波特率:
9600;数据位:
8;停止位:
1;奇偶校验:
无;流控制:
无。
通过串口线连上路由器后,按回车,即可看到配置向导:
(如果不是第一次配置,可以进入超级用户模式后用命令setup调用以下过程) ---SystemConfigurationDial
og--- Atanypointyoumayenteraquestionmark?
forhelp.任何时候可以打?
取得帮助 Usectrl-ctoabortconfigurationdialogatanyprompt.按Ctrl-C可以取消并退出 Defaultsettingsareinsquarebrackets[].默认参数在[]中 Continuewithconfigurationdialog?
[yes/no]:
y继续交互配置吗?
回答:
y EnterIPaddress:
.249ip地址 EnterIPnetmask:
子网掩码 Wouldyouliketoenteradefaultgatewayaddress?
[yes]:
y设置默认网关?
y IPaddressofdefaultgateway:
默认网关 Enterhostname[3548_9A]:
Theenablesecretisaone-waycryptographicsecretused insteadoftheenablepasswordwhenitexists. Enterenablesecret:
_password输入超级用户密码 WouldyouliketoconfigureaTelnetpassword?
[yes]:
y EnterTelnetpassword:
_password输入telnet密码 Wouldyouliketoenableasaclustercommandswitch?
[yes/no]:
n集群模式?
n Thefollowingconfigurationcommandscriptwascreated:
已建立以下配置信息 ipsubnet-zero interfaceVLAN1 ipaddress ipdefault-gateway enablesecret5$1$biZ3$AOLb9cMTtBwMtGB9lyBzr. linevty015 password_domainwlzx snmpcommunityprivaterw snmpcommunitypublicro !
end Usethisconfiguration?
[yes/no]:
使用该配置信息吗?
y 修改配置:
禁止通过snmp管理:
3548>enable password:
3548#configterm 3548(config)#nosnmpcommunityprivate 3548(config)#nosnmpcommunitypublic 接着配置干道:
(确定上级交换机对应端口已设为干道模式) 3548(config)#interg0/1选择第一个千兆口 3548(configif)#switchportmodetrunk设为干道模式 如果g0/2用于连接另一台3548,也设为干道 3548(config)#interg0/2 3548(configif)#switchportmodetrunk 返回 3548(configif)#exit 3548(config)#exit 3548# 验证:
ping 配置Vlan数据:
3548#vlandatabase 3548(vlan)#reset清除以前的配置 3548(vlan)#vtpclient设为vtp客户模式 3548(vlan)#vtpdomain_domainvtp域是_domain 3548(vlan)#vtppassword********设定vtp域密码 3548(vlan)#exit 3548# 验证:
showvtpstatus显示vlan数据 showvtpcounters showvlan 同步后看到的vlan数目和名称应与6506上的一致 指定端口到Vlan、配置端口为portfast方式(快速建立连接):
方法1:
命令方式 3548#configterm 3548(config)#interf0/1配置1号快速以太网端口 3548(configif)#switchportaccessvlan2指定端口到Vlan2 3548(configif)#spanning-treeportfast配置端口为portfast方式 3548(config)#interf0/2配置1号快速以太网端口 3548(configif)#switchportaccessvlan2指定端口到Vlan2 3548(configif)#spanning-treeportfast配置端口为portfast方式 ...对每个要设定的端口重复上述步骤。
3548(configif)#exit 3548(config)#exit 3548# 方法1:
Web方式 (预先要安装插件:
1-2-2) 打开浏览器连接设备:
在地址栏输入设备的管理页面url,如3548_9a为:
选中菜单port->portconfigure->设portfast为Enable 选中菜单vlan->vlanmembership->指定端口所属的Vlan号可同时指定多个端口 !
注意:
如果把一个端口指定到不存在的VLAN上,3548交换机的VLAN同步会异常,此时应该为正确VLAN并重新“配置Vlan数据”保存配置信息:
方法1:
命令方式 3548#write(或copyrunning-configstartup-config) 方法1:
Web方式 选中设备(而不是单个端口),点击saveconfigure按钮。
3548_9A#showrun Buildingconfiguration... Currentconfiguration:
!
version#软件版本 noservicepad servicetimestampsdebuguptime servicetimestampsloguptime noservicepassword-encryption !
hostname3548_9A#系统名称 !
enablesecret5$1$4ZMs$0#加密后的enable密码 !
!
!
!
!
!
ipsubnet-zero !
!
!
interfaceFastEthernet0/1#模块0的1号快速以太网接口 switchportaccessvlan5#指定端口0/1到vlan5 spanning-treeportfast#如果接的是工作站,指定端口为portfast方式(不运行生成树协议,加快建立连接速度) !
interfaceFastEthernet0/2 spanning-treeportfast#默认情况下端口属vlan1 !
interfaceFastEthernet0/3 spanning-treeportfast !
interfaceFastEthernet0/4 spanning-treeportfast !
interfaceFastEthernet0/5 spanning-treeportfast !
interfaceFastEthernet0/6 spanning-treeportfast !
interfaceFastEthernet0/7 spanning-treeportfast !
interfaceFastEthernet0/8 spanning-treeportfast !
interfaceFastEthernet0/9 spanning-treeportfast !
interfaceFastEthernet0/10 spanning-treeportfast !
interfaceFastEthernet0/11 spanning-treeportfast !
interfaceFastEthernet0/12 spanning-treeportfast !
interfaceFastEthernet0/13 spanning-treeportfast !
interfaceFastEthernet0/14 spanning-treeportfast !
interfaceFastEthernet0/15 spanning-treeportfast !
interfaceFastEthernet0/16 spanning-treeportfast !
interfaceFastEthernet0/17 spanning-treeportfast !
interfaceFastEthernet0/18 spanning-treeportfast !
interfaceFastEthernet0/19 spanning-treeportfast !
interfaceFastEthernet0/20 spanning-treeportfast !
interfaceFastEthernet0/21 spanning-treeportfast !
interfaceFastEthernet0/22 spanning-treeportfast !
interfaceFastEthernet0/23 spanning-treeportfast !
interfaceFastEthernet0/24 spanning-treeportfast !
interfaceFastEthernet0/25 spanning-treeportfast !
interfaceFastEthernet0/26 spanning-treeportfast !
interfaceFastEthernet0/27 spanning-treeportfast !
interfaceFastEthernet0/28 spanning-treeportfast !
interfaceFastEthernet0/29 spanning-treeportfast !
in