思科路由器命令大全(完整版)
- 格式:docx
- 大小:10.93 KB
- 文档页数:4
Cisco路由器命令总结2010-05-06 15:03路由器命令状态:>> 路由器处于rxboot状态,开机60秒内按ctrl+break可进入此状态用于软件升级和手工引导.router>用户命令状态,只能查看一些基本信息router#特权命令状态router(config)#全局设置状态router(config-if)#接口设置状态路由器口令设置:router>enable 进入特权模式router#config terminal 进入全局配置模式router(config)#hostname <hostname> 设置交换机的主机名router(config)#enable secret xxx 设置特权加密口令router(config)#enable password xxx 设置特权非密口令控制台口令router(config)#line console 0 进入控制台口router(config-line)#login 要求口令验证router(config-line)#password xx 设置登录口令使用Telnet远程式管理router(config)#line vty 0 4 进入虚拟终端router(config-line)#login 要求口令验证router(config-line)#password xx 设置登录口令路由器基本配置:router(config)#int s0/0 <f0/1> 进入Serail接口router(config-if)#ip address <ip> <netmask> 设置IP地址router(config-if)#ip address <ip><netmask> second 设置第二个IP router(config-if)#description to ***** 接口描述router(config-if)#no shutdown 激活当前接口router(config-if)#clock rate 64000 设置同步时钟 (仅用于串口)router(config-if)#clock rate 64 设置带宽 (仅用于串口)router(config-if)#ip ospf authentication-key 口令为ospf设置认证(不加密)router(config-if)#ip ospf message-digest-key <钥匙号>md5 口令为ospf设置md5认证router(config-if)#no ip ospf message-digest-key <钥匙号>md5 口令为ospf设置md5认证router(config)#int f0/0.1 进入子接口router(config-subif.1)#ip address <ip><netmask> 设置子接口IP router(config-subif.1)#encapsulation dot1q <isl>序号绑定vlan中继协议 (vlan三层路由)注: dot1q 为IEEE802.1Q标准 isl为思科专用router#write 保存配置信息router#copy running-config startup-config 保存当前配置nvramrouter#debug ip rip<events> 监测配置router#no debug ip all 关闭监测配置router#reload 重新起动router#erase startup-config 清除配置文件路由器显示命令:router#show run 显示配置信息router#show interface 显示接口信息router#show ip route 显示路由信息router#show ip arp 显示arp缓存router#show cdp nei 显示邻居信息静态路由:router(config)#ip route <ip-address> <subnet-mask> <下一跳><distance> 命令格式注: distance 改变默认管理开销router(config)#ip route 0.0.0.0 0.0.0.0 <下一跳> 默认路router(config)#ip classless 数据包不能转发时匹配给默认路由router(config)#no ip classless 数据包不能转发时弃掉动态路由rip:router(config)#ip routing 启动路由转发router(config)#router rip 启动RIP路由协议。
交换机口令设置:switch>enable ;进入特权模式switch#config terminal ;进入全局配置模式switch(config)#hostname <hostname> ;设置交换机的主机名switch(config)#enable secret xxx ;设置特权加密口令为xxx switch(config)#enable password xxx ;设置特权非密口令为xxx switch(config)#line console 0 ;进控制台口(Rs232)初始化switch(config-line)#line vty 0 4 ;进入虚拟终端virtual tty switch(config-line)#login ;允许登录switch(config-line)#password xx ;设置登录口令xxswitch#exit ;返回命令交换机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 ;当前端口1加入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 <name> ; 设置发vtp域名switch(config)#vtp password <word>switch(config)#vtp mode serverswitch(config)#vtp mode client交换机设置IP地址:switch(config)#interface vlan 1 ;进入vlan 1switch(config-if)#ip address <IP> <mask> ;添加远程登录IPswitch(config)#ip default-gateway <IP> ;添加默认网关switch#dir flash: ;查看内存交换机显示命令:switch#write ;写入保存switch#show vtpswitch#show run ;查看当前配置信息switch#show vlan ;看VLAN。
路由器基本操作命令:Router>enable(进入特权模式)Router#configure(进入全局配置模式)Router#show history(查看历史输入命令)Router#show flash(查看闪存信息)Router#show running-config(显示运行配置内容)Router#show startup-config(显示启动配置内容)Router#show interfaces(查看端口配置信息)Router#show protocols(查看配置协议信息)Router#show ip protocols(查看路由协议)Router#show ip route(查看路由表信息)Router#(config)hostname **(修改主机名称,“**”代表新的主机名称)Router(config-if)#description **(进入端口后修改端口标识,“**”代表你要修改的名称)设置console口密码:Router(config)#line console 0Router(config-line)#loginRouter(config-line)#password ****Telnet远程配置虚拟接口密码设置:Router(config)#line vty 0 4Router(config-line)#loginRouter(config-line)#password ****设置Enable密码和Secret密码:Router(config)#enable password ****Router(config)#enable secret ****配置以太网口:Router(config)#interface F0/0(进入端口)Router(config-if)#ip address 192.168.1.10 255.255.255.0(配置IP地址与子网掩码)Router(config-if)#no shutdown(激活端口)配置与子接口:Router(config)#interface F0/0.1Router(config-subif)#encapsulation dot1Q vlan号Router(config-subif)#ip address 192.168.1.100 255.255.255.0(配置IP地址与子网掩码)Router(config-subif)#no shutdown(激活端口)配置DCE串口:Router(config)#interface S0/0/0(进入端口)Router(config-if)#ip address 192.168.2.10 255.255.255.0(配置IP地址与子网掩码)Router(config-if)#clock rate 56000(在时钟端设置时钟频率)Router(config-if)#bandwidth 56(设置带宽端口)Router(config-if)#no shutdown(激活端口)路由器Telnet相关:Router#telnet 192.168.1.100(远程登录到路由器)Router#show user(查看当前用户)Router#clear line vty 0 4(终止Telnet连接)保存当前路由器配置:Router#writeRouter#copy running-config startup-configRouter#reload备份IOS配置到TFTP服务器:Router#show flash(确定内存配置信息的文件名)Router#copy flash tftpRouter#copy run tftpRouter#copy start tftp从TFTP服务器下载IOS配置Router#copy tftp flashRouter#copy tftp runRouter#copy tftp start主机名与域名静态解析:Router(config)#ip host name XXX 192.168.1.100(“XXX”为主机名或域名,后面跟IP,一个主机名可以对应多个IP)指定DNS服务器地址:Router(config)#ip domain-lookup(打开DNS服务)Router(config)#ip name-server 192.168.1.100(最多可添加6个)Router(config)#no ip domain-lookup(关闭DNS服务)静态路由:Router(config)#ip route 路由的网段子网掩码缺省路由:Router(config)#ip route 0.0.0.0 0.0.0.0 下一个路由器地址(可以是自己的端口号)RIP动态路由相关:Router(config)#router ripRouter(config-router)#version 2(启用RIP版本2)Router(config-router)#network 直连网段Router#debug ip rip(查看RIP动态学习信息)OSPF动态路由相关:Router(config)#router ospf 进程IDRouter(config-router)#network 直连网段反掩码 area 区域号(参与路由的区域必须在同一个)Router(config-if)#ip ospf cost 开销数(修改端口的开销)Router#show ip ospf interface(显示OSPF邻接信息)Router#show ip ospf(显示OSPF生效时间)Router#show ip ospf neighbor detail(显示DR/BDR和邻居信息)Router#show ip ospf databaseRouter#debug ip ospf(显示OSPF动态学习过程)EIGRP动态路由相关:Router(config)#router eigrp 进程IDRouter(config-router)#network 直连网段Router#show ip eigrp neighbors(查看EIGRP邻居信息)Router#show ip eigrp topology(查看EIGRP拓扑结构)Router#show ip eigrp traffic(查看EIGRP信息包)Router(config-if)#bandwidth 1000(设定路由信息传输带宽,单位为Kbps)标准访问控制列表:Router(config)#access-list 列表号(1-99) permit/deny(允许或拒绝)来源地址反掩码(创建ACL)Router(config)#interface F0/0Router(config-if)#ip access-group 列表号 in/out(在端口上应用列表规则)扩展访问控制列表:Router(config)#access-list 列表号(1-99) permit/deny(允许或拒绝)协议类型来源地址反掩码目标地址反掩码 eq等于/lt小于/gt大于/neq不等于端口号(创建ACL)Router(config)#interface F0/0Router(config-if)#ip access-group 列表号 in/out(在端口上应用列表规则)在虚拟接口上应用规则:Router(config)#line vty 0 4Router(config-line)#access-class 列表号 in/out查看已配置的ACL内容:Router#show access-lists复用动态NAT:Router(config)#ip nat pool 地址池名称200.200.200.200 200.200.200.200 netmask 子网掩码(建立地址池:由于可用外网地址只有一个,所以起始地址与结束地址都是同一个)Router(config)#access-list 列表号(1-99) permit/deny 源地址反掩码(定义ACL)Router(config)#ip nat inside source list ACL号 pool 地址池名称 overload (地址池与ACL绑定)Router(config-if)#ip nat inside(指定内部端口)Router(config-if)#ip nat outside(指定外部端口)动态NAT:Router(config)#ip nat pool 地址池名称起始地址终止地址netmask 子网掩码(建立地址池)Router(config)#access-list 列表号(1-99) permit/deny 源地址反掩码(定义ACL)Router(config)#ip nat inside source list ACL号 pool 地址池名称 overload (地址池与ACL绑定)Router(config-if)#ip nat inside(指定内部端口)Router(config-if)#ip nat outside(指定外部端口)静态NAT:Router(config)#ip nat pool 地址池名称起始地址终止地址netmask 子网掩码(建立地址池)Router(config)#access-list 列表号(1-99) permit/deny 源地址反掩码(定义ACL)Router(config)#ip nat inside source list ACL号 pool 地址池名称 overload (地址池与ACL绑定)Router(config)#ip nat inside source static 内网地址外网地址(内网地址与外网地址绑定)Router(config-if)#ip nat inside(指定内部端口)Router(config-if)#ip nat outside(指定外部端口)交换机的基本操作:Switch>enable (进入交换机特权模式)Switch#config (进入全局配置模式)→Switch(config)#Switch(config)#interface f0/0 → Switch(config-if)#(进入端口)Switch#show vlan(查看VLAN信息)其他的与路由器大同小异交换机enable密码与secret密码设置:Switch(config)#enable password ****Switch(config)#enable secret ****交换机TELNET虚拟接口配置:Switch(config)#line vty 0 15Switch(config-line)#loginSwitch(config-line)#password ****VLAN的配置相关:Switch#vlan database(进入vlan数据库)Switch(vlan)#vlan 2 vlan名称(创建VLAN)Switch(config)#interface f0/0Switch(config-if)#switch mode accessSwitch(config-if)#switch access vlan 2(将端口加入VLAN)Switch(config-if)#switchport access vlan 2Switch(config)#interface vlan 2Switch(config-if)#ip address 192.168.1.100 255.255.255.0(为VLAN配置IP地址,方便TELNET管理)设置端口工作模式:Switch(config)#interface f0/0Switch(config-if)#speed auto/10/100(设置工作带宽Mbps)Switch(config-if)#duplex auto/full/half(设置半双工、全双工)端口安全配置:Switch(config-if)#switchport mode access(修改端口为访问模式)Switch(config-if)#switchport port-security(开启端口安全)Switch(config-if)#switchport port-security mac-address 被绑定的MAC地址(端口绑定MAC地址)Switch(config-if)#switchport port-security maximum *(端口可学习的MAC地址最大数量)Switch(config-if)#switchport port-security violation shutdown/protect/restrict (激活端口安全规则)交换机二层汇聚配置:Switch(config)#interface f0/0Switch(config-if)#switchport mode trunk交换机添加网关Switch(config)#ip default-gateway 192.168.100.254三层交换作为DHCP服务器Switch(config)#ip dhcp excluded-address 192.168.100.254(设置保留地址)Switch(config)#ip dhcp pool xiaoshoubu(创建地址池)Switch(dhcp-config)#network 192.168.100.0 255.255.255.0(地址池网段)Switch(dhcp-config)#default-router 192.168.100.254(分配网关)批量进入端口s1(config)#interface range fastEthernet 0/1 - fastEthernet 0/2s1(config-if-range)#选择链路聚合协议s1(config-if-range)# channel-protocol lacp配置虚拟组号s1(config-if-range)#channel-group 1 mode active指定三层交换机汇聚链路封装类型Switch(config-if-range)#switchport trunk encapsulation dot1qSwitch(config-if-range)#switchport mode trunk。
思科命令大全(完整版)1.设置主机名/系统名IOS:witch(config)#hotname"hotname"CLI:witch(enable)etytemnamename-tring2.设置登录口令IOS:witch(config)#enablepawordlevel1pawordCLI:witch(enable)etpawordwitch(enable)etenalbepa3.设置远程访问IOS:witch(config)#interfacevlan1witch(config-if)#ipaddreip-addrenetmakwitch(config-if)#ipdefault-gatewayip-addreCLI:witch(enable)etinterfacec0ip-addrenetmakbroadcat-addre witch(enable)etinterfacec0vlanwitch(enable)etiproutedefaultgateway4.启用和浏览CDP信息IOS:witch(config-if)#cdpenablewitch(config-if)#nocdpenableCLI:witch(enable)etcdp{enable|diable}module/port5.查看Cico邻接设备的CDP通告IOS:witch#howcdpinterface[typemodle/port]witch#howcdpneighbor[typemodule/port][detail]CLI:witch(enable)howcdpneighbor[module/port][vlan|duple某|capabilitie|detail]6.端口描述IOS:witch(config-if)#decriptionecription-tring CLI:witch(enable)etportnamemodule/numberdecription-tring 7.设置端口速度IOS:witch(config-if)#peed{10|100|auto}CLI:witch(enable)etportpeedmoudle/number{10|100|auto}witch(enable)etportpeedmoudle/number{4|16|auto}8.设置以太网的链路模式IOS:witch(config-if)#duple某{auto|full|half}CLI:witch(enable)etportduple某module/number{full|half}9.配置静态VLANIOS:witch#vlandatabaewitch(vlan)#vlanvlan-numnamevlawitch(vlan)#e某itwitch#configureteriminalwitch(config)#interfaceinterfacemodule/numberwitch(config-if)#witchportmodeaccewitch(config-if)#witchportaccevlanvlan-numwitch(config-if)#endCLI:witch(enable)etvlanvlan-num[namename]witch(enable)etvlanvlan-nummod-num/port-lit10.配置VLAN中继线IOS:witch(config)#interfaceinterfacemod/portwitch(config-if)#witchportmodetrunkwitch(config-if)#witchporttrunkencapulation{il|dotlq}witch(config-if)#witchporttrunkallowedvlanremovevlan-litwitch(config-if)#witchporttrunkallowedvlanaddvlan-litCLI:witch(enable)ettrunkmodule/port[on|off|deirable|auto|nonegotiate] Vlan-range[il|dotlq|dotl0|lane|negotiate]11.配置VTP管理域IOS:witch#vlandatabaewitch(vlan)#vtpdomaindomain-nameCLI:witch(enable)etvtp[domaindomain-name]12.配置VTP模式IOS:witch#vlandatabaewitch(vlan)#vtpdomaindomain-namewitch(vlan)#vtp{ever|cilent|tranparent}witch(vlan)#vtppawordpawordCLI:witch(enable)etvtp[domaindomain-name][mode{ever|cilent|tranparent}][pawordpaword] 13.配置VTP版本IOS:witch#vlandatabaewitch(vlan)#vtpv2-modeCLI:witch(enable)etvtpv2enable14.启动VTP剪裁IOS:witch#vlandatabaewitch(vlan)#vtppruningCLI:witch(enable)etvtppruningenable15.配置以太信道IOS:witch(config-if)#portgroupgroup-number[ditribution{ource|detination}]CLI:witch(enable)etportchannelmoudle/port-rangemode{on|off|deirable|auto}16.调整根路径成本IOS:witch(config-if)#panning-tree[vlanvlan-lit]cotcotCLI:witch(enable)etpantreeportcotmoudle/portcotwitch(enable)etpantreeportvlancotmoudle/port[cotcot][vlan-lit]17.调整端口IDIOS:witch(config-if)#panning-tree[vlanvlan-lit]port-priorityport-priorityCLI:witch(enable)etpantreeportpri{mldule/port}prioritywitch(enable)etpantreeportvlanpri{module/port}priority[vlan] 18.修改STP时钟witch(config)#panning-tree[vlanvlan-lit]ma某-ageecondCLI:witch(enable)etpantreehellointerval[vlan]witch(enable)etpantreefwddelaydelay[vlan]witch(enable)etpantreema某ageagingtiame[vlan]19.启用或禁用PortFat特征IOS:witch(config-if)#panning-treeportfatCLI:witch(enable)etpantreeportfat{module/port}{enable|diable}20.启用或禁用UplinkFat特征IOS:witch(config)#panning-treeuplinkfat[ma某-update-ratepkt-per-econd]CLI:witch(enable)etpantreeuplinkfat{enable|diable}[rateupdate-rate][all-protocoloff|on]为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个IP地址,然后使用下列命令:witch(config)#cluterenablecluter-name21.为了从一条中继链路上删除VLAN,可使用下列命令:witch(enable)cleartrunkmodule/portvlan-range22.用howvtpdomain显示管理域的VTP参数.23.用howvtptatitic显示管理域的VTP参数.24.在Catalyt交换机上定义TrBRF的命令如下:witch(enable)etvlanvlan-name[namename]typetrbrfbridgebridge-num[tp{ieee|ibm}]25.在Catalyt交换机上定义TrCRF的命令如下:witch(enable)etvlanvlan-num[namename]typetrcrf{ringhe某-ring-num|decringdecimal-ring-num}parentvlan-num26.在创建好TrBRFVLAN之后,就可以给它分配交换机端口.对于以太网交换,可以采用如下命令给VLAN分配端口:witch(enable)etvlanvlan-nummod-num/port-num27.命令howpantree显示一个交换机端口的STP状态.28.配置一个ELAN的LES和BUS,可以使用下列命令:ATM(config)#interfaceatmnumber.ubintmultiointATM(config-ubif)#laneerber-buethernetelan-name29.配置LECS:ATM(config)#lanedatabaedatabae-nameATM(lane-config-databade)#nameelan1-nameerver-atm-addrele1-nap-addreATM(lane-config-databade)#nameelan2-nameerver-atm-addrele2-nap-addreATM(lane-config-databade)#name...30.创建完数据库后,必须在主接口上启动LECS.命令如下:ATM(config)#interfaceatmnumberATM(config-if)#laneconfigdatabaedatabae-nameATM(config-if)#laneconfigauto-config-atm-addre31.将每个LEC配置到一个不同的ATM子接口上.命令如下:ATM(config)#interfaceatmnumber.ubintmultipointATM(config)#laneclientethernetvlan-numelan-num32.用howlaneerver显示LES的状态.33.用howlanebu显示bu的状态.34.用howlanedatabae显示LECS数据库可内容.35.用howlaneclient显示LEC的状态.36.用howmodule显示已安装的模块列表.37.用物理接口建立与VLAN的连接:router#configureterminalrouter(config)#interfacemediamodule/portrouter(config-if)#decriptiondecription-tringrouter(config-if)#ipaddreip-addrubnet-makrouter(config-if)#nohutdown38.用中继链路来建立与VLAN的连接:router(config)#interfacemodule/port.ubinterface router(config-ig)#encapulation[il|dotlq]vlan-number router(config-if)#ipaddreip-addreubnet-mak39.用LANE来建立与VLAN的连接:router(config)#interfaceatmmodule/portrouter(config-if)#noipaddrerouter(config-if)#atmpvc105qaalrouter(config-if)#atmpvc2016ilnirouter(config-if)#interfaceatmmodule/port.ubinterfacemultipointrouter(config-if)#ipaddreip-addreubnet-makrouter(config-if)#laneclientethernetelan-numrouter(config-if)#interfaceatmmodule/port.ubinterfacemultipointrouter(config-if)#ipaddreip-addreubnet-namerouter(config-if)#laneclientethernetelan-namerouter(config-if)#...40.为了在路由处理器上进行动态路由配置,可以用下列IOS命令来进行:router(config)#iproutingrouter(config)#routerip-routing-protocolrouter(config-router)#networkip-network-numberrouter(config-router)#networkip-network-number41.配置默认路由:witch(enable)etiproutedefaultgateway42.为一个路由处理器分配VLANID,可在接口模式下使用下列命令:router(config)#interfaceinterfacenumberrouter(config-if)#mlrpvlan-idvlan-id-num43.在路由处理器启用MLSP:router(config)#mlrpip44.为了把一个外置的路由处理器接口和交换机安置在同一个VTP域中:router(config)#interfaceinterfacenumberrouter(config-if)#mlrpvtp-domaindomain-name45.查看指定的VTP域的信息:router#howmlrpvtp-domainvtpdomainname46.要确定RSM或路由器上的管理接口,可以在接口模式下输入下列命令:router(config-if)#mlrpmanagement-interface47.要检验MLS-RP的配置情况:router#howmlrp48.检验特定接口上的MLS配置:router#howmlrpinterfaceinterfacenumber49.为了在MLS-SE上设置流掩码而又不想在任一个路由处理器接口上设置访问列表:etmlflow[detination|detination-ource|full]50.为使MLS和输入访问列表可以兼容,可以在全局模式下使用下列命令:router(config)#mlrpipinput-acl51.当某个交换机的第3层交换失效时,可在交换机的特权模式下输入下列命令:witch(enable)etmlenable52.若想改变老化时间的值,可在特权模式下输入以下命令:54.确定那些MLS-RP和MLS-SE参与了MLS,可先显示交换机引用列表中的内容再确定:witch(enable)howmlinclude55.显示MLS高速缓存记录:witch(enable)howmlentry56.用命令howinarp显示ARP高速缓存区的内容。
cisco路由器常用命令1、Switch> 用户模式2、Switch>enable 进入特权模式Switch#3、Switch#config terminal 进入全局模式Switch(config)#4、Switch(config)#interface f0/1 进入接口模式Switch(config-if)#5、Switch(config)#line console 0 进入line模式Switch(config-line)#exit 退回上层end 结束所有操作6、Switch(config)#hostname aaa 配置主机名7、switch#show running-config 查看配置情况8、Switch(config)#enable password 111 设置使能密码(明文)9、Switch(config)#enable secret 111 设置使能密码(密文)Switch(config)#line console 0 设置console密码Switch(config-line)#password 333Switch(config-line)#login10、Switch(config)#interface vlan1Switch(config-if)#ip address 192.168.1.1 255.255.255.0 设置IP地址Switch(config-if)#no shutdown11、Switch(config)#ip default-gateway 192.168.1.10 设置网关12、Switch#show mac-address-table 查看MAC地址表13、Switch#show cdp cdp全局配置信息14、Switch#show cdp interface f0/1 cdp接口配置信息15、Switch#show cdp traffic cdp包的配置信息16、Switch#show cdp neighbors cdp邻居基本信息17、Switch#show cdp neighbors detail cdp邻居详细信息Switch#show cdp neighbors entry18、Switch#copy running-config startup-config19、Switch#erase startup-config 恢复出厂信息Switch#reload 重新加载20、交换机密码恢复*断开电源*按住MODE键,加电(等待数秒)*switch:出现此符号*switch:flash_init 初始化flash*switch:dir flash: (查看文件,可省去)*switch:rename config.text config.old 改名*switch:boot 重启*switch>enable 进入特权*switch#dir flash: (查看文件,可省去)*switch#rename config.old config.text改名*switch#copy flash:config.text running-config 复制到系统内*switch#confit terminal 进入全局模式*switch(config)#enable password 222 设置新密码21、switch#show vlan-sw brief 查看vlan22、switch#vlan database 进入vlan模式switch(vlan)#vlan 20 name bbb 创建vlan并命名23、switch(vlan)#no vlan 20 删除vlan24、添加端口到vlan(单个)switch(config)#interface f0/1 进入接口模式switch(config-if)#switchport access vlan 10 添加至vlan10switch(config-if)#end 退出switch#show vlan brief (id) 验证vlanswitch(config)#show running-config interface f0/1(查看某接口)25、添加端口到vlan(批量)switch(config)#interface range f0/1 - 5switch(config-if-range)#switchport access vlan 1026、switch(config)#interface f0/1 进入接口switch(config-if)#switchport mode trunk 设置为trunk(永久)switch(config-if)#switchport mode dynamic desirable/auto(其它trunk)switch(config-if)#switchport trunk allowed vlan remove 10 移除vlan10)switch(config-if)#switchport trunk allowed vlan add 20 添加vlan2027、switch#show interface f0/1 switchport 查看接口模式show ip interface briefSwitch#write 保存交换机配置信息。
Cisco(恩科)命令大全switch配置命令(1)模式转换命令用户模式----特权模式,使用命令"enable"特权模式----全局配置模式,使用命令"config t"全局配置模式----接口模式,使用命令"interface+接口类型+接口号" 全局配置模式----线控模式,使用命令"line+接口类型+接口号" 注:用户模式:查看初始化的信息.特权模式:查看所有信息、调试、保存配置信息全局模式:配置所有信息、针对整个路由器或交换机的所有接口接口模式:针对某一个接口的配置线控模式:对路由器进行控制的接口配置(2)配置命令show running config 显示所有的配置show versin 显示版本号和寄存器值shut down 关闭接口no shutdown 打开接口ip add +ip地址配置IP地址secondary+IP地址为接口配置第二个IP地址show interface+接口类型+接口号查看接口管理性show controllers interface 查看接口是否有DCE电缆show history 查看历史记录show terminal 查看终端记录大小hostname+主机名配置路由器或交换机的标识config memory 修改保存在NVRAM中的启动配置exec timeout 0 0 设置控制台会话超时为0service password-encryptin 手工加密所有密码enable password +密码配置明文密码ena sec +密码配置密文密码line vty 0 4/15 进入telnet接口password +密码配置telnet密码line aux 0 进入AUX接口password +密码配置密码line con 0 进入CON接口password +密码配置密码bandwidth+数字配置带宽no ip address 删除已配置的IP地址show startup config 查看NVRAM中的配置信息copy run-config atartup config 保存信息到NVRAMwrite 保存信息到NVRAMerase startup-config 清除NVRAM中的配置信息show ip interface brief 查看接口的谪要信息banner motd # +信息+ # 配置路由器或交换机的描素信息description+信息配置接口听描素信息vlan database 进入VLAN数据库模式vlan +vlan号+ 名称创建VLANswitchport access vlan +vlan号为VLAN为配接口interface vlan +vlan号进入VLAN接口模式ip add +ip地址为VLAN配置管理IP地址vtp+service/tracsparent/client 配置SW的VTP工作模式vtp +domain+域名配置SW的VTP域名vtp +password +密码配置SW的密码switchport mode trunk 启用中继no vlan +vlan号删除VLANshow spamming-tree vlan +vlan号查看VLA怕生成树议2. 路由器配置命令ip route+非直连网段+子网掩码+下一跳地址配置静态/默认路由show ip route 查看路由表show protocols 显示出所有的被动路由协议和接口上哪些协议被设置show ip protocols 显示了被配置在路由器上的路由选择协议,同时给出了在路由选择协议中使用的定时器等信息router rip 激活RIP协议network +直连网段发布直连网段interface lookback 0 激活逻辑接口passive-interface +接口类型+接口号配置接口为被动模式debug ip +协议动态查看路由更新信息undebug all 关闭所有DEBUG信息router eigrp +as号激活EIGRP路由协议network +网段+子网掩码发布直连网段show ip eigrp neighbors 查看邻居表show ip eigrp topology 查看拓扑表show ip eigrp traffic 查看发送包数量router ospf +process-ID 激活OSPF协议network+直连网段+area+区域号发布直连网段show ip ospf 显示OSPF的进程号和ROUTER-IDencapsulation+封装格式更改封装格式no ip admain-lookup 关闭路由器的域名查找ip routing 在三层交换机上启用路由功能show user 查看SW的在线用户clear line +线路号清除线路3. 三层交换机配置命令配置一组二层端口configure terminal 进入配置状态nterface range {port-range} 进入组配置状态配置三层端口configure terminal 进入配置状态interface {{fastethernet | gigabitethernet} interface-id} | {vlan vlan-id} | {port-channel port-channel-number} 进入端口配置状态no switchport 把物理端口变成三层口ip address ip_address subnet_mask 配置IP地址和掩码no shutdown 激活端口例:Switch(config)# interface gigabitethernet0/2Switch(config-if)# no switchportSwitch(config-if)# ip address 192.20.135.21 255.255.255.0Switch(config-if)# no shutdown配置VLAN(虚拟局域网)configure terminal 进入配置状态vlan vlan-id 输入一个VLAN号, 然后进入vlan配态,可以输入一个新的VLAN号或旧的来进行修改。
cisco路由器命令总体说明:此文档提供了关于常用的Cisco路由器命令的详细说明。
每个章节介绍了不同的命令类别并提供了相关命令的具体用法和示例。
本文档旨在帮助用户熟悉和理解Cisco路由器命令,以便在配置和管理网络设备时能够高效地使用它们。
1:基础命令1.1 登录和退出路由器1.1.1 登录路由器命令:telnet [IP地址]用法示例:telnet 192.168.1.1说明:此命令用于通过Telnet协议登录到路由器。
1.1.2 退出路由器命令:exit用法示例:exit说明:此命令用于从路由器会话中退出。
1.2 查看和配置接口1.2.1 查看接口信息命令:show interfaces用法示例:show interfaces gigabitethernet 0/1说明:此命令用于查看指定接口的详细信息,包括状态、带宽、错误统计等。
1.2.2 配置接口命令:interface [接口名称]用法示例:interface gigabitethernet 0/1说明:此命令用于进入指定接口的配置模式,以便进行相关配置。
1.3 路由配置1.3.1 配置静态路由命令:ip route [目标网络] [子网掩码] [下一跳地址]用法示例:ip route 10:0:0:0 255.255.255:0192.168.1.2说明:此命令用于配置静态路由,将目标网络流量发送到指定的下一跳地址。
1.3.2 查看路由表命令:show ip route用法示例:show ip route说明:此命令用于查看当前路由表的内容。
2:高级命令2.1 ACL(访问控制列表)2.1.1 创建ACL命令:access-list [ACL号] [规则类型] [源地址] [目标地址]用法示例:access-list 1 permit 192.168.1:0/24 any说明:此命令用于创建一个访问控制列表,并定义其规则。
2.1.2 应用ACL命令:interface [接口名称]ip access-group [ACL号] [进/出]用法示例:interface gigabitethernet 0/1ip access-group 1 in说明:此命令用于将ACL应用到指定接口的进或出方向。
最详细的CISCO路由器配置命令及方法第一章路由器配置基础一、基本设置方式二、命令状态三、设置对话过程四、常用命令五、配置IP寻址六、配置静态路由第二章广域网协议设置一、HDLC二、PPP三、X.25四、Relay五、ISDN六、PSTN第三章路由协议设置一、RIP协议二、IGRP协议三、OSPF协议四、重新分配路由五、IPX协议设置第四章服务质量及访问控制一、协议优先级设置二、队列定制三、访问控制第五章虚拟局域网(VLAN)路由一、虚拟局域网(VLAN)二、交换机间链路(ISL)协议三、虚拟局域网(VLAN)路由实例第一章:路由器配置基础一、基本设置方式一般来说,可以用5种方式来设置路由器:1.Console口接终端或运行终端仿真软件的微机;2.AUX口接MODEM,通过电话线与远方的终端或运行终端仿真软件的微机相连;3.通过Ethernet上的TFTP服务器;4.通过Ethernet上的TELNET程序;5.通过Ethernet上的SNMP网管工作站。
但路由器的第一次设置必须通过第一种方式进行,此时终端的硬件设置如下:波特率:9600数据位:8停止位:1奇偶校验: 无二、命令状态1. router>路由器处于用户命令状态,这时用户可以看路由器的连接状态,访问其它网络和主机,但不能看到和更改路由器的设置内容。
2. router#在router>提示符下键入enable,路由器进入特权命令状态router#,这时不但可以执行所有的用户命令,还可以看到和更改路由器的设置内容。
3. router(config)#在router#提示符下键入configure terminal,出现提示符router(config)#,此时路由器处于全局设置状态,这时可以设置路由器的全局参数。
4. router(config-if)#; router(config-line)#; router(config-router)#;…路由器处于局部设置状态,这时可以设置路由器某个局部的参数。
★Cisco路由器常用配置命令大全★∙∙jikxing∙正式会员4∙1楼Access-enable 允许路由器在动态访问列表中创建临时访问列表入口 Access-group 把访问控制列表(ACL)应用到接口上 Access-list 定义一个标准的IP ACL Access-template 在连接的路由器上手动替换临时访问列表入口 Appn 向APPN子系统发送命令 Atmsig 执行ATM信令命令 B 手动引导操作系统 Bandwidth 设置接口的带宽 Banner motd 指定日期信息标语 Bfe 设置突发事件手册模式 Boot system 指定路由器启动时加载的系统映像 Calendar 设置硬件日历 Cd 更改路径 Cdp enable 允许接口运行CDP协议 Clear 复位功能 Clear counters 清除接口计数器 Clear interface 重新启动接口上的件逻辑 Clockrate 设置串口硬件连接的时钟速率,如网络接口模块和接口处理器能接受的速率 Cmt 开启/关闭FDDI连接管理功能 Config-register 修改配置寄存器设置 Configure 允许进入存在的配置模式,在中心站点上维护并保存配置信息 Configure memory 从NVRAM加载配置信息 Configure terminal 从终端进行手动配置 Connect 打开一个终端连接 Copy 复制配置或映像数据 Copy flash tftp 备份系统映像文件到TFTP服务器 Copy running-config startup-config 将RAM中的当前配置存储到NVRAM Copy running-config tftp 将RAM中的当前配置存储到网络TFTP服务器上 Copy tftp flash 从TFTP服务器上下载新映像到Flash Copy tftp running-config 从TFTP服务器上下载配置文件 Debug 使用调试功能 Debug dialer 显示接口在拨什么号及诸如此类的信息 Debug ip rip 显示RIP路由选择更新数据 Debug ipx routing activity 显示关于路由选择协议(RIP)更新数据包的信息 Debug ipx sap 显示关于SAP(业务通告协议)更新数据包信息 Debug isdn q921 显示在路由器D通道ISDN接口上发生的数据链路层(第2层)的访问过程 Debug ppp 显示在实施PPP中发生的业务和交换信息 delete 删除文件 Deny 为一个已命名的IP ACL设置条件 Dialer idle-timeout 规定线路断开前的空闲时间的长度 Dialer map 设置一个串行接口来呼叫一个或多个地点顶2∙举报 |∙2009-04-01 10:37∙回复∙∙jikxing∙正式会员4∙2楼 Dialer wait-for-carrier-time 规定花多长时间等待一个载体 Dialer-group 通过对属于一个特定拨号组的接口进行配置来访问控制 Dialer-list protocol 定义一个数字数据接受器(DDR)拨号表以通过协议或ACL与协议的组合来控制控制拨号 Dir 显示给定设备上的文件 Disable 关闭特许模式 Disconnect 断开已建立的连接 Enable 打开特许模式 Enable password 确定一个密码以防止对路由器非授权的访问 Enable password 设置本地口令控制不同特权级别的访问 Enable secret 为enable password命令定义额外一层安全性 (强制安全,密码非明文显示) Encapsulation frame-relay 启动帧中继封装 Encapsulation novell-ether 规定在网络段上使用的Novell 独一无二的格式 Encapsulation PPP 把PPP设置为由串口或ISDN接口使用的封装方法 Encapsulation sap 规定在网络段上使用的以太网802.2格式Cisco的密码是sap End 退出配置模式 Erase 删除闪存或配置缓存 Erase startup-config 删除NVRAM中的内容 Exec-timeout 配置EXEC命令解释器在检测到用户输入前所等待的时间 Exit 退出所有配置模式或者关闭一个激活的终端会话和终止一个EXEC Exit 终止任何配置模式或关闭一个活动的对话和结束E XEC format 格式化设备 Frame-relay local-dlci 为使用帧中继封装的串行线路启动本地管理接口(LMI) Help 获得交互式帮助系统 History 查看历史记录 Hostname 使用一个主机名来配置路由器,该主机名以提示符或者缺省文件名的方式使用 Interface 设置接口类型并且输入接口配置模式 Interface 配置接口类型和进入接口配置模式 Interface serial 选择接口并且输入接口配置模式 Ip access-group 控制对一个接口的访问 Ip address 设定接口的网络逻辑地址 Ip address 设置一个接口地址和子网掩码并开始IP处理 Ip default-network 建立一条缺省路由 Ip domain-lookup 允许路由器缺省使用DNS Ip host 定义静态主机名到IP地址映射 Ip name-server 指定至多6个进行名字-地址解析的服务器地址 Ip route 建立一条静态路由 Ip unnumbered 在为给一个接口分配一个明确的IP地址情况下,在串口上启动互联网协议(IP)的处理过程∙举报 |∙2009-04-01 10:37∙回复∙∙jikxing∙正式会员4∙3楼 Ipx delay 设置点计数 Ipx ipxwan 在串口上启动IPXWAN协议 Ipx maximum-paths 当转发数据包时设置Cisco IOS软件使用的等价路径数量 Ipx network 在一个特定接口上启动互联网数据包交换(IPX)的路由选择并且选择封装的类型(用帧封装) Ipx router 规定使用的路由选择协议 Ipx routing 启动IPX路由选择 Ipx sap-interval 在较慢的链路上设置较不频繁的SAP(业务广告协议)更新 Ipx type-20-input-checks 限制对IPX20类数据包广播的传播的接受 Isdn spid1 在路由器上规定已经由ISDN业务供应商为B 1信道分配的业务简介号(SPID) Isdn spid2 在路由器上规定已经由ISDN业务供应商为B 2信道分配的业务简介号(SPID) Isdntch-type 规定了在ISDN接口上的中央办公区的交换机的类型 Keeplive 为使用帧中继封装的串行线路LMI(本地管理接口)机制 Lat 打开LAT连接 Line 确定一个特定的线路和开始线路配置 Line concole 设置控制台端口线路 Line vty 为远程控制台访问规定了一个虚拟终端 Lock 锁住终端控制台 Login 在终端会话登录过程中启动了密码检查 Login 以某用户身份登录,登录时允许口令验证Logout 退出EXEC模式 Mbranch 向下跟踪组播地址路由至终端 Media-type 定义介质类型 Metric holddown 把新的IGRP路由选择信息与正在使用的IGRP路由选择信息隔离一段时间 Mrbranch 向上解析组播地址路由至枝端 Mrinfo 从组播路由器上获取邻居和版本信息 Mstat 对组播地址多次路由跟踪后显示统计数字 Mtrace 由源向目标跟踪解析组播地址路径 Name-connection 命名已存在的网络连接 Ncia 开启/关闭NCIA服务器 Network 把一个基于NIC的地址分配给一个与它直接相连的路由器把网络与一个IGRP的路由选择的过程联系起来在IPX路由器配置模式下,在网络上启动加强的IGRP Network 指定一个和路由器直接相连的网络地址段 Network-number 对一个直接连接的网络进行规定 No shutdown 打开一个关闭的接口 Pad 开启一个X.29 PAD连接 Permit 为一个已命名的IP ACL设置条件 Ping 把ICMP响应请求的数据包发送网络上的另一个节点检查主机的可达性和网络的连通性对网络的基本连通性进行诊断 Ping 发送回声请求,诊断基本的网络连通性∙举报 |∙2009-04-01 10:37∙回复∙∙jikxing∙正式会员4∙4楼 Ppp 开始IETF点到点协议 Ppp authentication 启动Challenge握手鉴权协议(CHAP )或者密码验证协议(PAP)或者将两者都启动,并且对在接口上选择的CHAP和PAP验证的顺序进行规定 Ppp chap hostname 当用CHAP进行身份验证时,创建一批好像是同一台主机的拨号路由器 Ppp chap password 设置一个密码,该密码被发送到对路由器进行身份验证的主机命令对进入路由器的用户名/密码的数量进行了限制 Ppp pap sent-username 对一个接口启动远程PAP支持,并且在PAP对同等层请求数据包验证过程中使用sent-username和password Protocol 对一个IP路由选择协议进行定义,该协议可以是RIP,内部网关路由选择协议(IGRP),开放最短路径优先(OSPF),还可以是加强的IGRP Pwd 显示当前设备名 Reload 关闭并执行冷启动;重启操作系统 Rlogin 打开一个活动的网络连接 Router 由第一项定义的IP路由协议作为路由进程,例如:router rip 选择RIP作为路由协议 Router igrp 启动一个IGRP的路由选择过程 Router rip 选择RIP作为路由选择协议 Rsh 执行一个远程命令 Sdlc 发送SDLC测试帧 Send 在tty线路上发送消息 Service password-encryption 对口令进行加密 Setup 运行Setup命令 Show 显示运行系统信息 Show access-lists 显示当前所有ACL的内容 Show buffers 显示缓存器统计信息 Show cdp entry 显示CDP表中所列相邻设备的信息 Show cdp interface 显示打开的CDP接口信息 Show cdp neighbors 显示CDP查找进程的结果 Show dialer 显示为DDR(数字数据接受器)设置的串行接口的一般诊断信息 Show flash 显示闪存的布局和内容信息 Show frame-relay lmi 显示关于本地管理接口(LMI)的统计信息 Show frame-relay map 显示关于连接的当前映射入口和信息 Show frame-relay pvc 显示关于帧中继接口的永久虚电路(pvc)的统计信息 Show hosts 显示主机名和地址的缓存列表Show interfaces 显示设置在路由器和访问服务器上所有接口的统计信息 Show interfaces 显示路由器上配置的所有接口的状态 Show interfaces serial 显示关于一个串口的信息 Show ip interface 列出一个接口的IP信息和状态的小结 Show ip interface 列出接口的状态和全局参数∙举报 |∙2009-04-01 10:37∙回复∙∙jikxing∙正式会员4∙5楼 Show ip protocols 显示活动路由协议进程的参数和当前状态 Show ip route 显示路由选择表的当前状态 Show ip router 显示IP路由表信息 Show ipx interface 显示Cisco IOS软件设置的IPX接口的状态以及每个接口中的参数 Show ipx route 显示IPX路由选择表的内容 Show ipx servers 显示IPX服务器列表 Show ipx traffic 显示数据包的数量和类型 Show isdn active 显示当前呼叫的信息,包括被叫号码、建立连接前所花费的时间、在呼叫期间使用的自动化操作控制(AOC)收费单元以及是否在呼叫期间和呼叫结束时提供AOC信息 Show isdn ststus 显示所有isdn接口的状态、或者一个特定的数字信号链路(DSL)的状态或者一个特定isdn接口的状态 Show memory 显示路由器内存的大小,包括空闲内存的大小 Show processes 显示路由器的进程 Show protocols 显示设置的协议 Show protocols 显示配置的协议。
思科路由器命令大全(完整版)
思科路由器命令大全(完整版)
本文档旨在提供思科路由器命令的详细说明和使用指南,包括路由器配置、网络管理、安全性设置等内容。
每个章节都详细介绍了不同的命令和参数,以帮助用户更好地理解和使用思科路由器。
1:路由器基本配置
1.1 主机名设置
1.2 用户名和密码设置
1.3 IP 地址和子网掩码配置
1.4 默认网关配置
2:接口配置
2.1 以太网接口配置
2.2 串行接口配置
2.3 子接口配置
2.4 虚拟局域网 (VLAN) 配置
3:路由协议配置
3.1 静态路由配置
3.2 动态路由配置
3.2.1 RIP 配置
3.2.2 OSPF 配置
3.2.3 BGP 配置
4:网络管理
4.1 SNMP 配置
4.2 NetFlow 配置
4.3 Syslog 配置
4.4 路由器时间设置
5:安全性配置
5.1 访问控制列表 (ACL) 配置
5.2 VPN 配置
5.3 防火墙配置
5.4 AAA 配置
附件:本文档附带的附件包括示例配置文件、命令输出示例等,以帮助读者更好地理解和应用文档中的内容。
法律名词及注释:本文档所涉及的法律名词及其注释如下:
1:主机名:指路由器的主机标识名称,用于在网络中识别路由器。
2:用户名和密码:用于登录和管理路由器的凭证信息。
3: IP 地址:网络协议中用于唯一标识设备的数字地址。
4:子网掩码:用于标识 IP 地址中网络部分和主机部分的分界线。
5:默认网关:用于转发网络流量的下一跳路由器。
6:以太网接口:用于连接局域网设备的物理接口。
7:串行接口:用于连接广域网设备的物理接口。
8:子接口:在一个物理接口上创建多个逻辑接口,用于实现VLAN 分隔等功能。
9:虚拟局域网 (VLAN):用于将局域网划分成多个逻辑网络的技术。
10:静态路由:手动配置的路由表项,用于指定数据包传输的路径。
11:动态路由:根据路由协议动态学习和更新的路由表项,用于自动路由选择。
12: RIP:路由信息协议,一种距离向量路由协议。
13: OSPF:开放最短路径优先协议,一种链路状态路由协议。
14: BGP:边界网关协议,用于在互联网中交换路由信息的协议。
15: SNMP:简单网络管理协议,用于网络设备监控和管理的标
准协议。
16: NetFlow:一种网络流量分析和性能监测技术。
17: Syslog:用于收集和存储系统日志的标准协议。
18:访问控制列表 (ACL):用于实现网络访问控制的策略列表。
19: VPN:虚拟专用网络,用加密技术在公共网络上建立安全
连接。
20:防火墙:用于保护网络安全的设备或软件。
21: AAA:认证、授权和账户,用于鉴定和管理网络用户的一
种技术。