锐捷交换机常用配置基础命令
- 格式:doc
- 大小:78.00 KB
- 文档页数:18
锐捷交换机配置命令交换机基本操作:1.进入特权模式Switch>enableSwitch#2.返回用户模式Switch#exitPress RETURN to get started!Switch>配置模式:全局配置模式[主机名(config)#]:配置交换机的整体参数子模式:1.线路配置模式[主机名(config-line)#]:配置交换机的线路参数2.接口配置模式[主机名(config-if)#]:配置交换机的接口参数1.进入、退出全局配置模式Switch#configure terminalSwitch(config)#exitSwitch#2.进入、退出线路配置模式Switch(config)#line console 0Switch(config-line)#exitSwitch(config)#3.进入、退出接口配置模式Switch(config)#interface fastEthernet 0/1Switch(config-if)#exitSwitch(config)#从子模式下直接返回特权模式Switch(config-if)#endSwitch#交换机操作帮助:1.支持命令简写(按TAB键将命令补充完整)2.在每种操作模式下直接输入“?”显示该模式下所有的命令3.命令空格“?”显示命令参数并对其解释说明4. “字符?”显示以该字符开头的命令5.命令历史缓存: (Ctrl+P)显示上一条命令,(Ctrl+N)显示下一条命令6.错误提示信息交换机显示命令:显示交换机硬件及软件的信息 Switch#show version显示当前运行的配置参数 Switch#show running-config显示保存的配置参数 Switch#show configure常用交换机EXEC命令:1.将当前运行的配置参数复制到flash:Switch#write memoryBuilding configuration...[OK]Switch#2.清空flash中的配置参数:Switch#delete flash:config.textSwitch#3.交换机重新启动:Switch#reloadSystem configuration has been modified. Save? [yes/no]:nProceed with reload? [confirm]4.配置交换机主机名:Switch(config)#hostname S2126G-1S2126G-1(config)#5.配置交换机口令:1) 配置交换机的登陆密码S2126G(config)#enable secret level 1 0 star“0”表示输入的是明文形式的口令2) 配置交换机的特权密码S2126G(config)#enable secret level 15 0 star“0”表示输入的是明文形式的口令常用交换机配置命令:1、为交换机分配管理IP地址S2126G(config)#interface vlan 1S2126G(config-if)#ip address {IP address} {IP subnetmask}[secondary] 2、将接口启用S2126G(config-if)#no shutdown3、将接口关闭S2126G(config-if)#shutdown4、配置接口速率S2126G(config-if)#speed [10|100|auto]5、配置接口双工模式S2126G(config-if)#duplex [auto|full|half]显示接口状态:S2126G#show interface测定目的端的可达性:S2126G>ping {IP address}从TFTP服务器下载配置参数:S2126G#copy tftp startup-config管理交换机MAC地址表:1、查看MAC地址表S2126G#show mac-address-table2、配置MAC地址表记录的生存时间(缺省为300秒)S2126G(config)#mac-address-table aging-time <10-1000000>3、查看MAC地址表记录的生存时间S2126G#show mac-address-table aging-timeVLAN的配置:1.添加一个VLANS2126G(config)#vlan <1-4094>S2126G(config-vlan)#2.为VLAN命名S2126G(config-vlan)#name 名字将交换机端口分配到VLAN1.配置Port VLANSwitch(config-if)#switchport access vlan <1-4094>2.配置Tag VLANSwitch(config-if)#switchport mode trunk1)配置本地(native)VLANSwitch(config-if)#switchport trunk native vlan <1-4094> Native VLAN即PVID,默认情况下每个trunk口的native VLAN 是12)从主干链路中清除VLANSwitch(config-if)#switchport trunk allowed vlan except vlan-list 注:VLAN1不可被清除3)在主干链路中允许所有VLANSwitch(config-if)#switchport trunk allowed vlan all4)向主干链路中加入VLANSwitch(config-if)#switchport trunk allowed vlan add vlan-list VLAN的验证:1.显示全部的VLAN:Switch#show vlan2.显示单独的VLAN :Switch#show vlan id <1-4094>将VLAN信息保存到flash中:Switch#write memory从flash中清除VLAN信息:Switch#delete flash:vlan.datRSTP的配置:1.启用生成树:S2126G(config)#spanning-tree2.配置交换机优先级:S2126G(config)#spanning-tree priority <0-61440>“0”或“4096”的倍数(RSTP BPDU该值后12bit全0)3.配置交换机端口优先级:S2126G(config-if)#spanning-tree port-priority <0-240>“0”或“16”的倍数(RSTP BPDU该值后4bit全0)4、生成树hello时间的配置(由Root决定):S2126G(config)#spanning-tree hello-time <1-10>5、生成树的验证:Switch#show spanning-treeSwitch#show spanning-tree interface <接口名称> <接口编号>聚合端口的创建:Switch(config)# interface aggregateport 1 创建聚合接口AG1Switch(config-if)# switchport mode trunk 配置并保证AG1为 trunk 模式Switch(config)#int range f0/23-24Switch(config-if-range)#port-group 1 将端口(端口组)划入聚合端口AG1中生成树:Switch(config)#spanning-tree 开启生成树协议Switch(config)#spanning-tree mode stp 指定生成树类型为stp可选模式stp , rstp , mstpSwitch(config)#spanning-tree priority 4096 设置交换机的优先级为4096 , 优先级值小为高。
【第一部分】交换机支持的命令:1.交换机基本状态:switch: ;ROM状态,路由器是rommon>hostname> ;用户模式hostname# ;特权模式hostname(config)# ;全局配置模式hostname(config-if)# ;接口状态2.交换机口令设置:switch>enable ;进入特权模式switch#config terminal ;进入全局配置模式switch(config)#hostname;设置交换机的主机名switch(config)#enable secret xxx ;设置特权加密口令switch(config)#enable password xxa ;设置特权非密口令switch(config)#line console 0 ;进入控制台口switch(config-line)#line vty 0 4 ;进入虚拟终端switch(config-line)#login ;允许登录switch(config-line)#password xx ;设置登录口令xxswitch#exit ;返回命令3.交换机VLAN设置:switch#vlan database ;进入VLAN设置switch(vlan)#vlan 2 ;建VLAN 2switch(vlan)#no vlan 2 ;删vlan 2switch(config)#int f0/1 ;进入端口1switch(config-if)#switchport access vlan 2 ;当前端口加入vlan 2 switch(config-if)#switchport mode trunk ;设置为干线switch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlan switch(config-if)#switchport trunk encap dot1q ;设置vlan 中继switch(config)#vtp domain;设置发vtp域名switch(config)#vtp password;设置发vtp密码switch(config)#vtp mode server ;设置发vtp模式switch(config)#vtp mode client ;设置发vtp模式4.交换机设置IP地址:switch(config)#interface vlan 1 ;进入vlan 1switch(config-if)#ip address;设置IP地址switch(config)#ip default-gateway;设置默认网关switch#dir flash: ;查看闪存5.交换机显示命令:switch#write ;保存配置信息switch#show vtp ;查看vtp配置信息switch#show run ;查看当前配置信息switch#show vlan ;查看vlan配置信息switch#show interface ;查看端口信息switch#show int f0/0 ;查看指定端口信息【第二部分】路由器支持的命令:1.路由器显示命令:router#show run ;显示配置信息router#show interface ;显示接口信息router#show ip route ;显示路由信息router#show cdp nei ;显示邻居信息router#reload ;重新起动2.路由器口令设置:router>enable ;进入特权模式router#config terminal ;进入全局配置模式router(config)#hostname;设置交换机的主机名router(config)#enable secret xxx ;设置特权加密口令router(config)#enable password xxb ;设置特权非密口令router(config)#line console 0 ;进入控制台口router(config-line)#line vty 0 4 ;进入虚拟终端router(config-line)#login ;要求口令验证router(config-line)#password xx ;设置登录口令xx router(config)#(Ctrl+z) ;返回特权模式router#exit ;返回命令3.路由器配置:router(config)#int s0/0 ;进入Serail接口router(config-if)#no shutdown ;激活当前接口router(config-if)#clock rate 64000 ;设置同步时钟router(config-if)#ip address;设置IP地址router(config-if)#ip address second ;设置第二个IProuter(config-if)#int f0/0.1 ;进入子接口router(config-subif.1)#ip address;设置子接口IProuter(config-subif.1)#encapsulation dot1q;绑定vlan中继协议router(config)#config-register 0x2142 ;跳过配置文件router(config)#config-register 0x2102 ;正常使用配置文件router#reload ;重新引导4.路由器文件操作:router#copy running-config startup-config ;保存配置router#copy running-config tftp ;保存配置到tftprouter#copy startup-config tftp ;开机配置存到tftprouter#copy tftp flash: ;下传文件到flashrouter#copy tftp startup-config;下载配置文件ROM状态:Ctrl+Break ;进入ROM监控状态rommon>confreg 0x2142 ;跳过配置文件rommon>confreg 0x2102 ;恢复配置文件rommon>reset;重新引导rommon>copy xmodem: flash: ;从console传输文件rommon>IP_ADDRESS=10.65.1.2 ;设置路由器IP rommon>IP_SUBNET_MASK=255.255.0.0 ;设置路由器掩码rommon>TFTP_SERVER=10.65.1.1 ;指定TFTP服务器IP rommon>TFTP_FILE=c2600.bin ;指定下载的文件rommon>tftpdnld ;从tftp下载rommon>dir flash: ;查看闪存内容rommon>boot ;引导IOS5.静态路由:ip route;命令格式router(config)#ip route 2.0.0.0 255.0.0.0 1.1.1.2 ;静态路由举例router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2 ;默认路由举例6.动态路由:router(config)#ip routing ;启动路由转发router(config)#router rip ;启动RIP路由协议。
>Enable 进入特权模式#Exit 返回上一级操作模式#End 返回到特权模式#write memory 或copy running-config startup-config 保存配置文件#del flash:config.text 删除配置文件(交换机及1700系列路由器)#erase startup-config 删除配置文件(2500系列路由器)#del flash:vlan.dat 删除Vlan配置信息(交换机)#Configure terminal 进入全局配置模式(config)# hostname switchA配置设备名称为switchA(config)#banner motd & 配置每日提示信息&为终止符(config)#enable secret level 1 0 star 配置远程登陆密码为star(config)#enable secret level 15 0 star 配置特权密码为starLevel 1为普通用户级别,可选为1~15,15为最高权限级别;0表示密码不加密(config)#enable services web-server 开启交换机WEB管理功能Services 可选以下:web-server(WEB管理)、telnet-server(远程登陆)等查看信息#show running-config 查看当前生效的配置信息#show interface fastethernet 0/3 查看F0/3端口信息#show interface serial 1/2 查看S1/2端口信息#show interface 查看所有端口信息#show ip interface brief 以简洁方式汇总查看所有端口信息#show ip interface 查看所有端口信息#show version 查看版本信息#show mac-address-table 查看交换机当前MAC地址表信息#show running-config 查看当前生效的配置信息#show vlan 查看所有VLAN信息#show vlan id 10 查看某一VLAN (如VLAN10)的信息#show interface fastethernet 0/1 switchport 查看某一端口模式(如F 0/1)#show aggregateport 1 summary 查看聚合端口AG1的信息#show spanning-tree 查看生成树配置信息#show spanning-tree interface fastethernet 0/1 查看该端口的生成树状态#show port-security 查看交换机的端口安全配置信息#show port-security address 查看地址安全绑定配置信息#show ip access-lists listname 查看名为listname的列表的配置信息#show access-lists端口的基本配置(config)#Interface fastethernet 0/3 进入F0/3的端口配置模式(config)#interface range fa 0/1-2,0/5,0/7-9 进入F0/1、F0/2、F0/5、F0/7、F0/8、F0/9的端口配置模式(config-if)#speed 10 配置端口速率为10M,可选10,100,auto(config-if)#duplex full 配置端口为全双工模式,可选full(全双工),half(半双式),auto(自适应)(config-if)#no shutdown 开启该端口(config-if)#switchport access vlan 10 将该端口划入VLAN10中,用于VLAN(config-if)#switchport mode trunk 将该端口设为trunk模式,用于Tag vlan可选模式为access , trunk(config-if)#port-group 1 将该端口划入聚合端口AG1中,用于聚合端口聚合端口的创建(config)# interface aggregateport 1 创建聚合接口AG1(config-if)# switchport mode trunk 配置并保证AG1为trunk 模式(config)#int f0/23-24(config-if-range)#port-group 1 将端口(端口组)划入聚合端口AG1中生成树(config)#spanning-tree 开启生成树协议(config)#spanning-tree mode stp 指定生成树类型为stp可选模式stp , rstp , mstp(config)#spanning-tree priority 4096 设置交换机的优先级为4096 , 优先级值小为高。
内网交换机端口也可以限速.但那没有意义.连内网的速率都降下来了.例:S2126G(config)#int f 0/1S2126G(config-if)#rate-control 1这个端口下面不管接PC还是及连交换机,都是1M的流量了.内网规划都是千兆,万兆,十兆的带宽,都不会去限速的.只有外网的带宽是有限的.所以要做只在出口上做限速.防网关ARP欺骗配置anti-arp-spoofing ip 10.10.10.254命令的原理是,交换机会检测这个接口的arp报文,源地址是我们配置的地址这个ip地址10.10.10.254就会丢弃这个报文。
tracert 命令跟踪 TCP/IP 数据包从该计算机到其他远程计算机所采用的路径。
Switch#show versionSwitch#show mac-address-tableSwitch#show arp第一步:开启log服务器功能,并制定log服务器的地址ruijie(config)#logging on ---开启log功能ruijie(config)#logging server 192.168.1.1 ---指定log服务器的地址,可以填写多个第二步:指定snmp-server地址,并制定发送trap消息的源地址(可选)ruijie(config)#service timestamps log datetime ---发送记录事件的时候包含时间标记ruijie(config)#service timestamps debug datetime ---syslog信息包含时间戳第三步:设置设备的时间(或者设置SNTP服务器)ruijie#clock set 8:45:00 10 13 2009 ---设置设备当前时间为2009-10-13ruijie#show clock ---查看当前设备的系统时间08:45:06 CHN-BJ Tue 2009-10-13第四步:指定发送的时间戳:ruijie(config)#logging facility local7---定义facility级别,缺省为local7,可以设置从local0到local7ruijie(config)#logging trap warnings ---定义severity级别缺省为infor级别第五步:保存设备配置ruijie#write。
一、密码设置Ruijie> enableRuijie#configuration terminalRuijie(config)# enable password密码Ruijie(config)# line console 0Ruijie(config-line)# password密码Ruijie(config-line)# loginRuijie(config)# line vty 0 4Ruijie(config-line)# password 密码Ruijie(config-line)# login二、设备命名、接口命名、VLAN命名Ruijie> enableRuijie# configuration terminalRuijie(config)# hostname名字Ruijie(config)# interface fastethernet 0/1Ruijie(config-if)# description 接口描述内容Ruijie(config)# vlan vlan编号Ruijie(config-vlan)#name名字二、POE供电的配置及查看Ruijie> enableRuijie# configuration terminalRuijie(config)# interface fastethernet 0/1Ruijie(config-if)# poe enableRuijie(config)# interface range fastethernet 0/1 - 24Ruijie(config- if -range)# poe enableRuijie# show poe interface 接口编号Ruijie# show poe powersupply三、接口模式设置、速率、双工、光电模式转换Ruijie# configuration terminalRuijie(config)# interface fastethernet 0/1Ruijie(config-if)# medium-type { fiber | copper } Ruijie(config-if)# speed {10 | 100 | 1000 | auto } Ruijie(config-if)# duplex {auto | full | half }四、设备配置保存、备份、删除、重启Ruijie> enableRuijie# writeRuijie# copy flash:/config.text xmodemRuijie# delete config.textRuijie# reload五、设备管理IP及SNMP团体属性配置Ruijie# configuration terminalRuijie(config)# interface vlan 管理vlan编号Ruijie(config-if)# ip address ip地址子网掩码Ruijie(config)# snmp community string ro六、基于时间的访问控制列表Ruijie> enableRuijie# clock set hh:mm:ss month day yearRuijie# configuration terminalRuijie(config)# ntp server x.x.x.xRuijie(config)# time-range time-range-nameRuijie(config-time-range)# periodic weekdays 8:00 to 18:00Ruijie(config)# ip access-list extended 100Ruijie(config-ext-nacl)# permit ip any any time-range time-range-name Ruijie(config)# interface gigabitEthernet 0/1Ruijie(config-if)# ip access-group 100 in。
锐捷交换机配置命令交换机基本操作:1.进入特权模式Switch>enableSwitch#2.返回用户模式Switch#exit子模式1.2.1.2.3.Switch(config-if)#exitSwitch(config)#从子模式下直接返回特权模式Switch(config-if)#endSwitch#交换机操作帮助:1.支持命令简写(按TAB键将命令补充完整)2.在每种操作模式下直接输入“?”显示该模式下所有的命令3.命令空格“?”显示命令参数并对其解释说明4.“字符?”显示以该字符开头的命令5.命令历史缓存:(Ctrl+P)显示上一条命令,(Ctrl+N)显示下一条命令6.错误提示信息交换机显示命令:显示交换机硬件及软件的信息Switch#showversion1.[OK]2.清空3.4.S2126G-1(config)#5.配置交换机口令:1)配置交换机的登陆密码S2126G(config)#enablesecretlevel10star“0”表示输入的是明文形式的口令2)配置交换机的特权密码S2126G(config)#enablesecretlevel150star“0”表示输入的是明文形式的口令常用交换机配置命令:1、为交换机分配管理IP地址S2126G(config)#interfacevlan1S2126G(config-if)#ipaddress{IPaddress}{IPsubnetmask}[secondary] 2、将接口启用S2126G(config-if)#noshutdown345从TFTP1、查看2、配置3、查看MAC地址表记录的生存时间S2126G#showmac-address-tableaging-timeVLAN的配置:1.添加一个VLANS2126G(config)#vlan<1-4094>S2126G(config-vlan)#2.为VLAN命名S2126G(config-vlan)#name名字将交换机端口分配到VLAN1.配置PortVLANSwitch(config-if)#switchportaccessvlan<1-4094>2.配置TagVLANSwitch(config-if)#switchportmodetrunk1)配置本地(native)VLAN2注34VLAN1.2.将VLAN从RSTP1.启用生成树:S2126G(config)#spanning-tree2.配置交换机优先级:S2126G(config)#spanning-treepriority<0-61440>“0”或“4096”的倍数(RSTPBPDU该值后12bit全0)3.配置交换机端口优先级:S2126G(config-if)#spanning-treeport-priority<0-240>“0”或“16”的倍数(RSTPBPDU该值后4bit全0)4、生成树hello时间的配置(由Root决定):S2126G(config)#spanning-treehello-time<1-10>5、生成树的验证:Switch#showspanning-treeSwitch#showspanning-treeinterface<接口名称><接口编号>聚合端口的创建:Switch(config)#interfaceaggregateport1创建聚合接口AG1优先SVIIP,此IP1)配置最大连接数限制Switch(config-if)#switchportport-secruitymaxmum1配置端口的最大连接数为1,最大连接数为128Switch(config-if)#switchportport-secruityviolationshutdown配置安全违例的处理方式为shutdown,可选为protect(当安全地址数满后,将未知名地址丢弃)、restrict(当违例时,发送一个Trap通知)、shutdown(当违例时将端口关闭,并发送Trap通知,可在全局模式下用errdisablerecovery来恢复)2)IP和MAC地址绑定Switch(config-if)#switchportport-securitymac-addressip-address 与IP地址十六进制a-f用小写字母)三层交换机路由功能:1)开启三层交换机的路由功能Switch(config)#iprouting2)开启端口的三层路由功能。
锐捷交换机配置命令 IMB standardization office【IMB 5AB- IMBK 08- IMB 2C】锐捷交换机配置命令交换机基本操作:1.进入特权模式Switch>enableSwitch#2.返回用户模式Switch#exitPress RETURN to get started!Switch>配置模式:全局配置模式[主机名(config)#]:配置交换机的整体参数子模式:1.线路配置模式[主机名(config-line)#]:配置交换机的线路参数2.接口配置模式[主机名(config-if)#]:配置交换机的接口参数1.进入、退出全局配置模式Switch#configure terminalSwitch(config)#exitSwitch#2.进入、退出线路配置模式Switch(config)#line console 0Switch(config-line)#exitSwitch(config)#3.进入、退出接口配置模式Switch(config)#interface fastEthernet 0/1Switch(config-if)#exitSwitch(config)#从子模式下直接返回特权模式Switch(config-if)#endSwitch#交换机操作帮助:1.支持命令简写(按TAB键将命令补充完整)2.在每种操作模式下直接输入“”显示该模式下所有的命令3.命令空格“”显示命令参数并对其解释说明4. “字符”显示以该字符开头的命令5.命令历史缓存: (Ctrl+P)显示上一条命令,(Ctrl+N)显示下一条命令6.错误提示信息交换机显示命令:显示交换机硬件及软件的信息 Switch#show version显示当前运行的配置参数 Switch#show running-config显示保存的配置参数 Switch#show configure常用交换机EXEC命令:1.将当前运行的配置参数复制到flash:Switch#write memoryBuilding configuration...[OK]Switch#2.清空flash中的配置参数:Switch#delete flash:Switch#3.交换机重新启动:Switch#reloadSystem configuration has been modified. Save [yes/no]:n Proceed with reload [confirm]4.配置交换机主机名:Switch(config)#hostname S2126G-1S2126G-1(config)#5.配置交换机口令:1) 配置交换机的登陆密码S2126G(config)#enable secret level 1 0 star“0”表示输入的是明文形式的口令2) 配置交换机的特权密码S2126G(config)#enable secret level 15 0 star“0”表示输入的是明文形式的口令常用交换机配置命令:1、为交换机分配管理IP地址S2126G(config)#interface vlan 1S2126G(config-if)#ip address {IP address} {IP subnetmask}[secondary] 2、将接口启用S2126G(config-if)#no shutdown3、将接口关闭S2126G(config-if)#shutdown4、配置接口速率S2126G(config-if)#speed [10|100|auto]5、配置接口双工模式S2126G(config-if)#duplex [auto|full|half]显示接口状态:S2126G#show interface测定目的端的可达性:S2126G>ping {IP address}从TFTP服务器下载配置参数:S2126G#copy tftp startup-config管理交换机MAC地址表:1、查看MAC地址表S2126G#show mac-address-table2、配置MAC地址表记录的生存时间(缺省为300秒)S2126G(config)#mac-address-table aging-time <10-1000000>3、查看MAC地址表记录的生存时间S2126G#show mac-address-table aging-timeVLAN的配置:1.添加一个VLANS2126G(config)#vlan <1-4094>S2126G(config-vlan)#2.为VLAN命名S2126G(config-vlan)#name 名字将交换机端口分配到VLAN1.配置Port VLANSwitch(config-if)#switchport access vlan <1-4094>2.配置Tag VLANSwitch(config-if)#switchport mode trunk1)配置本地(native)VLANSwitch(config-if)#switchport trunk native vlan <1-4094>Native VLAN即PVID,默认情况下每个trunk口的native VLAN 是12)从主干链路中清除VLANSwitch(config-if)#switchport trunk allowed vlan except vlan-list 注:VLAN1不可被清除3)在主干链路中允许所有VLANSwitch(config-if)#switchport trunk allowed vlan all4)向主干链路中加入VLANSwitch(config-if)#switchport trunk allowed vlan add vlan-list VLAN的验证:1.显示全部的VLAN:Switch#show vlan2.显示单独的VLAN :Switch#show vlan id <1-4094>将VLAN信息保存到flash中:Switch#write memory从flash中清除VLAN信息:Switch#delete flash:RSTP的配置:1.启用生成树:S2126G(config)#spanning-tree2.配置交换机优先级:S2126G(config)#spanning-tree priority <0-61440>“0”或“4096”的倍数(RSTP BPDU该值后12bit全0)3.配置交换机端口优先级:S2126G(config-if)#spanning-tree port-priority <0-240>“0”或“16”的倍数(RSTP BPDU该值后4bit全0)4、生成树hello时间的配置(由Root决定):S2126G(config)#spanning-tree hello-time <1-10>5、生成树的验证:Switch#show spanning-treeSwitch#show spanning-tree interface <接口名称> <接口编号>聚合端口的创建:Switch(config)# interface aggregateport 1 创建聚合接口AG1Switch(config-if)# switchport mode trunk 配置并保证AG1为 trunk 模式Switch(config)#int range f0/23-24Switch(config-if-range)#port-group 1 将端口(端口组)划入聚合端口AG1中生成树:Switch(config)#spanning-tree 开启生成树协议Switch(config)#spanning-tree mode stp 指定生成树类型为stp 可选模式stp , rstp , mstpSwitch(config)#spanning-tree priority 4096 设置交换机的优先级为4096 , 优先级值小为高。
交换机命令总结enable进入特权模式exit退出EXECconfigure terminal进入配置模式delete flash:config.text删除配置reload停止并执行热启动hostname {主机名} 配置交换机名interface vlan 1ip address {IP地址}{子网掩码} 指定交换机管理IP地址ip default-gateway {网关IP地址} 指定默认网enable password level 10 {口令} 用户模式口令enable password level 15 0 {口令} 特权模式口令interface type {solt_#}/{port_#} 进入接口no shutdows启用接口shutdows禁用接口duplex {auto | full | half}配置接口的双工模式speed {100/10/auto}配置接口的速率copy running-config startup-configwrite memorywrite 保存配置Vlan vlan_# 建立VLANname vlanname修改VLAN名称switchport mode {access/Trunk} 配置接口模式switchport trunk allowed vlan remove 2把端口配置为Trunk端口,但是不包含VLAN 2no vlan vlan_# 删除VLANswitchport access vlan vlan_#把端口加入VLANShow vlan 显示vlan信息show version 显示IOS版本show interface e0/1 显示接口信息show configure查看保存在FLASH里的配置信息show running-config查看RAM里当前生效的配置三层交换机地址配置方法1:Interface f0/1Switchport access vlan 20Interface vlan 20Ip address 172.16.10.1 255.255.255.0No shutdown方法2:Interface f0/1No switchportIp address 172.16.10.1 255.255.255.0No shutdownSpanning-tree 开启生成树协议Spanning-tree mode stp/rstp 配置生成树协议类型No spanning-tree 关闭生成树协议spanning-tree priority 配置交换机优先级Show spanning-tree显示生成树状态Show spanning-tree interface 端口号显示端山口生成树协议状态interface aggregateport port-number创建一个APport-group port-group-number 将该接口加入一个APshow aggregateport summary查看聚合端口的汇总信息show aggregateport load-balance查看聚合端口的流量平衡方式switchport port-security启用端口安全性no switchport port-security 禁用端口安全性switchport port-security maximum value!设置接口上安全地址的最大个数,范围是1-128,switchport port-security violation{protect|restrict |shutdown}!设置处理违例的方式switchport port-security mac-address mac-address ip-address ip-address !手工配置接口上的安全地址show port-security 查看安全统计信息show port-security address查看安全地址信息路由器配置命令enable进入特权模式exit退出EXECconfigure terminal进入配置模式erase startup-config删除配置copy running-config startup-config保存配置write memorywritereload 停止并执行热启动hostname {主机名} 配置路由器名line console 0 password {口令} Console 口口令line vty {连接号}(0~4)password {口令} login Telnet口令enable password {口令} enable secret {口令} 特权模式口令interface type {solt_#}/{port_#} 进入接口ip address {IP地址}{子网掩码} 指定接口IP地址no shutdows 启用接口shutdows禁用接口no ip address 删除IP地址ip route network [mask] {address | interface}配置静态路由RIP协议配置router rip 开启RIP路由协议进程network {网络ID} 申请本路由器参与RIP协议的直连网段信息version 2 指定RIP协议的版本2(默认是version1)no auto-summary 在RIPv2版本中关闭自动汇总查看RIP配置信息:show ip protocols验证 RIP的配置show ip route 显示路由表的信息clear ip route清除 IP路由表的信息debug ip rip在控制台显示 RIP的工作状态OSPF配置interface loopback 10ip address 192.168.100.1 255.255.255.0创建loopback接口,定义ROUTE IDrouter ospf 10 开启OSPF进程network 10.1.1.0 0.0.0.255 area 0show ip ospf 显示OSPF协议配置信息show ip ospf neighbor 显示OSPF邻居路由器信息show ip ospf interface 显示接口OSPF配置信息网络地址转换:静态NATip nat inside source static local-ip global-ip在内部本地IP地址与内部全局IP地址之间建立转换关系ip nat inside 指定内部接口ip nat outside 指定外部接口动态NAT配置ip nat pool name start-ip end-ip netmask netmask 定义一个全局地址池access-list number permit source-ip sourcewildcard定义一个访问列表,允许需要转换的地址通过ip nat inside source list number pool name 启用动态地址转换动态NAPT配置ip nat inside source list number pool name overload 启用动态端口地址转换ip nat inside source list number interface F1/0 overloadIP标准访问列表的配置:1.标准ACLaccess-list <1-99> {permit|deny} 源地址 [反掩码]定义编号的标准访问列表ip access-list standard < name >{permit|deny}源地址 [反掩码] 定义命名的标准访问列表ip access-group <1-99> { in | out } 应用ACL到接口IP扩展访问列表的配置:1.扩展的ACLaccess-list <100-199> { permit /deny } 协议源地址反掩码 [源端口] 目的地址反掩码 [ 目的端口 ] 定义编号的扩展ACLip access-list extended {name} 定义命名的扩展ACL{ permit /deny } 协议源地址反掩码[源端口] 目的地址反掩码 [ 目的端口 ] (端口号前加:eq)ip access-group <100-199> { in | out } 应用ACL到接口所有协议:IP所有端口:缺省不写缺省的源端口可不写show access-lists显示全部的访问列表show access-lists <1-199> 显示指定的访问列表show ip interface接口名称接口编号显示接口的访问列表应用PPP认证配置:encapsulation hdlc/ppp 给接口封装hdlc或ppp协议PAP认证username uaername password 0 password在验证方建立本地口令数据库,配置被验证方的用户名和密码ppp authentication pap在验证方启用pap认证ppp pap sent-usernane uaername password 0 password在被验证方发送用户名和密码CHAP认证username uaername password password建立本地口令数据库,配置被验证方的用户名和密码ppp authentication chap启用pap认证。
锐捷交换机配置命令1、配置Telnet。
1.1)、enable 进⼊特权模式。
1.2)、configure terminal 进⼊全局配置模式。
1.3)、line vty 0 4 配置远程登陆线路,0~4是远程登陆的线段编号。
1.4)、Login ⽤于打开登陆认证功能。
1.5)、Login local。
1.6)、username admin password 123456 设置⽤户名是admin,登陆密码是123456。
1.7)、en secret 123456 配置的⼝令在配置⽂件中是⽤安全加密的⽅式进⾏存储。
2、常⽤命令。
2.1)、exit 返回上⼀级。
2.2)、end 返回到特权模式。
2.3)、write memory 保存命令(特权模式下执⾏) 2.4)、del config.text 恢复出⼚设置(全局配置模式下执⾏) 2.5)、reload 保存(特权模式下执⾏) 2.6)、show arp 查看设备的IP地址和Mac对应的关系。
3、创建Vlan,为Vlan 设置IP地址。
3.1)、Vlan 50 创建⼀个vlan 50 3.2)、name Vlan50 将创建好的Vlan命名为Vlan50 3.3)、interface vlan 50 进⼊Vlan 50中。
3.4)、ip adress 192.168.1.250 255.255.255.0 设置登陆IP地址。
3.5)、no vlan 50 删除vlan。
4、端⼝基本操作。
4.1)、interface fastethernet 0/4 进⼊端⼝配置模式,也可写成int f0/4。
4.2)、no shutdown 开启端⼝(默认是开启的,⼀般不写这⾏代码)。
4.3)、switchport access vlan 50 将端⼝4加⼊到vlan 50中。
4.3)、no switchport access vlan 将端⼝划回默认valn1中(从Vlan50中删除掉了)。
锐捷交换机配置命令交换机基本操作:1.进入特权模式Switch>enableSwitch#2.返回用户模式Switch#exitPress RETURN to get started!Switch>配置模式:全局配置模式[主机名(config)#]:配置交换机的整体参数子模式:1.线路配置模式[主机名(config-line)#]:配置交换机的线路参数2.接口配置模式[主机名(config-if)#]:配置交换机的接口参数1.进入、退出全局配置模式Switch#configure terminalSwitch(config)#exitSwitch#2.进入、退出线路配置模式Switch(config)#line console 0Switch(config-line)#exitSwitch(config)#3.进入、退出接口配置模式Switch(config)#interface fastEthernet 0/1Switch(config-if)#exitSwitch(config)#从子模式下直接返回特权模式Switch(config-if)#endSwitch#交换机操作帮助:1.支持命令简写(按TAB键将命令补充完整)2.在每种操作模式下直接输入“?”显示该模式下所有的命令3.命令空格“?”显示命令参数并对其解释说明4. “字符?”显示以该字符开头的命令5.命令历史缓存: (Ctrl+P)显示上一条命令,(Ctrl+N)显示下一条命令6.错误提示信息交换机显示命令:显示交换机硬件及软件的信息 Switch#show version显示当前运行的配置参数 Switch#show running-config显示保存的配置参数 Switch#show configure常用交换机EXEC命令:1.将当前运行的配置参数复制到flash:Switch#write memoryBuilding configuration...[OK]Switch#2.清空flash中的配置参数:Switch#delete flash:config.textSwitch#3.交换机重新启动:Switch#reloadSystem configuration has been modified. Save? [yes/no]:nProceed with reload? [confirm]4.配置交换机主机名:Switch(config)#hostname S2126G-1S2126G-1(config)#5.配置交换机口令:1) 配置交换机的登陆密码S2126G(config)#enable secret level 1 0 star“0”表示输入的是明文形式的口令2) 配置交换机的特权密码S2126G(config)#enable secret level 15 0 star“0”表示输入的是明文形式的口令常用交换机配置命令:1、为交换机分配管理IP地址S2126G(config)#interface vlan 1S2126G(config-if)#ip address {IP address} {IP subnetmask}[secondary] 2、将接口启用S2126G(config-if)#no shutdown3、将接口关闭S2126G(config-if)#shutdown4、配置接口速率S2126G(config-if)#speed [10|100|auto]5、配置接口双工模式S2126G(config-if)#duplex [auto|full|half]显示接口状态:S2126G#show interface测定目的端的可达性:S2126G>ping {IP address}从TFTP服务器下载配置参数:S2126G#copy tftp startup-config管理交换机MAC地址表:1、查看MAC地址表S2126G#show mac-address-table2、配置MAC地址表记录的生存时间(缺省为300秒)S2126G(config)#mac-address-table aging-time <10-1000000>3、查看MAC地址表记录的生存时间S2126G#show mac-address-table aging-timeVLAN的配置:1.添加一个VLANS2126G(config)#vlan <1-4094>S2126G(config-vlan)#2.为VLAN命名S2126G(config-vlan)#name 名字将交换机端口分配到VLAN1.配置Port VLANSwitch(config-if)#switchport access vlan <1-4094>2.配置Tag VLANSwitch(config-if)#switchport mode trunk1)配置本地(native)VLANSwitch(config-if)#switchport trunk native vlan <1-4094>Native VLAN即PVID,默认情况下每个trunk口的native VLAN 是12)从主干链路中清除VLANSwitch(config-if)#switchport trunk allowed vlan except vlan-list 注:VLAN1不可被清除3)在主干链路中允许所有VLANSwitch(config-if)#switchport trunk allowed vlan all4)向主干链路中加入VLANSwitch(config-if)#switchport trunk allowed vlan add vlan-listVLAN的验证:1.显示全部的VLAN:Switch#show vlan2.显示单独的VLAN :Switch#show vlan id <1-4094>将VLAN信息保存到flash中:Switch#write memory从flash中清除VLAN信息:Switch#delete flash:vlan.datRSTP的配置:1.启用生成树:S2126G(config)#spanning-tree2.配置交换机优先级:S2126G(config)#spanning-tree priority <0-61440>“0”或“4096”的倍数(RSTP BPDU该值后12bit全0)3.配置交换机端口优先级:S2126G(config-if)#spanning-tree port-priority <0-240>“0”或“16”的倍数(RSTP BPDU该值后4bit全0)4、生成树hello时间的配置(由Root决定):S2126G(config)#spanning-tree hello-time <1-10>5、生成树的验证:Switch#show spanning-treeSwitch#show spanning-tree interface <接口名称> <接口编号>聚合端口的创建:Switch(config)# interface aggregateport 1 创建聚合接口AG1Switch(config-if)# switchport mode trunk 配置并保证AG1为 trunk 模式Switch(config)#int range f0/23-24Switch(config-if-range)#port-group 1 将端口(端口组)划入聚合端口AG1中生成树:Switch(config)#spanning-tree 开启生成树协议Switch(config)#spanning-tree mode stp 指定生成树类型为stp可选模式stp , rstp , mstpSwitch(config)#spanning-tree priority 4096 设置交换机的优先级为4096 , 优先级值小为高。
锐捷交换机主要命令锐捷交换机基本操作1.进入特权模式Switch>enableSwitch#2.返回用户模式Switch#exitPress RETURN to get started! Switch>配置模式:全局配置模式[主机名(config)#]:配置交换机的整体参数子模式:1.线路配置模式[主机名(config-line)#]:配置交换机的线路参数2.接口配置模式[主机名(config-if)#]:配置交换机的接口参数1.进入全局配置模式下Switch#configure terminalSwitch(config)#exitSwitch#2.进入线路配置模式Switch(config)#line console 0 Switch(config-line)#exitSwitch(config)#3.进入接口配置模式Switch(config)#interface fastEthernet 0/1Switch(config-if)#exitSwitch(config)#从子模式下直接返回特权模式Switch(config-if)#endSwitch#交换机操作帮助特点:1.支持命令简写(按TAB键将命令补充完整)2.在每种操作模式下直接输入“?”显示该模式下所有的命令3.命令空格“?”显示命令参数并对其解释说明4.字符“?”显示以该字符开头的命令5.命令历史缓存: (Ctrl+P)显示上一条命令,(Ctrl+N)显示下一条命令6.错误提示信息交换机显示命令:显示交换机硬件及软件的信息Switch#show version显示当前运行的配置参数 Switch#show running-config显示保存的配置参数 Switch#show configure常用交换机EXEC命令将当前运行的配置参数复制到flash:Switch#write memoryBuilding configuration...[OK]Switch#清空flash中的配置参数:Switch#delete flash:config.text Switch#交换机重新启动:Switch#reload System configuration has been modified. Save? [yes/no]:n Proceed with reload? [confirm]配置交换机主机名:Switch(config)#hostname S2126GS2126G(config)#配置交换机口令:1、配置交换机的登陆密码S2126G(config)#enable secret level 1 0 star“0”表示输入的是明文形式的口令2、配置交换机的特权密码S2126G(config)#enable secret level 15 0 Star“0”表示输入的是明文形式的口令常用交换机配置命令:1、为交换机分配管理IP地址S2126G(config)#interface vlan 1S2126G(config-if)#ip address {IP address} {IP subnetmask}[secondary] 2、将接口启用S2126G(config-if)#no shutdown3、将接口关闭S2126G(config-if)#shutdown4、配置接口速率S2126G(config-if)#speed[10|100|auto]5、配置接口双工模式S2126G(config-if)#duplex[auto|full|half显示接口状态:S2126G#showinterfaces测定目的端的可达性:S2126G>ping {IP address}从TFTP服务器下载配置参数:S2126G#copy tftp startup-config管理交换机MAC地址表:1、查看MAC地址表S2126G#show mac-address-table2、配置MAC地址表记录的生存时间(缺省为300秒)S2126G(config)#mac-address-table aging-time <10-1000000>3、查看MAC地址表记录的生存时间S2126G#show mac-address-tableaging-timeVLAN的配置:1.添加一个VLANS2126G(config)#vlan <1-4094>S2126G(config-vlan)#2.为VLAN命名(可选)S2126G(config-vlan)#name将交换机端口分配到VLAN1.配置Port VLANSwitch(config-if)#switchport access vlan <1-4094>2.配置Tag VLANSwitch(config-if)#switchport mode trunk1).配置本地(native)VLANSwitch(config-if)#switchport trunk native vlan <1-4094>2).从主干链路中清除VLANSwitch(config-if)#switchport trunk allowed vlan except注:VLAN1不可被清除VLAN的验证:1.显示全部的VLAN:Switch#show vlan2.显示单独的VLAN :Switch#show vlan id <1-4094>将VLAN信息保存到flash中:Switch#write memory从flash中清除VLAN信息:Switch#delete flash:vlan.dat RSTP的配置:1.启用生成树:S2126G(config)#spanning-tree2.配置交换机优先级:S2126G(config)#spanning-tree priority <0-61440>“0”或“4096”的倍数(RSTP BPDU该值后12bit全0)3.配置交换机端口优先级:S2126G(config-if)#spanning-tree port-priority <0-240>“0”或“16”的倍数(RSTP BPDU该值后4bit全0)4、生成树hello时间的配置(由Root决定):S2126G(config)#spanning-tree hello-time <1-10>5、生成树的验证:Switch#show spanning-treeSwitch#show spanning-tree interface <接口名称> <接口编号>。
锐捷互换机配置命令互换机基本操作:1.进入特权模式Switch>enableSwitch#2.返回用户模式Switch#exitPress RETURN to get started!Switch>配置模式:全局配置模式 [主机名 (config)#]:配置互换机的整体参数xx:1.线路配置模式 [主机名 (config-line)#]:配置互换机的线路参数2.接口配置模式 [主机名 (config-if)#]:配置互换机的接口参数1.进入、退出全局配置模式Switch#configure terminalSwitch(config)#exitSwitch#2.进入、退出线路配置模式Switch(config)#line console 0Switch(config-line)#exitSwitch(config)#3.进入、退出接口配置模式Switch(config)#interface fastEthernet 0/1Switch(config-if)#exitSwitch(config)#从 xx 下直接返回特权模式Switch(config-if)#endSwitch#互换机操作帮助:1.支持命令简写 (按 TAB键将命令增补完好 )2.在每种操作模式下直接输入“ ?显”示该模式下所有的命令3.命令空格“ ?显”示命令参数并对其解说说明4.字“符 ?”显示以该字符开头的命令5.命令历史缓存 : (Ctrl+P)显示上一条命令 ,(Ctrl+N)显示下一条命令6.错误提示信息互换机显示命令:显示互换机硬件及软件的信息Switch#show version显示目前运转的配置参数Switch#show running-config显示保留的配置参数Switch#show configure常用互换机 EXEC命令:1.将目前运转的配置参数复制到flash:Switch#writeBuilding configuration...[OK]Switch#2.清空 flash 中的配置参数:Switch#delete flash:config.textSwitch#3.互换机从头启动:Switch#reloadSystem configuration has been modified. Save? [yes/no]:n Proceed with reload? [confirm]4.配置互换机主机名:Switch(config)#hostname S-1S-1(config)#5.配置互换机口令:1)配置互换机的登岸密码S(config)#enable secret level 1 0star“表示输入的是xx 形式的口令2)配置互换机的特权密码S(config)#enable secret level 15 0star“表示输入的是xx 形式的口令常用互换机配置命令:1、为互换机分派管理IP 地点S(config)#interface vlan 1S(config-if)#ip address {IP address} {IP subnetmask}[secondary] 2、将接口启用S(config-if)#no shutdown3、将接口封闭S(config-if)#shutdown4、配置接口速率S(config-if)#speed [10|100|auto]5、配置接口双工模式S(config-if)#duplex [auto|full|half]显示接口状态:S#show interface测定目的端的可达性:S>ping {IP address}从 TFTP服务器下载配置参数:S#copy tftp startup-config管理互换机 MAC 地点表:1、查察 MAC 地点表S#show mac-address-table2、配置 MAC 地点表记录的生计时间 (缺省为 300 秒)S(config)#mac-address-table aging-time <10-1000000>3、查察 MAC 地点表记录的生计时间S#show mac-address-table aging-timeVLAN的配置:1.增添一个 VLANS(config)#vlan <1-4094>S(config-vlan)#2.为 VLAN命名S(config-vlan)#name名字将互换机端口分派到VLAN1.配置 Port VLANSwitch(config-if)#switchport access vlan <1-4094>2.配置 Tag VLANSwitch(config-if)#switchport mode trunk1)配置当地 (native)VLANSwitch(config-if)#switchport trunk native vlan <1-4094>Native VLAN即 PVID,默认状况下每个trunk 口的 native VLAN 是 1 2)从骨干链路中消除VLANSwitch(config-if)#switchport trunk allowed vlan except vlan-list注 :VLAN1不行被消除3)在骨干链路中同意所有 VLAN Switch(config-if)#switchport trunk allowed vlan all4)向骨干链路中加入VLANSwitch(config-if)#switchport trunk allowed vlan add vlan-list VLAN的考证:1.显示所有的 VLAN:Switch#show vlan2.显示独自的 VLAN :Switch#show vlan id <1-4094>将 VLAN信息保留到 flashxx:Switch#write memory从 flashxx 消除 VLAN信息:Switch#delete flash:vlan.datRSTP的配置:1.启用生成树:S(config)#spanning-tree2.配置互换机优先级:S(config)#spanning-tree priority <0-61440>“或“的倍数 (RSTP BPDU该值后 12bit 全 0)3.配置互换机端口优先级:S(config-if)#spanning-tree port-priority <0-240>“或“的倍数 (RSTP BPDU该值后 4bit 全 0)4、生成树 hello 时间的配置 (由 Root 决定 ):S(config)#spanning-tree hello-time <1-10>5、生成的: Switch#show spanning-treeSwitch#show spanning-tree interface <接口名称 > <接口号 >聚合端口的建:Switch(config)# interface aggregateport 1建聚合接口AG1Switch(config-if)# switchport mode trunk配置并保AG1trunk 模式Switch(config)#int range f0/23-24Switch(config-if-range)#port-group 1 将端口(端口)划入聚合端口 AG1xx 生成:Switch(config)#spanning-tree 开启生成Switch(config)#spanning-tree mode stp 指定生成型stp可模式 stp , rstp , mstpSwitch(config)#spanning-tree priority 4096 置交机的先 4096 , 先小高。
锐捷交换机配置命令交换机基本操作1.进入特权模式Switch>enableSwitch#2.返回用户模式Switch#exitPress RETURN to get started!Switch>配置模式:全局配置模式[主机名(config)#]:配置交换机的整体参数子模式:1.线路配置模式[主机名(config-line)#]:配置交换机的线路参数2.接口配置模式[主机名(config-if)#]:配置交换机的接口参数1.进入全局配置模式下Switch#configure terminalSwitch(config)#exitSwitch#2.进入线路配置模式Switch(config)#line console 0Switch(config-line)#exitSwitch(config)#3.进入接口配置模式Switch(config)#interface fastEthernet 0/1Switch(config-if)#exitSwitch(config)#从子模式下直接返回特权模式Switch(config-if)#endSwitch#交换机操作帮助特点:1.支持命令简写(按TAB键将命令补充完整)2.在每种操作模式下直接输入“?”显示该模式下所有的命令3.命令空格“?”显示命令参数并对其解释说明4.字符“?”显示以该字符开头的命令5.命令历史缓存: (Ctrl+P)显示上一条命令,(Ctrl+N)显示下一条命令6.错误提示信息交换机显示命令:显示交换机硬件及软件的信息 Switch#show version显示当前运行的配置参数 Switch#show running-config显示保存的配置参数 Switch#show configure常用交换机EXEC命令将当前运行的配置参数复制到flash:Switch#write memoryBuilding configuration...[OK]Switch#清空flash中的配置参数:Switch#delete flash:config.textSwitch#交换机重新启动:Switch#reloadSystem configuration has been modified. Save? [yes/no]:nProceed with reload? [confirm]配置交换机主机名:Switch(config)#hostname S2126GS2126G(config)#配置交换机口令:1、配置交换机的登陆密码S2126G(config)#enable secret level 1 0 star“0”表示输入的是明文形式的口令2、配置交换机的特权密码S2126G(config)#enable secret level 15 0 Star“0”表示输入的是明文形式的口令常用交换机配置命令:1、为交换机分配管理IP地址S2126G(config)#interface vlan 1S2126G(config-if)#ip address {IP address} {IP subnetmask}[secondary] 2、将接口启用S2126G(config-if)#no shutdown3、将接口关闭S2126G(config-if)#shutdown4、配置接口速率S2126G(config-if)#speed [10|100|auto]5、配置接口双工模式S2126G(config-if)#duplex [auto|full|half显示接口状态:S2126G#show interfaces测定目的端的可达性:S2126G>ping {IP address}从TFTP服务器下载配置参数:S2126G#copy tftp startup-config管理交换机MAC地址表:1、查看MAC地址表S2126G#show mac-address-table2、配置MAC地址表记录的生存时间(缺省为300秒)S2126G(config)#mac-address-table aging-time <10-1000000>3、查看MAC地址表记录的生存时间S2126G#show mac-address-table aging-timeVLAN的配置:1.添加一个VLANS2126G(config)#vlan <1-4094>S2126G(config-vlan)#2.为VLAN命名(可选)S2126G(config-vlan)#name将交换机端口分配到VLAN1.配置Port VLANSwitch(config-if)#switchport access vlan <1-4094>2.配置Tag VLANSwitch(config-if)#switchport mode trunk1).配置本地(native)VLANSwitch(config-if)#switchport trunk native vlan <1-4094>2).从主干链路中清除VLANSwitch(config-if)#switchport trunk allowed vlan except注:VLAN1不可被清除VLAN的验证:1.显示全部的VLAN:Switch#show vlan2.显示单独的VLAN :Switch#show vlan id <1-4094>将VLAN信息保存到flash中:Switch#write memory从flash中清除VLAN信息:Switch#delete flash:vlan.datRSTP的配置:1.启用生成树:S2126G(config)#spanning-tree2.配置交换机优先级:S2126G(config)#spanning-tree priority <0-61440> “0”或“4096”的倍数(RSTP BPDU该值后12bit全0)3.配置交换机端口优先级:S2126G(config-if)#spanning-tree port-priority <0-240>“0”或“16”的倍数(RSTP BPDU该值后4bit全0)4、生成树hello时间的配置(由Root决定):S2126G(config)#spanning-tree hello-time <1-10>5、生成树的验证:Switch#show spanning-treeSwitch#show spanning-tree interface <接口名称> <接口编号>以上用于锐捷交换机的。
一、交换机基本配置 1、交换机命名: 在项目实施的时候,建议为处于不同位置的交换机命名,便于记忆,可提高后期管理效率。 switch(config)#hostname ruijie //ruijie为该交换机的名字
2、交换机配置管理密码:
配置密码可以提高交换机的安全性,另外,telnet登录交换机的时候,必须要求有telnet管理密码。 switch (config)#enable secret level 1 0 rg //配置telnet管理密码为rg,其中1表示telnet密码,0表示密码不加密
switch (config)#enable secret level 15 0 rg //配置特权模式下的管理密码rg,其中15表示为特权密码
3、交换机配置管理IP
switch (config)#interface vlan 1 //假设管理VLAN为VLAN 1 switch (config-if)#ip address 192.168.1.1 255.255.255.0 //给管理VLAN配置管理IP地址 switch (config-if)#no shutdown //激活管理IP,养成习惯,无论配置什么设备,都使用一下这个命令
4、交换机配置网关:
switch(config)#ip default-gateway 192.168.1.254 //假设网关地址为192.168.1.254,此命令用户二层设备。 通过以上几个命令的配置,设备便可以实现远程管理,在项目实施时(尤其是设备位置比较分散)特别能提高效率。
二、接口介质类型配置
锐捷为了降低SME客户的总体拥有成本,推出灵活选择的端口形式:电口和光口复用接口,方便用户根据网络环境选择对应的介质类型。
但光口和电口同时只能用其一,如图1,如使用了光口1F,则电口1不能使用。
1、接口介质类型的转换:
Switch(config)#interface gigabitethernet 0/25-28 Interface fastethernet 0/2 Switch(config-if)#medium-type fiber //把接口工作模式改为光口 Switch(config-if)#medium-type copper //把接口工作模式改为电口 默认情况下,接口是工作在电口模式 在项目实施中,如果光纤模块指示灯不亮,工作模式是否正确也是故障原因之一。
2、接口速度/双工配置
命令格式: Switch(config)#interface interface-id //进入接口配置模式 Switch(config-if)#speed {10 | 100 | 1000 | auto } //设置接口的速率参数,或者设置为auto Switch(config-if)#duplex {auto | full | half} //设置接口的双工模式 1000只对千兆口有效; 默认情况下,接口的速率为auto,双工模式为auto。 配置实例: 实例将gigabitethernet 0/1的速率设为1000M,双工模式设为全双工: Switch(config)#interface gigabitethernet 0/25 Switch(config-if)#speed 1000 Switch(config-if)#duplex full 在故障处理的时候,如果遇到规律性的时断时续或掉包,在排除其他原因后,可以考虑是否和对端设备的速率和双工模式不匹配,尤其是两端设备为不同厂商的时候。 光口不能修改速度和双工配置,只能auto。
三、VLAN配置
添加VLAN到端口: 在交换机上建立VLAN: Switch (config)#vlan 100 //建立VLAN 100 Switch (config)#name ruijie //该VLAN名称为ruijie 将交换机接口划入VLAN 100中: Switch (config)#interface range f 0/1-48 //range表示选取了系列端口1-48,这个对多个端口进行相同配置时非常有用 Switch (config-if-range)#switchport access vlan 100 //将接口划到VLAN 100中 Switch (config-if-range)#no switchport access vlan //将接口划回到默认VLAN 1中,即端口初始配置 交换机端口的工作模式: Switch(config)#interface fastEthernet 0/1 Switch(config-if)#switchport mode access //该端口工作在access模式下 Switch(config-if)#switchport mode trunk //该端口工作在trunk模式下 如果端口下连接的是PC,则该端口一般工作在access模式下,默认配置为access模式。 如果端口是上联口,且交换机有划分多个VLAN,则该端口工作在TRUNK模式下。 如图2:端口F0/1、F0/2、F0/3都必须工作在TRUNK模式下。 NATIVE VLAN配置: Switch(config)#interface fastEthernet 0/1 Switch(config-if)#switchport mode trunk Switch(config-if)#switchport trunk native vlan 100 //设置该端口NATIVE VLAN为100 端口只有工作在TRUNK模式下,才可以配置NATIVE VLAN; 在TRUNK上Native VLAN的数据是无标记的(Untagged),所以即使没有在端口即使没有工作在TRUNK模式下,Native Vlan仍能正常通讯; 默认情况下,锐捷交换机的NATIVE VLAN为1。建议不要更改。 VLAN修剪配置: Switch(config)#interface fastEthernet 0/2 Switch(config-if)#switchport trunk allowed vlan remove 2-9,11-19,21-4094 //设定VLAN要修剪的VLAN Switch(config-if)#no switchport trunk allowed vlan //取消端口下的VLAN修剪VLAN1是设备默认VLAN,VLAN10和VLAN20是用户VLAN,所以需要修剪掉的VLAN为2-9,11-19,21-4094。(4094为VLAN ID的最大值) VLAN信息查看: Switch#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa0/1 ,Fa0/11,Fa0/12 Fa0/13,Fa0/14,Fa0/15 Fa0/16,Fa0/17,Fa0/18 Fa0/19,Fa0/20,Fa0/21 Fa0/22,Fa0/23,Fa0/24 100 VLAN0100 active Fa0/1 ,Fa0/2 ,Fa0/3 Fa0/4 ,Fa0/5 ,Fa0/6 Fa0/7 ,Fa0/8 ,Fa0/9 Fa0/10 Switch#
四、端口镜像
端口镜像配置: Switch (config)# monitor session 1 destination interface GigabitEthernet 0/2 //配置G0/2为镜像端口 Switch (config)# monitor session 1 source interface GigabitEthernet 0/1 both //配置G0/1为被镜像端口,且出入双向数据均被镜像。 Switch (config)# no monitor session 1 //去掉镜像1 S21、S35等系列交换机不支持镜像目的端口当作普通用户口使用,如果需要做用户口,请将用户MAC与端口绑定。 锐捷SME交换机镜像支持一对多镜像,不支持多对多镜像。 去除TAG标记: Switch (config)# monitor session 1 destination interface GigabitEthernet 0/2 encapsulation replicate // encapsulation replicate表述镜像数据不带TAG标记。 目前该功能只有S37、S57、S86、S96交换机支持,其他型号交换机不支持。 锐捷交换机支持两种模式: 镜像目的口输出报文是否带TAG根据源数据流输入的时候是否带TAG来决定。 强制所有的镜像输出报文都不带TAG ,受限于目前芯片的限制,只支持二层转发报文不带Tag,经过三层路由的报文,镜像目的端口输出的报文会带Tag。 端口镜像信息查看: S3750#sh monitor session 1 Session: 1 Source Ports: Rx Only : None Tx Only : None Both : Fa0/1 Destination Ports: Fa0/2 encapsulation replicate: true
五、端口聚合
端口聚合配置: Switch(config)#interface fastEthernet 0/1 Switch (config-if)#port-group 1 //把端口f0/1加入到聚合组1中。 Switch (config-if)#no port-group 1 //把端口f0/1从聚合组1中去掉。 如图4,端口聚合的使用可以提高交换机的上联链路带宽和起到链路冗余的作用。 S2126G/50G交换机最大支持的6个AP,每个AP最多能包含8个端口。6号AP只为模块1和模块2保留,其它端口不能成为该AP的成员,模块1和模块2也只能成为6号AP的成员。 S2700 系列交换机最大支持的31个AP,每个AP 最多能包含8个端口。 S3550-24/48系列交换机最大支持的6个AP,每个AP最多能包含8个端口。 S3550-12G/12G+/24G系列交换机最大支持的12个AP,每个AP最多能包含8个端口。 S3550-12SFP/GT系列交换机最大支持的12个AP,每个AP最多能包含8个端口。 57系列交换机最大支持12个AP,每个AP最多能包含个8端口。 配置为AP的端口,其介质类型必须相同。 聚合端口需是连续的端口,例如避免把端口1和端口24做聚合。 端口聚合信息查看: S3750#show aggregatePort 1 summary //查看聚合端口1的信息。 AggregatePort MaxPorts SwitchPort Mode Ports