路由器命令总结
- 格式:doc
- 大小:44.00 KB
- 文档页数:5
锐捷路由器命令全集锐捷路由器命令全集一、基本配置命令1.登录命令1.1.登录路由器:login1.2.切换用户:su [用户名]1.3.修改用户密码:passwd2.接口配置命令2.1.查看接口信息:show interface2.2.配置接口IP地质:ip address [接口名称] [IP地质] [子网掩码]2.3.启用/禁用接口:shutdown / no shutdown [接口名称]2.4.配置接口描述:description [接口名称] [描述]3.静态路由配置命令3.1.添加静态路由:ip route [目标网络地质] [子网掩码] [下一跳地质]3.2.删除静态路由:no ip route [目标网络地质] [子网掩码] [下一跳地质]3.3.查看静态路由表:show ip route static4.动态路由配置命令4.1.启用/禁用动态路由:router ospf [进程号] / no router ospf [进程号]4.2.配置OSPF路由:network [网络地质] [子网掩码] area [区域号]4.3.查看OSPF邻居状态:show ip ospf neighbor5.NAT配置命令5.1.配置静态NAT:ip nat inside source static [内部地质] [外部地质]5.2.配置动态NAT:ip nat inside source list [访问控制列表] [外部地质池] overload5.3.查看NAT转换表:show ip nat translations6.VLAN配置命令6.1.创建VLAN:vlan database / vlan [VLAN号] name [VLAN名称]6.2.将接口加入VLAN:interface [接口名称] /switchport mode trunk / switchport mode access / switchport access vlan [VLAN号]6.3.查看VLAN配置信息:show vlan brief7.安全配置命令7.1.配置登录密码:enable password [密码]7.2.配置Telnet/SSH登录:line vty 0 [最小号] [最大号] / transport input telnet / transport input ssh7.3.配置访问控制列表:access-list [序号] permit [源地质] [目标地质] [协议]7.4.应用访问控制列表:interface [接口名称] / ip access-group [序号] in / out8.系统管理命令8.1.查看系统信息:show version8.2.配置系统时钟:clock set [时间]8.3.保存配置:write memory二、附件:无三、法律名词及注释:1.IP地质:Internet Protocol Address,互联网协议地质,用于唯一标识网络上的设备。
路由器1、恢复出厂设置#delete2、DHCP#service dhcpd#network ……………..(地址池)#dns-server…………...(DNS服务器)#default-router……….(网关)#client-identifier……..(分配给客户机的客户端ID)#domain-name……….(分配域名)#lease…………………(租期)DHCP路由监听技术#ip dhcp snooping enable(开启DHCP监听)#ip dhcp snooping binding <arp绑定ARP功能> <enable启动DHCP snooping 绑定><user启动DHCP绑定主机地址>#ip dhcp snooping action(设置每个端口安全动作的数量)在接口中(config-if)#ip dhcp snooping action <blackhole过滤mac地址><shutdown关闭接口>(config-if)#ip dhcp snooping trust (设置为信任端口)(config-if)#ip dhcp snooping binding(启动DHCP snooping 绑定功能)3、VRRP#interface g0/3#vrrp priority………..(配置优先级)#vrrp preempt……….(配置是否抢占)#vrrp authentication...(配置VRRP 组的认证串)#vrrp description…….(配置VRRP 组描述字符串)#v rrp associate………(配置VRRP组的虚拟IP)4、OSPF#router ospf 1……..,..(进入OSPF配置)#network 192.168.1.0 255.255.255.0 area 0…….(在该网段上使用OSPF协议,并配置区域号)#redistribute rip…….(转发路由,例如这里的RIP路由)#default-metric……..(设置引入路由的缺省路由权值)在接口中调配OSPF#ip ospf passive………(设置被动接口)#ip ospf message-digest-key 1 md5 test…………(设置并采用MD5认证,并设置口令)#ip ospf authentication message-digest…………(验证方式为MD5认证)#ip ospf cost 1………..(设置OSPF的端口开销)5、RIP#router rip .…………(进入RIP配置)#network…………….(设置RIP网络)#version……………...(设置RIP版本)#no auto-summary….(关闭自动汇总)#default-metric……...(设置引入路由的缺省路由权值)# rip md5-key 1 md5 test……….………………..(设置并采用MD5认证,并设置口令)#ip rip authentication md5…………..…………..(验证方式为MD5认证)#ip rip passive……….(设置为被动接口)6、路由重发布#redistribute ospf 1…(重发布OSPF路由)#redistribute rip…….(重发布RIP路由)# redistribute static…(重发布静态路由)#default-information originate………………….(重发布缺省路由)7、策略路由#access-list standred 1 permit 192.168.10.0 0.0.0.255(定义源地址)#route-map test…….(定义策略路由)#match ip address 1..(匹配ACL列表)#set ip next-hop 1.1.1.1…………………………...(定义下一条IP地址)#interface e1/0/1…….(进入指定接口)#ip policy route-map test…………………………(打开策略路由,指定路由映射)8、NAT#ip nat pool test 1.1.1.1 1.1.1.1 255.255.255.0……(定义转换的ip地址池)#ip access-list standard test……………………….(配置ACL)#permit any………………………………………...(允许所有)#ip nat inside source list test pool test overload….(指定本地地址、ACL、全局地址池)#ip nat inside source static 192.168.1.1 192.168.48.1(将内部本地地址的映射到内部全局地址)#ip nat outside……..(将NAT应用在外网接口)#ip nat inside………(将NAT应用在内网接口)9、VPN拨号路由器做服务器端#vpdn enable……...(启动VPN)#vpdn-group……….(创建一个VPN组)#accept-dialin……..(配置本VPDN组为NS)#protocol pptp…..(隧道使用PPTP协议,也可使用L2TP协议)#username test password 0 test…………………..(创建用户名,密码)#ip local pool vpn 1.1.1.1 1.1.1.20………………....(创建VPN接入地址池)#interface virtual-template 1...................................(引用虚拟模板)#ppp authentication pap…………………………..(加密方式为pap)#ip unnumbered f0/0……………………………....(关联内网接口)#peer default ip address pool vpn……………...…(引用VPN地址池)10、封装协议认证方#username test password 0 test……………………(用户名,密码)#encapsulation ppp(chap)………………….………(封装协议)#ppp authentication ppp(chap)……………………(启动ppp验证,并制定ppp或chap认证方式) ##aaa au then ppp default local…………………....(使用本地用户认证验证)被认证方#encapsulation ppp(chap)………………………….(封装协议)#ppp chap(pap) hostname +认证方所设置的名字#ppp chap(pap) password +认证方所设置的密码##aaa authen ppp default local…………………...(使用本地用户认证验证)。
简单模式:Hostname > 用户模式进:enableHostname# 特权模式进:config terminalHostname(config)# :全局模式switch(config)# interface e0/1 :全局进入接口模式switch(config-if)# :接口模式快节键:Ctrl+a :移动光标到本行的开始位置Ctrl+e :移动光标到本行的末尾Ctrl+d :删除一个字符Ctrl+f :光标向前移动一个字符Ctrl+b:光标向后移动一个字符esc+b:光标向后移动一个词esc+b:光标向前移动一个词ctrl+z: 从各种配置模式中返回特权模式ctrl+c:从setup模式退出到命令行模式简单查看命令:# show version :查看版本号# show running-config:查看运行文件# show startup-config:查看起动保存文件# show interfaces :查看接口号# show controllers :查看DCE或DTE端# copy running-config startup-config :保存配置命令错误提示:operatlonal………serial is up. Line protocol is up : DOWN表示物理线路有问题connectlon probem…..seriall is up. Line protocol is down:两端帧封装不批配interface problem…..seriall is down. Line protocol is down : 线路物理故障disabled…….seriall is administrotively down. Line protocol is down:未配置或接口没有开启router(config)# banner motd #xxxx# :路由器提示ruter(config-if)# description xxxxx :路由器接口提示router(config)# enable secret xxxx :进特权密码设置进用户密码设置:router(config)# line console 0router(config-line)# loginrouter(config-line)# password xxxx进TELNET密码设置:router(config)# line vty 0 4router(config-line)# loginrouter(config-line)# password xxxxrouter(config)# hostname xxx :起名字router(config)# clock rate 64000 :时钟速率设置router(config)# bandwidth 64 :带宽设置router(config-if)# media-type 10baset :指明使用RJ45接口router(config-if)# ip address 192.168.0.1 255.255.255.0 :接口配置IP router(config)# ip host xxx address xxxx : 映射主机router(config)# ip name-server server-address1:指DNSrouter(config)# no ip domain-lookup : 不到网络解析命令CDP查看命令:# show cdp :查相邻设备的信息# show cdp neighbors :查相邻设备汇总信息# show cdp entry * :查相邻设备详细信息# show cdp traffic :查CDP信息包的错误# show cdp interface :查相邻设备的接口状态router(config)# no cdp run : 关闭所有CDProuter(config-if)# no cdp enable :关闭接口CDPTELNET操作:# show session :显示TELNET会话,*当前所处连接# show user :显示TELNET连接用户,*当前用户# disconnect :关闭发起TELNET# clear line number :关闭来的TELNET# ping :检验连通性# trace :检验连通性和连接的路径# <ctrl+shift+6>+x :挂起TELNET# resume 1 :回到TELNETIOS操作:跳密:Break或ctrl+Break :进入ROM monitor 模式>o/r 0x2142 :进入启动>I :回车进入router(config)# config-register 0*2102 :修改配置注册码hostname(boot)> :IOS 丢失或损坏# show flash :查FLASH中的IOS文件名和大小# copy startup-config running-config :启动备份到运行# copy running-config TFTP :运行备份到TFTP# copy startup-config TFTP :启动备份到TFTP# copy flash TFTP :IOS备份到TFTP# copy TFTP running-config :TFTP文件烤备到运行# copy TFTP startup-config :TFTP文件烤备到启动# copy TFTP flash :TFTP文件烤备到FLASH# erase start :清除NVRAM文件# erase flash :清除IOS静态路由:router(config)# ip route 192.168.1.0 255.255.255.0 218.68.45.2 :静态路由router(config)# ip route 0.0.0.0 0.0.0.0 218.68.45.1 : 缺省路由router(config)# ip classless :起用缺省路由router(config)# no ip classless :关闭缺省路由路由信息协议RIP :router(config)# router riprouter(config-router)# network 172.16.0.0router(config-router)# version 2 :使用RIP v2内部网关路由选择协议IGRP :router(config)# router igrp 100router(config-router)# network 172.16.0.0router(config-router)# variance multipiler :开启负载均衡# debup ip rip :查看路由器收发的路由更新包# show ip protocols :查看运行协议和特性# show ip route :查看路由表的正确性C : 直连网段R :学习到的路由I :学习到的路由开放最短路径优先协议OSPF :router(config)# router lspf 1/2/3…….router(config-router)# network 172.16.0.0 0.0.255.255 area 0router(config-router)# network 192.168.1.0 0.0.0.255 area 0router(config)# interface loopback 0 :回环接口(永远是up状态)router(config-if)# ip ospf priority 50 :更改优先级# show ip ospf interface fastethernet 0/0 :查看优先级router(config-if)# bandwidth 64 : 更改接口带宽router(config-if)# ip ospf cost 1 2 3……….: 更改开销router(config-if)# ip ospf authentication-key password :接口验证密码router(config-router)# area area-number authentication : 声明验证(config-if)# ip ospf message-digest-key 1 md5 7 asecret : 接口安全验证密码(config-router)# area 0 authentication message-digest : 声明安全验证# clear ip route * :清除路由表# debug ip ospf adj :查看所有OSPF事件增强型路由选择协议EIGRP :Router(config)# router eigrp 100Router (config-router)# network 10.0.0.0router(config-router)# no auto-summary :关闭有类,开启无类router(config-if)# bandwidth kilobits :逻辑改变接口带宽router(config-if)# eigrp log-neighbor-change :邻居关系变化保存到日志里# show ip eigrp neighbors :显示EIGRP邻居表# show ip eigrp interfaces :显示接口EIGRP信息# show ip eigrp rtopology :显示拓朴表的内容# show ip eigrp topology all-ainks :显示网络所有路径# debug eigrp packet :显示EIGRP所有信息包标准访问控制列表:router(config)# access-list 2 deny 192.168.1.0 0.0.0.255router(config)# access-list 2 deny 192.168.3.3 0.0.0.255router(config)# access-list 2 permit anyrouter(config-if)# ip access-group 2 out/inrouter(config)# line vty 0 4router(config-line)# access-class 2 in/out扩展访问控制列表:router(config)# access-list 101 deny tcp 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255 eq tcp router(config)# access-list 101 deny ccp 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255 eq ftp-adta router(config)# access-list 101 permit ip any anyrouter(config-if)# ip access-group 101 in/out命名访问控制列表:router(config)# ip access-list extended serverouter(config-ext-nacl)# permit TCP any host 192.168.1.1 eq telnetrouter(config-ext-nacl)# permit TCP any host 192.168.1.1 eq smtprouter(config-ext-nacl)# deny ip any any logrouter(config-if)# ip access-group serve outrouter(config-ext-nacl)# no permit TCP any host 192.168.1.1 eq telnet :删除语句# show ip access-lists :查看建立的访问列表# show ip interface e0 :查看接口列表方向Catalyst 交换机的配置:2950Switch# delete flash:vlan.dat :清除存在VLAN信息2950Switch# erase startup-config :清除备份配置STARUP-CONFIG2950Switch# reload :重新启动1900Switch# delete nvram :清除备份配置STARUP-CONFIGconsole线和vty线密码:switch(config)# line console 0switch(config-line)# password xxxxswitch(config-line)# loginswitch(config-line)# line vty 0 4switch(config-line)# password xxxxswitch(config-line)# login2950IP地址和网关配置:switch(config)# interface VLAN1switch(config-vlan)# ip address 192.168.1.1 255.255.255.0switch(config-vlan)# ip default gateway 192.168.1.11900IP地址和网关配置:switch(config)# ip address 192.168.1.1 255.255.255.0switch(config)# ip default gateway 192.168.1.1交换机WEB服务器配置:switch(config)# ip http serverswitch(config)# ip http port 80switch# show mac-address-table :查看MAC地址表信息switch# clear mac-address-table :手动清空MAC表添加删除静态MAC地址映射:switch(config)# mac-address-table static 0000.0000.0001 interface fastethernet0/5 vlan1 switch(config)# no mac-address-table static 0000.0000.0001 interface fastethernet0/5 vlan1端口安全配置:switch(config)# interface fastethernet 0/1switch(config-if)# port security max-mac-count 1switch# show port security :查看端口安全switch# show spantree :查看生成树协议switch(config-if)# switchport mode trunk :指明干道switch(config-if)# switchport trunk encapsulation dotlq/ISL :封装协议switch# show trunk :查看封装1900VLAN配置:1900switch(config)# vtp server :模式1900switch(config)# vtp domain xxx :域名1900switch(config)# vtp pruning enable :修剪1900switch(config-if)# trunk on :启动ISL1900switch(config)# vlan 2 name xxx :创建VLAN1900switch(config-if)# vlan-membership static 2 :应用到接口2900VLAN配置:switch# vlan databaseswitch(vlan)# vtp server : 模式switch(vlan)# vtp domain xxx : 域名switch(vlan)# vtp pruning enable : 修剪switch(vlan)# vlan 2 name xxx : 创建VLANswitch(config-if)# switchport mode trunk : 启动802.1qswitch(config-if)# switchport encapsalation salation isl :启动ISLswitch(config-if)# switchport access vlan 2 : 应用到接口switch(config-if)# no switchport accexx vlan 2 :删除VLAN# show vtp counters : 查看收发统计# show vtp status : 查看VTP配置VLAN间路由:router(config-subif)# encapsulation 802.1q :干道封装802.1Qrouter(config-if)# full duplex :启动全双工router(config)# interface fastethernet 0/0.1 :进入子接口router(config-subif)# ip address 192.168.3.1 255.255.255.0 :子接口分IP# show sppanning-tree :查看生成树协议广域网封装:router(config-if)# encapsulation hdlc :封装HDLCrouter(config-if)# encapsulation ppp :封装PPProuter(confin)# hostnamne xxx :验证前起名字router(confin)# username xxx password xxx : 验证前对方名字,密码router(confin-if)# ppp authentication chap/pap :启用验证router(confin-if)# ppp pap sent-username xxx password xxx :开启PAP router(confin-if)# ppp multilink :激活多链路PPP综合业务数字网络技术ISDN :router(confin)# interface bri 0 :进入BRI接口router(confin)# isdn switch-type basic-net3 :指定ISDN交换机类型router(confin-if)# isdn spid1 xxx :支持SPIDrouter(config-if)# encapsulation ppp/hdlc :封装PPP/hdlcrouter(confin)# hostnamne xxx :验证前起名字router(confin)# username xxx password xxx : 验证前对方名字,密码router(confin-if)# ppp authentication chap/pap :启用验证安需拨号路由技术DDR :router(confin)# ip route 10.10.0.0 255.255.0.0 10.1.0.2 :静态路由router(confin)# ip route 0.0.0.0 0.0.0.0 10.1.0.2 :缺省路由router(confin)# dialer-list 1 protocol ip permeit :允许所有IP 或:router(confin)# dialer-list 1 protocol ip sist 101 :防控表101应用到拨号表1router(confin)# access-list 101 deny tcp any any eq ftp :拒绝FTProuter(confin)# access-list 101 deny tcp any any eq telnet :拒绝TELNETrouter(confin)# access-list 101 permit ip any any :允许所有router(confin-if)# dialer-group 1 :应用到口router(confin-if)# dialer map ip 192.168.1.1 name xxx 5555 :定义呼叫信息# show bri/pri :查看接口状态# shw isdn status :查看接口信息# show dialer :查看拨号连接过程帧中继技术FRAME-RELAY :router(confin)# interface s0 :进入接口router(confin-if)# encapsulation frame-relay ietf/cisco :封装帧中继类型router(confin-if)# frame-relay interface-dlci 102 :设置DLCI号router(confin-if)# frame-relay lmi-type ansi/cisco :设置LMI类型点对点子接口:router(confin)# interface s0.1 point-to-point : 点对点子接口router(confin-subif)# ip address 192.168.1.1 255.255.255.0 : 子接口IProuter(confin-subif)# frame-relay interface-dlci 102 :设置DLCI号多点子接口:router(confin)# interface s0.1 multipoint : 多点子接口router(confin-subif)# ip address 192.168.1.1 255.255.255.0 : 子接口IProuter(confin-subif)# frame-relay map ip 192.168.1.2 201 broadcast :映射对方IP# show interface serial0 :查看接口状态# show frame-relay pvc : 查看所有PVC信息# show frame-relay lmi :查看LMI数据流量统计# show frame-relay map :查看影射条目# debug frame-relay lmi :查看能否正确信息NA T配置:Router1(config-if-bri1/0)# ip address negotiatedRouter1(config-if-bri1/0)# ip nat outsideRouter1(config-if-bri1/0)# encapsulation pppRouter1(config-if-bri1/0)# ppp pap sent-username 169 password 169Router1(config-if-bri1/0)# ppp multilinkRouter1(config-if-bri1/0)# dialer load-threshold 60Router1(config-if-bri1/0)# dialer in-bandRouter1(config-if-bri1/0)# dialer-group 1Router1(config-if-bri1/0)# dialer string 169Router1(config-if-bri1/0)# exitRouter1(config)# dialer-list 1 protocol ip permitRouter1(config)# access-list 1 permit anyRouter1(config)# ip route 0.0.0.0/0 interface bri2/0Router1(config)# ip nat onRouter1(config)# ip nat inside source list 1 interface bri 2/0Router1(config)# interface eth 0/0Router1(config-if-eth0/0)# ip address 192.168.0.1/24Router1(config-if-eth0/0)# ip nat inside(1)启动“路由和远程访问”:“开始”菜单->“程序”->“管理工具”->“路由和远程访问”。
路由器的配置命令总结介绍:1.路由选择原则:子网掩码最长匹配,管理距离最小优先,度量值最小优先。
公用命令总结:1.ip route+非直连网段+子网掩码+下一跳地址配置静态/默认路由2.show ip route 查看路由表3.show protocols 显示出所有的被动路由协议和接口上哪些协议被设置4.show ip protocols 显示了被配置在路由器上的路由选择协议,同时给出了在路由选择协议中使用的定时器等信息5.show history 查看历史记录6.secondary+IP地址为接口配置第二个IP地址7.config memory 修改保存在NVRAM中的启动配置8.exec timeout 0 0 设置控制台会话超时为09.service password-encryptin 手工加密所有密码10.line aux 0 进入AUX接口11.bandwidth+数字配置带宽12.write 保存信息到NVRAM13.banner motd # +信息+ # 配置路由器或交换机的描素信息14.description+信息配置接口听描素信息15.vlan database 进入VLAN数据库模式16.vlan +vlan号+ 名称创建VLAN17.show spamming-tree vlan +vlan号查看VLA怕生成树议18.debug ip rip配置模式定义DHCP并命名为gpdxCisco2801(config)#ip dhcp pool gpdx发布地址池的网段Cisco2801 (dhcp-config)#network 192.168.1.0 255.255.255.0设置DNS地址Cisco2801 (dhcp-config)#dns-server 192.168.1.1设定网关地址Cisco2801 (dhcp-config)#default-router 192.168.1.1Cisco2801 (dhcp-config)#endRIP协议:拓扑发生变化的更新过程:先更新自己再发送给邻居定时器:路由更新定时器:默认30s路由失效定时器:默认180s抑制定时器:默认180s路由刷新定时器:默认240s负载均衡:默认是4条,最大支持6条分类有进程交换与快速交换命令:1.router rip 激活RIP协议work +直连网段发布直连网段3.interface lookback 0 激活逻辑接口4.passive-interface +接口类型+接口号配置接口为被动模式5.debug ip +协议动态查看路由更新信息6.undebug all 关闭所有DEBUG信息7.Version 版本号设置使用的RIP版本8.debug ip icmp/rip9.no ip cef 关闭快速交换10.no ip split-horizon 关闭水平分割11.Passive-interface lookback 0被动接口,不向外发送路由更新包,但是任然会接收更新包,或者是Passive-interface default12.ip rip triggered在具体接口启用触发更新,只适合串口13.查资料了解单播更新,默认是广播更新14.ip default 有类网络地址的主类地址缺省路由,这是rip 默认路由而非静态默认路由或者ip default originate15.同时配置静态路由与rip可以实现浮动静态路由16.times basic [Interval between updates] [Invalid] [holddown] [flush]更改定时器17.redistribute static 重发布18.no auto-summary 关闭自动汇总,rip1不能关闭19.ip summary-address rip 192.168.1.0 255.255.255.192 手工汇总20.关闭自动汇总可以解决路由翻转问题21.ip rip authentication mode md5/text 具体接口验证方式Key chain test 验证名称Key 1Key-string cisco 密匙Ip rip authentication key-chain test 调用22.ip class[less]设置有类路由行为或者无类路由行为OSPF协议:1.router ospf +process-ID 激活OSPF协议work+直连网段+area+区域号发布直连网段3.show ip ospf 显示OSPF的进程号和ROUTER-ID4.encapsulation+封装格式更改封装格式5.no ip admain-lookup 关闭路由器的域名查找6.ip routing 在三层交换机上启用路由功能7.show user 查看SW的在线用户8.clear line +线路号清除线路9.ip ospf hello-interval 2010.ip ospf dead-interval 6011.ip ospf network point-to-point 所有回环接口都被宣告是32位的主机路由,如果设置成点到点,则显示的是真实的子网掩码12.clear ip ospf process 重启ospf进程13.ip ospf priority 数字设置接口优先级,优先级位0的接口不参与选举14.auto-cost reference-banwidth 1000 设置参考带宽15.debug ip ospf packet 检查ospf数据分组的接收情况16.ip ospf authentication-key cisco具体接口设置明文密码17.area 0 authentication 区域0启用明文验证18.ip ospf message-digest-key 1 md5 cisco md5验证的密码与密码ID19.area 0 authentication message-digest 区域0启用md5验证20.default-information originate [always] 启用默认路由,注意只有当有默认路由时,该命令才能向外发布,加上always 则就反之分组:Hello分组(组播):1.用于发现邻居2.在成为邻居之前,必须对Hello包里的一些参数进行协商3.Hello包在邻居之间扮演着keepalive的角色4.允许邻居之间的双向通信5.用于在NBMA(Nonbroadcast Multi-access)网络上选举DR和BDR数据库状态描述包(DBD):链路状态数据库的简短描述链路状态请求包(LSR):链路状态更新包(LSU):链路状态确认包(LSAck):OSPF的网络类型OSPF定义的5种网络类型:1.点到点网络 (point-to-point),由cisco提出的网络类型,自动发现邻居,不选举DR/BDR,hello时间10s。
路由器配置命令大全路由器配置命令大全1.连接路由器1.1 使用串行控制台线连接路由器1.2 使用以太网接口连接路由器1.3 使用无线网络连接路由器2.基本配置2.1 配置主机名router(config)hostname [hostname]2.2 配置域名解析router(config)ip domn-name [domn-name] 2.3 配置密码router(config)enable secret [password] router(config)line console 0router(config-line)password [password] router(config-line)loginrouter(config-line)exitrouter(config)line vty 0 15router(config-line)password [password]router(config-line)loginrouter(config-line)exit2.4 配置管理IP地质router(config)interface [interface]router(config-if)ip address [ip-address] [subnet-mask]router(config-if)no shutdown3.网络协议配置3.1 配置静态路由router(config)ip route [destination-network] [subnet-mask] [next-hop]3.2 配置动态路由router(config)router [routing-protocol]router(config-router)network [network-address] [subnet-mask]3.3 配置带宽管理router(config)interface [interface]router(config-if)bandwidth [bandwidth-in-kbps]3.4 配置ACL(访问控制列表)router(config)access-list [access-list-number] [permit/deny] [source-network] [source-wildcard]4.NAT(网络地质转换)配置4.1 配置静态NATrouter(config)ip nat inside source static [inside-local-address] [outside-global-address]4.2 配置动态NATrouter(config)ip nat pool [pool-name] [start-ip-address] [end-ip-address] netmask [subnet-mask]router(config)ip nat inside source list [access-list] pool [pool-name]4.3 配置PAT(端口地质转换)router(config)interface [interface]router(config-if)ip nat insiderouter(config)interface [interface]router(config-if)ip nat outside5.VLAN(虚拟局域网)配置5.1 配置VLANrouter(config)vlan [vlan-id]router(config-vlan)name [vlan-name]5.2 配置接口VLANrouter(config)interface [interface]router(config-if)switchport mode accessrouter(config-if)switchport access vlan [vlan-id]5.3 配置Trunk接口router(config)interface [interface]router(config-if)switchport mode trunkrouter(config-if)switchport trunk allowed vlan [vlan-list]6.特定协议配置6.1 配置DHCP(动态主机配置协议)router(config)ip dhcp pool [pool-name]router(dhcp-config)network [network-address] [subnet-mask]router(dhcp-config)default-router [default-gateway]router(dhcp-config)dns-server [dns-server-ip]6.2 配置NTP(网络时间协议)router(config)ntp server [ntp-server-ip]router(config)ntp update-calendar6.3 配置SNMP(简单网络管理协议)router(config)snmp-server community [community-string] [ro/rw]router(config)snmp-server host [host-ip] [community-string]7.安全配置7.1 配置SSH(安全外壳协议)router(config)hostname [hostname]router(config)ip domn-name [domn-name]router(config)crypto key generate rsarouter(config)ip ssh version 2router(config)line vty 0 15router(config-line)transport input sshrouter(config-line)login localrouter(config-line)exit7.2 配置防火墙router(config)access-list [access-list-number] [permit/deny] [source-network] [source-wildcard] router(config)interface [interface]router(config-if)ip access-group [access-list-number] [in/out]附件:无法律名词及注释:- IP地质:Internet Protocol Address,互联网协议地质,用于标识网络上主机的唯一数字标识。
路由器的配置命令总结配置路由器的命令可以分为以下几类:1. 基础配置命令:- configure terminal:进入全局配置模式- hostname:设置路由器的主机名- enable password:设置特权模式密码- line console 0:进入控制台线路配置模式- line vty 0 4:进入虚拟终端线路配置模式2. 接口配置命令:- interface interface_name:进入接口配置模式- ip address:配置接口IP地址- no shutdown:激活接口- description:为接口添加描述信息3. 路由配置命令:- ip route destination_network next_hop:配置静态路由- router rip:进入RIP路由器配置模式- network:指定RIP协议工作的网络地址4. 网络地址转换(NAT)配置命令:- ip nat inside source static inside_local_ip outside_global_ip:配置静态NAT- ip nat pool pool_name start_ip end_ip netmask:配置动态NAT 池5. 访问控制列表(ACL)配置命令:- access-list acl_number {deny | permit} source destination:创建ACL规则- interface interface_name:进入接口配置模式- ip access-group acl_number {in | out}:应用ACL到接口6. VLAN配置命令:- vlan vlan_id:创建VLAN- switchport mode {access | trunk}:配置接口模式7. 安全配置命令:- enable secret:设置特权模式加密密码- username username password password:创建本地用户8. 特定协议配置命令:- router ospf process_ID:进入OSPF路由器配置模式- network network_address wildcard_mask area area_number:配置OSPF网络- router bgp autonomous_system_number:进入BGP路由器配置模式- neighbor ip_address remote-as autonomous_system_number:配置BGP邻居以上是一些常见的路由器配置命令,不同型号和品牌的路由器可能会有一些差异,具体命令请参考相应的操作手册或文档。
路由器命令大全路由器命令router> 用户模式1:进入特权模式 enablerouter > enablerouter #2:进入全局配置模式 configure terminalrouter > enablerouter #configure terminalrouter (conf)#3:交换机命名 hostname routera 以routerA为例router > enablerouter #configure terminalrouter(conf)#hostname routerAroutera (conf)#4:配置使能口令 enable password cisco 以cisco为例router > enablerouter #configure terminalrouter(conf)#hostname routerArouterA (conf)# enable password cisco5:配置使能密码 enable secret ciscolab 以cicsolab为例router > enablerouter #configure terminalrouter(conf)#hostname routerArouterA (conf)# enable secret ciscolab6:进入路由器某一端口 interface fastehernet 0/17 以17端口为例router > enablerouter #configure terminalrouter(conf)#hostname routerArouterA (conf)# interface fastehernet 0/17routerA (conf-if)#进入路由器的某一子端口 interface fastethernet 0/17.1 以17端口的1子端口为例router > enablerouter #configure terminalrouter(conf)#hostname routerArouterA (conf)# interface fastehernet 0/17.17:设置端口ip地址信息router > enablerouter #configure terminalrouter(conf)#hostname routerArouterA(conf)# interface fastehernet 0/17 以17端口为例routerA (conf-if)#ip address 192.168.1.1 255.255.255.0 配置交换机端口ip和子网掩码routerA (conf-if)#no shut 是配置处于运行中routerA (conf-if)#exit8:查看命令 showrouter > enablerouter # show version 察看系统中的所有版本信息show interface vlan 1 查看交换机有关ip 协议的配置信息show running-configure 查看交换机当前起作用的配置信息show interface fastethernet 0/1 察看交换机1接口具体配置和统计信息show mac-address-table 查看mac地址表show mac-address-table aging-time 查看mac地址表自动老化时间show controllers serial + 编号查看串口类型show ip router 查看路由器的路由表9:cdp相关命令router > enablerouter # show cdp 查看设备的cdp全局配置信息show cdp interface fastethernet 0/17 查看17端口的cdp配置信息show cdp traffic 查看有关cdp包的统计信息show cdp nerghbors 列出与设备相连的cisco设备10:csico2600的密码恢复重新启动路由器,在启动过程中按下win+break键,使路由器进入rom monitor在提示符下输入命令修改配置寄存器的值,然后重新启动路由器remmon1>confreg 0x2142remmon2>reset重新启动路由器后进入setup模式,选择“no”,退回到exec模式,此时路由器原有的配置仍然保存在startup-config中,为使路由器恢复密码后配置不变把startup-config中配置保存到running-config中,然后重新设置enable密码,并把配置寄存器改回0x2102:router>enablerouter#copy startup-config running-configrouter#configure terminalrouter(conf)#enable password ciscorouter(conf)#config-register 0x2102保存当前配置到startup-config , 重新启动路由器。
路由器命令大全四、常用命令1. 帮助在 IOS 操作中,无论任何状态和位置,都可以键入“?”得到系统的帮助。
2. 改变命令状态任务命令进入特权命令状态 enable (可能)退出特权命令状态 disable (失去)进入设置对话状态 setup (设置)进入全局设置状态 config terminal(终端)退出全局设置状态 end (结束)进入端口设置状态 interface(接口) type(类型) slot(槽)/number 进入子端口设置状态 interface type number.subinterface(子接口)[point-to-point(点对点) | multipoint(多点)]进入线路设置状态 line(线) type slot/number进入路由设置状态 router(路由器) protocol(协议)退出局部设置状态 exit(退出)3. 显示命令任务命令查看版本及引导信息 show(显示) version(版本)查看运行设置 show running(运行)-config查看开机设置 show startup-config显示端口信息 show interface type slot/number显示路由信息 show ip router4. 拷贝命令用于 IOS 及CONFIG 的备份和升级5. 网络命令任务命令登录远程主机 telnet(远程登录) hostname|IP address(住址)网络侦测 ping hostname|IP address路由跟踪 trace(跟踪) hostname|IP address6. 基本设置命令任务命令全局设置 config terminal设置访问用户及密码 username username password password设置特权密码 enable secret(秘密的) password设置路由器名 hostname name设置静态路由 ip route(路由选择) destination(目的地) subnet (子[分支]网络)-mask(面具) next-hop(跳跃)启动IP 路由 ip routing(路由选择)启动IPX 路由 ipx routing端口设置 interface type slot/number设置IP 地址 ip address address subnet-mask设置IPX 网络 ipx network network激活端口 no shutdown(关机)物理线路设置 line type number启动登录进程 login [local|tacacs(终端访问控制器访问控制系统)server]设置登录密码 password password。
路由器常用命令路由器是网络中非常重要的设备,它将数据包从一个网络转发到另一个网络,实现网络之间的连接。
为了正确配置和管理路由器,掌握常用的路由器命令是非常重要的。
本文将介绍一些常用的路由器命令,帮助读者更好地理解和应用路由器。
一、登录路由器要使用路由器命令,首先需要登录到路由器的控制台。
登录路由器的方式通常是通过终端模拟器(例如SecureCRT、Xshell等)使用Telnet、SSH等协议远程登录到路由器。
常用的登录命令如下:1. Telnet IP地址:使用Telnet协议登录到路由器,其中IP地址是路由器的IP地址。
2. SSH IP地址:使用SSH协议登录到路由器,其中IP地址是路由器的IP地址。
登录成功后,输入用户名和密码即可进入路由器的控制台。
二、显示路由器信息登录到路由器后,我们可以使用一些命令来查看和分析路由器的各种信息。
下面是一些常用的显示命令:1. show ip interface brief:显示所有接口的状态和IP地址。
2. show running-config:显示当前运行的配置信息。
3. show version:显示路由器的软件版本和硬件信息。
4. show ip route:显示路由表的内容。
5. show arp:显示路由器ARP缓存表的内容。
三、配置路由器配置路由器是使用路由器命令的重要部分。
通过配置路由器,我们可以为它指定IP地址、设置路由表、启用协议等。
下面是一些常用的配置命令:1. configure terminal:进入全局配置模式。
2. interface 接口名称:进入接口配置模式,例如interface GigabitEthernet0/0/0。
3. ip address IP地址掩码:为接口配置IP地址和子网掩码。
4. no shutdown:开启接口。
5. ip route 目标网络目标子网掩码下一跳地址:添加一条静态路由。
6. hostname 主机名:设置路由器的主机名。
路由器配置常用命令汇总路由器是连接网络设备的关键组件,用于将网络流量从一个网络传输到另一个网络。
配置路由器是网络管理员的重要任务之一,通过配置路由器,管理员可以确保网络安全,优化网络性能和管理网络流量。
下面是常用的路由器配置命令的汇总。
1.基本设置命令- enable:进入特权模式- configure terminal:进入全局配置模式- hostname [name]:设置路由器主机名- interface [interface-name]:进入接口配置模式- ip address [ip-address] [subnet-mask]:设置接口的IP地址和子网掩码2.接口配置命令- shutdown:关闭接口- no shutdown:启用接口- description [description]:为接口添加描述信息- speed [speed]:设置接口速率- duplex [duplex]:设置接口双工模式(全双工或半双工)3.路由配置命令- ip route [network-address] [subnet-mask] [next-hop-address]:添加静态路由- ip default-gateway [default-gateway-address]:设置默认网关- router rip:进入RIP路由协议配置模式- network [network-address]:启用RIP协议,并指定需要进行路由的网络地址4.网络地址转换(NAT)命令- ip nat inside source static [local-ip] [global-ip]:静态NAT配置- ip nat inside source list [access-list-number] interface [interface-name] overload:动态NAT配置- access-list [access-list-number] permit [source-address] [subnet-mask]:创建ACL以定义需要进行NAT转换的源地址5.防火墙配置命令- access-list [access-list-number] permit [source-address] [subnet-mask]:创建允许流量通过的ACL规则- access-list [access-list-number] deny [source-address] [subnet-mask]:创建阻止流量通过的ACL规则- interface [interface-name] ip access-group [access-list-number] in/out:将ACL应用到接口的进出方向6.路由器安全配置命令- enable secret [password]:设置特权模式密码- username [name] password [password]:创建本地用户名和密码- line vty 0 4:进入虚拟终端配置模式- login local:启用本地用户名和密码验证- service password-encryption:对密码进行加密7.服务配置命令- ip dhcp pool [pool-name]:创建DHCP地址池- network [network-address] [subnet-mask]:指定地址池所在的网络地址和子网掩码- default-router [default-gateway-address]:指定默认网关- dns-server [dns-server-address]:指定DNS服务器地址8.路由器监控和故障排除命令- show interface [interface-name]:显示接口信息- show ip route:显示路由表- show ip interface brief:显示接口摘要信息- show ip nat translations:显示NAT转换信息- ping [ip-address]:向指定IP地址发送ping命令进行连通性测试这只是一部分常用的路由器配置命令,实际使用中还有更多的命令可用于不同的路由器配置场景。
路由器命令总结路由器命令状态:>> 路由器处于rxboot状态,开机60秒内按ctrl+break可进入此状态用于软件升级和手工引导.router>用户命令状态,只能查看一些基本信息router#特权命令状态router(config)#全局设置状态router(config-if)#接口设置状态路由器口令设置:router>enable 进入特权模式router#config terminal 进入全局配置模式router(config)#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 进入Serail接口router(config-if)#ip address 设置IP地址router(config-if)#ip address second 设置第二个IProuter(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 设置子接口IProuter(config-subif.1)#encapsulation dot1q 序号绑定vlan中继协议(vlan三层路由)注: dot1q 为IEEE802.1Q标准isl为思科专用router#write 保存配置信息router#copy running-config startup-config 保存当前配置nvramrouter#debug ip rip 监测配置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 命令格式注: 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路由协议。
router(config-router)#network 设置发布路由router(config-router)#version 设置rip版板router(config-router)#no auto-summary 禁用自动聚合(当子网不连续时)v2版本router(config-if)#ip rip send version 1 允许v2给v1发送报文(运行v2的接口模式下)router(config-if)#ip rip receive version 1 允许v2接收v1的报文(运行v2的接口模式下)router(config-if)#ip rip send version 1 2 同时发送v1, v2报文(在运行v2的接口模式下)注: 当运行rip version 2 的路由器和运行rip version 1的路由器相联时,可以通过接口兼容性开关来实现也可以在一个接口上同时发送和接收v1, v2 两个版本动态路由ospf:router(config)#router ospf 启用ospf进程router(config-router)#network area 启用ospf进程例: network 192.168.10.2 0.0.0.0 area 0只在某一接口上启用sopfnetwork 192.168.0.0 0.0.255.255 area 0将属于192.168.0.0网段的所有接口启用ospfrouter(config-router)#network redistribute rip metric 将rip路由重分发到ospf区域router(config-router)#area authentication message-digest 在区域中启用md5认证router(config-router)#area authentication 在区域中启用认证(不加密)router(config-router)#area stub 使该区域成为stub区域router(config-router)#area default-cost 改变ABR通告的默认路由(默认为1) router(config-router)#area stub no-summary 使该区域成为完全stub区域(在ABR上配置)router(config-router)#area nass 使该区域成为nass区域router(config-router)#area nass no-summary 使nass区域不接收lsa3,lsa4(在ABR上配置)router(config-router)#area stub no-redistribution default-information-originate 注: 使nass区域不接收lsa5,lsa7 但接收lsa3,lsa4,(在ABR上配置)router(config-router)#area stub no-redistribution no-summary注: 使nass区域不接收lsa3,lsa4,lsa5,lsa7(在ABR上配置)router(config-router)#area range 区域间汇总router(config-router)#area range null0 防止汇总过大而导至错误注: 地址汇总可以减少LSA泛滥的数量,屏蔽一些网络不稳定的细节,从而节省资源router(config-router)#summary-address 外部路由汇总(不同自治系统间汇总)router(config-router)#area virtual-link 虚链路配置(中间区域两个ASB上配置router(config-router)#summary-addressrouter#show ip interface 查看指定接口信息router#show ip interface 查看指定接口信息router#show ip ospf neighbor 查看邻居结构信息router#show ip ospf database router 查看路由器router#show ip interface 查看指定接口信息router#show ip ospf neighbor 查看邻居结构信息router#show ip ospf database router 查看路由器lsa1通告router#show ip ospf database network 路由器网络lsa2通告(所有于DR相连的route)router#show ip ospf database summary 查看路由器lsa3汇总通告router#show ip ospf database asbr-summary 查看路由器lsa4(通告ASBR主机地址)router#show ip ospf database external 查看lsa5通告(在整个ospf区中泛滥)router#show ip ospf database nass-summary 查看路由器lsa7(在nass区中泛滥)router#show ip ospf database border-rourters 路由器条目(只显示到达ABR和ASBR的路由)router#show ip ospf virtual-link 查看虚链路配置router#show ip route 查看网络条目(数据包要转发的目的网络)注: 区域内( i ) 区域间( I ) (IA) 类型1的外部路由(E1 )计算到达asbr的价值) 类型2外部路由(E2 忽略)router#debug ip adj 查看邻接关系的建立热备份路由协议HRSP:router(config-if)#standby ip 将接口加入备份组router(config-if)#no standby ip 将接口从备份组中脱离注: 需要加入备份组的所有接口起用相同的virtual-ip-address 且在同一网段内router(config-if)#standby priority 设置优先级(默认为100)router(config-if)#standby preempt 设置占先权router(config-if)#standby time 更改hello消息计时器注: hello间隔默认为3秒保持时间最少应该为hello时间的3倍可以在(1-255之间变化)router(config-if)#standby track注: 利用端跟踪,活跃路由器的优先级可以基于路由器端口的可用性自动进行调整,当跟踪的端口不可用时活跃路由器的优先级将被降低(默认为10) 例:standby 48 track interface fastethernet 0/1 100router#show standby 查看备份组状态基本访问控制列表:router(config)#ip access-list { standard | extended } name 命名访问列表router(config)#access-list permitrouter(config)#access-list deny注: 0.0.0.0 255.255.255.255 简写为any 允许或拘绝所有网络0.0.0.0 简写为host 允许或拘绝某个主机返掩码router(config-if)#ip access-group in/out 在接口上定义access-list的方向router(config-if)#ip access-group name in/out 在接口上定义命名access-list的方向扩展访问控制列表:router(config)#access-list {permit|deny } protocol [precedence][tos 基于ip的访问列表注: 扩展列表范围为100-199之间。