锐捷基本命令大全.doc_第1页
锐捷基本命令大全.doc_第2页
锐捷基本命令大全.doc_第3页
锐捷基本命令大全.doc_第4页
锐捷基本命令大全.doc_第5页
已阅读5页,还剩18页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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为普通用户级别,可选为115,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 , 优先级值小为高。优先级可选值为0,4096,8192,为4096的倍数。交换机默认值为32768VLAN的基本配置(config)#vlan 10 创建VLAN10(config-vlan)#name vlanname 命名VLAN为vlanname(config-if)#switchport access vlan 10 将该端口划入VLAN10中某端口的接口配置模式下进行(config)#interface vlan 10 进入VLAN 10的虚拟端口配置模式(config-if)# ip address 为VLAN10的虚拟端口配置IP及掩码,二层交换机只能配置一个IP,此IP是作为管理IP使用,例如,使用Telnet的方式登录的IP地址(config-if)# no shutdown 启用该端口端口安全(config)# interface fastethernet 0/1 进入一个端口(config-if)# switchport port-security 开启该端口的安全功能1配置最大连接数限制(config-if)# switchport port-secruity maxmum 1 配置端口的最大连接数为1,最大连接数为128(config-if)# switchport port-secruity violation shutdown 配置安全违例的处理方式为shutdown,可选为protect (当安全地址数满后,将未知名地址丢弃)、restrict(当违例时,发送一个Trap通知)、shutdown(当违例时将端口关闭,并发送Trap通知,可在全局模式下用errdisable recovery来恢复)2IP和MAC地址绑定(config-if)#switchport port-security mac-address xxxx.xxxx.xxxx ip-address 接口配置模式下配置MAC地址xxxx.xxxx.xxxx和IP进行绑定(MAC地址注意用小写)三层路由功能(针对三层交换机)(config)# ip routing 开启三层交换机的路由功能(config)# interface fastethernet 0/1 (config-if)# no switchport 开启端口的三层路由功能(这样就可以为某一端口配置IP)(config-if)# ip address (config-if)# no shutdown 三层交换机路由协议(config)# ip route 配置静态路由注: 为目标网络的网络号及子网掩码 为下一跳的地址,也可用接口表示,如ip route serial 1/2(所接的端口)(config)# router rip 开启RIP协议进程(config-router)# network 申明本设备的直连网段信息(config-router)# version 2 开启RIP V2,可选为version 1(RIPV1)、version 2(RIPV2) (config-router)# no auto-summary 关闭路由信息的自动汇总功能(只有在RIPV2支持)(config)# router ospf 开启OSPF路由协议进程(针对1762,无需使用进程ID)(config)# router ospf 1 开启OSPF路由协议进程(针对2501,需要加OSPF进程ID)(config-router)# network 55 area 0 申明直连网段信息,并分配区域号(area0为骨干区域)IP ACL:交换机采用命名的访问控制列表;分标准(stand)和扩展(extended)两种1.标准ACL(config)#ip access-list stand listname 定义命名标准列表,命名为listname,stand为标准列表(config-std-nacl)#deny 55 拒绝来自网段的IP流量通过注:deny:拒绝通过;可选:deny(拒绝通过)、permit(允许通过) 55:源地址及源地址通配符;可使用any表示任何IP(config-std-nacl)#permit any(config-std-nacl)#end 返回2.扩展ACL(config)#ip access-list extended listname 定义命名扩展列表,命名为listname,extended为扩展(config-ext-nacl)#deny tcp 55 55 eq www 拒绝源地址为网段的IP访问目的地址为网段的WWW服务注:deny:拒绝通过,可选:deny(拒绝通过)、permit(允许通过)tcp: 协议名称,协议可以是udp, ip,eigrp, gre, icmp, igmp, igrp等等。 55:源地址及源地址通配符 55:目的地址及目的地址通配符eq:操作符(lt-小于,eq-等于,gt-大于,neg-不等于,range-包含) www:端口号,可使用名称或具体编号可以使用的协议名称(或编号)和端口名称(或编号)请打?查询。(config-ext-nacl)#permit ip any any 允许其它通过(config-ext-nacl)#end 返回(config)#interface vlan 10 进入端口配置模式(config-if)# ip access-group listname in 访问控制列表在端口下in方向应用;可选:in(入栈)、out(出栈)(config-if)#end 返回注:配置ACL时,若只想对其中部分IP进行限制访问时,必须配置允许其流量通过,否则设备只会对限制IP进行处理,不会对非限制IP进行允许通过处理。在锐捷交换机上配置vrrp、arp和mstp交换机密码1234(config)#enable secret level 1 0 1001234(config)#enable secret level 15 0 100远程登入密码1234(config)#line vty 0 41234(config-line)#password 1001234(config-line)#end交换机管理IP1234(config)#interface vlan 11234(config-if)#ip address 0 1234(config-if)#no shutdown修改交换机老化时间1234(config)#mac-address-table aging-time 201234(config)#end添删vlan1234(config)#vlan 8881234(config-vlan)#name a8881234(config)#no vlan 888添加access口1234(config)#interface gigabitEthernet 0/101234(config-if)#switchport mode access1234(config-if)#switchport access vlan 10切换assess trunk1234(config-if)#switchport mode access1234(config-if)#switchport mode trunk指定特定一个native vlan1234(config-if)#switchport trunk native vlan 10配置trunk口的许可vlan列表1234(config-if)#switchport trunk allowed vlan ?add Add VLANs to the current listall All VLANsexcept All VLANs except the followingremove Remove VLANs from the current list速成树协议1234(config)#spanning-tree1234(config)#spanning-tree mode rstp/stp配置网关:switch(config)#ip default-gateway 54 交换机基本配置-常见查看命令查看CPU利用率show cpu 查看交换机时钟show clock 查看交换机日志show logging 查看交换机动态学习到的MAC地址表 show mac-address-table dynamic 查看当前交换机运行的配置文件show running-config 查看交换机硬件、软件信息show version查看交换机的arp表show arp显示接口详细信息的命令show interfaces gigabitEthernet 4/1 counters接口配置Switch(config)#interface gigabitethernet 0/1 把接口工作模式改为光口。Switch(config-if)#medium-type fiber把接口工作模式改为电口。Switch(config-if)#medium-type copper速度/双工配置进入接口配置模式。Switch(config)#interface interface-id设置接口的速率参数,或者设置为auto。 Switch(config-if)#speed 10 | 100 | 1000 | auto 设置接口的双工模式。Switch(config-if)#duplex auto | full | half 例子Switch(config)#interface gigabitethernet 0/1 Switch(config-if)#speed 1000Switch(config-if)#duplex full 光口不能修改速度和双工配置,只能auto。在故障处理的时候,如果遇到规律性的时断时续或掉包,在排除其他原因后,可以考虑是否和对端设备的速率和双工模式不匹配,尤其是两端设备为不同厂商的时候。VLAN建立VLAN 100Switch (config)#vlan 100该VLAN名称为ruijieSwitch (config)#name ruijie将交换机接口划入VLAN 中:range表示选取了系列端口1-48,这个对多个端口进行相同配置时非常有用。Switch (config)#interface range f 0/1-48 将接口划到VLAN 100中。Switch (config-if-range)#switchport access vlan 100 将接口划回到默认VLAN 1中,即端口初始配置。Switch (config-if-range)#no switchport access vlan Switch(config)#interface fastEthernet 0/1该端口工作在access模式下Switch(config-if)#switchport mode access 该端口工作在trunk模式下Switch(config-if)#switchport mode trunk Switch(config)#interface fastEthernet 0/2设定VLAN要修剪的VLAN。Switch(config-if)#switchport trunk allowed vlan remove 2-9,11-19,21-4094取消端口下的VLAN修剪。Switch(config-if)#no switchport trunk allowed vlan 生成树开启生成树协议。Switch(config)#spanning-tree禁止生成树协议。Switch(config)#no spanning-tree配置生成树优先级:配置设备优先级为4096。Switch(config)#spanning-tree priority 4096 数值越低,优先级别越高。端口镜像配置G0/2为镜像端口。Switch (config)# monitor session 1 destination interface G 0/2配置G0/1为被镜像端口,且出入双向数据均被镜像。Switch (config)# monitor session 1 source interface G 0/1 both去掉镜像1。Switch (config)# no monitor session 1 端口聚合Switch(config)#interface fastEthernet 0/1把端口f0/1加入到聚合组1中。Switch (config-if)#port-group 1把端口f0/1从聚合组1中去掉Switch (config-if)#no port-group 1建立ACL:建立ACL访问控制列表名为ruijie,extend表示建立的是扩展访Switch(config)# Ip access-list exten ruijie 问控制列表。添加ACL的规则:禁止PING IP地址为的设备。Switch (config-ext-nacl)#deny icmp any 禁止端口号为135的应用。Switch (config-ext-nacl)# deny tcp any any eq 135禁止协议为www的应用。Switch (config-ext-nacl)#deny udp any any eq www 允许所有行为。Switch(config-ext-nacl)# permit ip any any将ACL应用到具体的接口上:Switch (config)#interface range f 0/1把名为ruijie的ACL应用到端口f 0/1上。Switch (config-if)#ip access-group ruijie in 从接口去除ACL。 Switch (config-if)#no ip access-group ruijie in 删除ACL:删除名为ruijie的ACL。Switch(config)#no Ip access-list exten ruijie 增加ACE项后,是增加到ACL最后,不可以中间插入,如果要调整ACE的顺序,必须整个删除ACL后再重新配置。端口安全Switch (config)#interface range f 0/1开启端口安全。Switch(config-if)# switchport port-security 关闭端口安全。Switch(config-if)# no switchport port-security设置端口能包含的最大安全地址数为8。Switch(config-if)# switchport port-security maximum 8 在接口fastethernet0/1配置一个安全地址00d0.f800.073c,并为其绑定一个IP地址 Switch(config-if)# switchport port-security mac-address 00d0.f800.073c ip-address 删除接口上配置的安全地址。Switch(config-if)#no switchport port-security mac-address 00d0.f800.073c ip-address 防ARP攻击IP和MAC地址的绑定Switch(config)#arp ip-address hardware-address type interface-idSwitch(config)#arp 11 00d0.f800.073c arpa g 0/1绑定网关进入指定端口进行配置。Switch(config)#Interface interface-id配置防止ip-address的ARP欺骗。Switch(config-if)#Anti-ARP-Spoofing ip ip-address防STP攻击进入端口Fa0/1。Switch(config)# inter fastEthernet 0/1 打开该端口的的BPDU guard功能。Switch(config-if)# spanning-tree bpduguard enable 关闭该端口的的BPDU guard功能。 Switch(config-if)# spanning-tree bpduguard diaable端口关闭后只能shutdown然后再no shutdown或者重新启动交换机才能恢复! 防DOS/DDOS攻击进入端口Fa0/1。 Switch(config)# inter fastEthernet 0/1 预防伪造源IP的DOS攻击的入口过滤功能。Switch(config-if)#ip deny spoofing-source关闭入口过滤功能只能在三层接口上配置。Switch(config-if)#no ip deny spoofing-source 和ACL不能同时存在。端口关闭后只能shutdown然后再no shutdown或者重新启动交换机才能恢复!防IP扫描攻击配置:打开系统保护。Switch(config)#system-guard enable关闭系统保护功能。Switch(config)#no system-guardDHCP配置打开DHCP Relay Agent: Switch(config)#service dhcp 配置DHCP Server的IP地址: Switch(config)#ip helper-address address VRRP配置Switch(config)#Interface interface-id Switch(config-if)#Standby group-number ip ip-address 设置虚拟机的优先级。standby group-number priority priority 三层交换机配置SVI:把VLAN 10配置成SVI。switch (config)#interface vlan 10给该SVI接口配置一个IP地址switch (config-if)#ip address Routed Port: switch (config)#interface fa 0/1把f 0/1变成路由口。switch (config-if)#no switch 路由配置:添加一条路由。switch (config)#ip route 目的地址 掩码 下一跳 switch (config)#ip route 配置多生成树协议:switch(config)#spanning-tree /开启生成树协议switch(config)#spanning-tree mst configuration /建立多生成树协议switch(config-mst)#name ruijie /命名为ruijieswitch(config-mst)#revision 1 /设定校订本为1switch(config-mst)#instance 0 vlan 10,20 /建立实例0switch(config-mst)#instance 1 vlan 30,40 /建立实例1switch(config)#spanning-tree mst 0 priority 4096 /设置优先级为4096switch(config)#spanning-tree mst 1 priority 8192 /设置优先级为8192switch(config)#interface vlan 10switch(config-if)#vrrp 1 ip /此为vlan 10的IP地址switch(config)#interface vlan 20switch(config-if)#vrrp 1 ip /此为vlan 20的IP地址switch(config)#interface vlan 30switch(config-if)#vrrp 2 ip /此为vlan 30的IP地址(另一三层交换机)switch(config)#interface vlan 40switch(config-if)#vrrp 2 ip /此为vlan 40的IP地址(另一三层交换机)此配置需在两个三层交换机和二层交换机上进行配置!在二层交换机上不用配置VRRP!冗余链路在骨干网设备连接中,单一链路的连接很容易实现,但一个简单的故障就会造成网络的中断.因此在实际网络组建的过程中,为了保持网络的稳定性,在多台交换机组成的网络环境中,通常都使用一些备份连接,以提高网络的健壮性、稳定性.这里的备份连接也称为备份链路或者冗余链路.备份链路之间的交换机经常互相连接,形成一个环路,通过环路可以在一定程度上实现冗余.链路的冗余备份能为网络带来健壮性、稳定性和可靠性等好处,但是备份链路也会使网络存在环路,环路问题是备份链路所面临的最为严重的问题,交换机之间的环路将导致网络新问题的发生:广播风暴多帧复制地址表的不稳定解决方法:生成树协议避免环路每个LAN都会选择一台设备为指定交换机,通过该设备的端口连接到根,该端口为指定端口( Designated port )将交换网络中所有设备的根端口(RP)和指定端口(DP)设为转发状态(Forwarding),将其他端口设为阻塞状态(Blocking)生成树经过一段时间(默认值是50秒左右)稳定之后,所有端口要么进入转发状态,要么进入阻塞状态。IEEE 802.1w快速生成树协议快速生成树协议概述快速生成树协议RSTP(Rapid Spannning Tree Protocol) IEEE 802.1w RSTP协议在STP协议基础上做了改进,使得收敛速度快得多(最快1秒以内)生成树协议的配置开启生成树协议Switch(config)#Spanning-tree关闭生成树协议Switch(config)#no Spanning-tree配置生成树协议的类型Switch(config)#Spanning-tree mode stp/rstp锐捷全系列交换机默认使用MSTP协议配置交换机优先级Switch(config)#spanning-tree priority (“0”或“4096”的倍数、共16个、缺省32768)恢复到缺省值Switch(config)# nospanning-tree priority配置交换机端口的优先级Switch(config)#interface interface-type interface-numberSwitch(config-if)#spanning-tree port-priority number显示生成树状态Switch#show spanning-tree显示端口生成树协议的状态Switch#show spanning-tree interface fastethernet 生成树协议概述生成树协议(spanning-tree protocol)由IEEE 802.1d标准定义生成树协议的作用是为了提供冗余链路,解决网络环路问题生成树协议通过SPA(生成树算法)生成一个没有环路的网络,当主要链路出现故障时,能够自动切换到备份链路,保证网络的正常通信配置模式: 全局配置模式switch(config)# 配置交换机的整体参数 接口配置模式switch(config-if)# 配置交换机的接口参数 进入全局配置模式 Switchc onfigure terminal Switch(config)#exit Switch# 进入接口配置模式 Switch(config)#interface fastethernet 0/1 Switch(config-if)#exit Switch(config)# 从子模式下直接返回特权模式 Switch(config-if)#end Switch# 命令行其他功能 获得帮助 switch#? switch#show ? 命令简写 全写:switch# configure terminal 简写:Switch# config 使用历史命令 Switch# (向上键) Switch# (向下键) 配置交换机Telnet功能 配置远程登陆密码 Switch(config)#enable secret level 1 0 ruijie 配置进入特权模式密码 Switch (config)#enable secret level 15 0 ruijie 为交换机配置管理IP Switch (config)#interface vlan 1 Switch (config-if)#no shutdown Switch (config-if)#ip address Switch (config-if)#end 配置文件的管理 保存配置 将当前运行的参数保存到flash 中用于系统初始化时初始化参数 Switch#copy running-config startup-config Switch#write memory Switch#write 删除配置 永久性的删除flash 中不需要的文件 使用命令delete flash:config.text 删除当前的配置: 在配置命令前加no 例:switch(config-if)# no ip address 查看配置文件内容 Switch#show configure 查看保存在FLASH里的配置信息 Switch#show running-config 查看RAM里当前生效的配置 配置Port VLAN 创建VLAN10,将它命名为test的例子 Switch# configure terminal Switch(config)# vlan 10 Switch(config-vlan)# name test Switch(config-vlan)# end 把接口 0/10加入VLAN10 Switch# configure terminal Switch(config)# interface fastethernet 0/10 Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan 10 Switch(config-if)# end 将一组接口加入某一个VLAN Switch(config)#interface range fastethernet 0/1-8,0/15,0/20 Switch(config-if-range)# switchport access vlan 20 注:连续接口 0/1-8,不连续接口用逗号隔开,但一定要写明模块编号 配置Tag VLAN-Trunk 把Fa0/1配成Trunk口 Switch# configure terminal Switch(config)# interface fastethernet0/1 Switch(config-if)# switchport mode trunk 把端口Fa0/20 配置为Trunk端口,但是不包含VLAN 2: Switch(config)# interface fastethernet 0/20 Switch(config-if)# switchport trunk allowed vlan remove 2 Switch(config-if)# end Native VLAN 配置命令: Switch(config-if)# switchport trunk native vlan 20 Switch(config-if)# end 注意: 每个Trunk口的缺省native VLAN是VLAN 1 在配置Trunk链路时,请确保连接链路两端的Trunk口属于相同的native VLAN 保存/清除VLAN信息 将VLAN信息保存到flash中 Switch#write memory 从flash中只清除VLAN信息 Switch#delete flash:vlan.dat 从RAM中删除VLAN Switch(config)#no vlan VLAN-id 生成树协议的配置 开启生成树协议 Switch(config)#Spanning-tree 关闭生成树协议 Switch(config)#no Spanning-tree 配置生成树协议的类型 Switch(config)#Spanning-tree mode stp/rstp 锐捷全系列交换机默认使用MSTP协议 配置交换机优先级 Switch(config)#spanning-tree priority (“0”或“4096”的倍数、共16个、缺省32768) 恢复到缺省值 Switch(config)# no spanning-tree priority 配置交换机端口的优先级 Switch(config)#interface interface-type interface-number Switch(config-if)#spanning-tree port-priority number 配置STP、RSTP Spanning Tree 的缺省配置: 关闭STP STP Priority 是32768 STP port Priority 是128 STP port cost 根据端口速率自动判断 Hello Time 2秒 Forward-delay Time 15秒 Max-age Time 20秒 可通过spanning-tree reset 命令让spanning tree参数恢复到缺省配置 查看生成树协议配置 显示生成树状态 Switch#show spanning-tree 显示端口生成树协议的状态 Switch#show spanning-tree interface fastethernet 配置aggregate port 将该接口加入一个AP Switchc onfigure terminal Switch(config) # interface interface-type interface-id Switch(config-if-range)#port-group port-group-number 如果这个AP不存在,可自动创建AG端口 查看聚合端口的汇总信息 Switch#show aggregateport summary 查看聚合端口的流量平衡方式 Switch#show aggregateport load-balance 路由器上配置telnet 第一步: 配置端口地址 Rout

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论