初阶网工必备命令行,好用到起飞(合集)

行业前沿 |  技术干货  | 报告解读 | 职业发展




晚上好,我的网工朋友。


都说命令行是网工一生的朋友,但对于初阶网工来说,要记住这么多,的确有点子压力山大。


本公众号之前曾整理过一波各大厂商的命令行合集,给你先放这里了:


华为设备命令最全大合集(2022新版)
思科设备命令最全大合集(2022新版)
锐捷设备命令最全大合集(2022新版)
华三H3C设备命令最全大合集(2022新版)


今天汇总了下思科系的初阶命令行,简单、实用、使用率极高是它们的特点。


欢迎转发给更多网工朋友们,一起用用😉


今日文章阅读福利:《 网络工程师基础测试题(2023) 》


工欲善其事,必先利其器。武器磨好前,还需要对自身有一个全面的认知。


这份测试题就很适合初阶小白自测能力,扫码发送暗号“测试题”,即可获取资源。


 添加老杨为好友 获取网工必备资源 




01 路由器系列


1. 用户模式和特权模式

Router>enable 

Router>exit (logout 、quit) 

Router#disable 

Rouiter#exit (logout 、 quit) 


2. 接口模式

Router(config)#interface + 接口名称 ----

Router(config-if)# 


3. 子接口模式

Router(config)#interface + 接口名称,子接口号码

----Router(config-subif)# 


4. 链路模式

Router(config)#line console 0 ----Router(config-line)# 

Router(config)#line vty 0 4 ----Router(config-line)# 


5. 命令缓存

Router>show history  

Router>terminal history size + 数字


6. Router 的 Setup 模式

Router#setup 


7. Router 的其他命令

Router#show version 

Router#show running-config 

Router#show startup-config 


8. Router的RAM和NVRAM

Router#copy running-config startup-config 

Router#copy startup-config running-config 

Router#write erase 


9. Router的Banner命令

Router(config)#banner motd # ⋯⋯#


10. Router 的特权模式密码

Router(config)#enable password + 密码

Router(config)#enable secret + 密码

Router的console 密码:

Router(config)#line console 0 

Router(config-line)#login 

Router(config-line)#password + 密码

Router 的 vty 密码:

Router(config)#line vty 0 4 

Router(config-line)#login  

Router(config-line)#password + 密码


11. 接口标识

Router(config-if)#description + 描述信息


12. 配置 console 的其他参数

Router(config-line)#exec-timeout + 分钟 +秒

Router(config-line)#logging synchronous 


13. 配置串口参数


Router#show controller serial+ 编号

Router(config-if)#clock rate 64000 

Router(config-if)#bandwidth 64 


14. 关闭接口

Router(config-if)#(no) shutdown 


15. CDP的配置

Router#show cdp neighbors 

Router#show cdp neighbors detail 

Router#show cdp entry * 

Router#show cdp interface 

Router#show cdp traffic 

Router#(no) cdp run 

Router(config)#(cdp) enable 


16. Telnet 的配置

# Router#telnet +ip 地址

Router#exit 

Router#show sessions 

Router#show user 

Router# x 

Router#resume + 编号 ( 或者按两次 Enter) 

Router#disconnect + 编号

Router#clear + 编号

Ping和Traceroute :

Router#ping +ip 地址

Router#Traceroute+ip 地址


17. 配置 Config-register

Router(config)#config-register+ 寄存器地址


18. 配置启动顺序

Router(config)#boot system flash + 名称

Router(config)#boot system tftp + 文件名 +ip 地址

Router(config)#boot system rom 


19. 备份和恢复 IOS

Router#show flash 

Router#copy flash tftp 

Router#copy tftp flash 


20. 路由器的IP配置

Router(config-if)#ip address+ip 地址 +子网掩码

Router#terminal ip netmask-format (bit-count | decimal | hexadecimal) 

Router(config)#ip host + 主机名 +ip 地址 [ip 地址 ] 

Router(config)#ip domain-name + 域名

Router(config)#ip name-server +DNSserver 的 IP 地址

Router(config)#(no) IP domain-lookup 

Router(config)#show hosts 


21. 配置静态路由

Router(config)#ip route 目的网络 +掩码 [ 下一跳 address | 本地接口 ] 

[distance] [permanent] 

Router#show ip route 


22. 配置缺省路由

Router(config)#ip route 0.0.0.0 0.0.0.0 [ 下一跳 address | 本地接口 ] 

[distance] [permanent] 

Router(config)#ip classless 

Router(config)#no ip classless 


23. 配置VLAN间路由


Router(config-if)#interface fa0/0.1 

Router(config-subif)#encapsulation isl +vlan 编号


24. 配置RIP

Router(config)#router rip 

Router(config-router)#network + 自然网络号

Router#show ip protocols  

Router#show ip route 

Router#(no ) debug ip rip 

Router(config-router)#maximum-paths <1-6> 


25. 配置 IGRP

Router(config)#router igrp + 自治系统编号

Router(config-router)#network + 自然网络号

Router#(no ) debug ip igrp transactions 

Router#(no) debug ip igrp events 

Router(config-router)#traffic-share [share | min] 

Router(config-router)#variance + 容差

Router(config-router)#maximum-paths <1-6> 


26. 配置标准 ACL

Router(config)#access-list + 编号 [permint | deny] 源地址 翻转掩码

Router(config-if)#ip access-group + 编号 [in | out] 

Router#show access-list [ 编号 ] 

Router#show ip interface + 接口名称


27. 配置扩展 ACL

Router(config)#access-list 编 号 [permit | deny] protocol source 

source-mask [operator port ] destination destination-mask [operator port ] 

Router(config-if)#ip access-group 编号 [in |out] 


28. 配置 named ACL

Router(config)# ip access-list [standard | extended] name 

Router(config [std-|ext-nacl])# (no) [permit |deny] + 


29. 测试条件

Router(config-if)#ip access-group [in | out] 


30. 配置 ACL控制 VTY的访问

Router(config)#line vty 0 4 

Router(config-line)#access-class access-list-number [in | out] 


31. 配置 Novell 路由

Router(config)#ipx routing 

Router(config-if)# ipx network 网络号 encapsulation + 封装类型


32. 配置 Novell 封装

Router(config-subif)# ipx network 网络号 encapsulation + 封装类型

Router(config-if)# ipx network 网 络 号 encapsulation + 封装类型

secondary 


33. 配置 Novell 的标准 ACL

Router(config)#access-list 编号 [perming | deny ] 源网络号 [ 节点地址 ] 

[ 节点掩码 ] 目的网络号 [ 节点地址 ] [ 节点掩码 ] 

Router(config-if)#ipx access-group 编号 [in | out] 

配置 Novell 的扩展 ACL:

Router(config)#access-list 编号 [permit | deny ] protocol 源网络号

[ 节点号 ] [ 掩码 ] 源 socket 目的网络号 [ 节点号 ] [ 掩码 ] 


34. 查看 IPX 的命令

Router#show ipx interface  

Router# show ipx route 

Router#show ipx servers 

Router#show ipx traffic 

Router#debug ipx routing activity 

Router#debug ipx sap 

Router#ping ipx +IPX 地址


35. PPP的配置

封装 ppp:

Router(config-if)#encapsulation ppp 


配置主机明、用户名和密码:

Router(config)#hostname + 主机名

Router(conifg)#username + 用户名 password + 密码


选择一种验证方式:

Router(config-if)#ppp authentication [chap | chap pap | pap chap | pap] 


ISDN的配置:

Router(config)#isdn switch-type + 交换机类型

Router(config)#interface bri0 + 接口编号

Router(config-if)#isdn spid1 spid 号码 [ 本地目录号码 ] 

Router(config-if)#isdn spid2 spid 号码 [ 本地目录号码 ] 



DDR的配置:

(1)配置静态路由:

(2)定义敏感数据:

(3)不使用 ACL:

Router(config)#dialer-list 编号 protocol + 某个协议 [permit | deny ] 


(4)使用 ACL:

Router(config)#dialer-list 编号 protocol + 某个协议 list +ACL 编号


配置拨号信息:

Router(config-if)#ip address +IP 地址 +子网掩码

Router(config-if)#dialer-list 编号

Router(config-if)#dialer map 

protocol 下一跳路由器地址 name 远端路友器的主机名 [speed 56 | 64 ] [broadcast] + 拨号字符串


可选配置:

动态器用第二条链路:

Router(config-if)#dialer load-threshold load [outbound | inbound | either] 

配置超时:

Router(config-if)#dialer idle-timeout seconds 


配置帧中继:

(1)配置接口的地址、封装类型

Router(config-if)#encapsulation frame-relay [cisco | ietf] 


(2)配置 LMI 类型:( 可选 ) 

Router(config-if)#frame-relay lmi-type [ansi | cisco|q933a] 


(3)配置逻辑带宽

Router(config-if)#bandwidth + 带宽


(4)配置映射

静态映射:

Router(config-if)#frame-relay map protocol 地址 dlci 编号 [broadcast] [cisco | ietf] 


动态映射:(缺省)

Router(config-if)#frame-relay inverse-arp protocol dici 编号


帧中继的监控和管理:

Router#show interface 

Router#show frame-relay lmi 

Router#show frame-relay pvc 

Router#show frame-relay map 

Router#clear frame-relay-inarp 

Router#debug frame-relay lmi 


02 交换机系列


1. 交换机的配置

Switch#show version 

Switch#show running-config 

Switch(config)#hostname + 交换机主机名

Switch#show ip 

Switch#show spantree 

Switch#show interface 


2. 交换机的双工配置

Switch(config-if)#duplex+ 双工配置


3. 交换机的 IP 配置

Switch(config)#ip address+ip 地址 +子网掩码

Switch(config)#ip default-gateway+ip 地址


4. 交换机 MAC地址表的配置

Switch(config)#mac-address-table permanent +MAC 地址 +对应的端口

Switch(config)#mac-address-table restricted static +MAC 地址 +对应的端口 +允许访问该端口的源端口

Switch(config)#show mac-address-table 

Switch(config-if)#port secure max-mac-count + 该端口最大课学习的 MAC地址数

Switch(config)#address-violation (suspend / disable /ignore) 

Switch#show mac-address-table security 


5. 交换机配置文件的备份和恢复

Switch#copy nvram tftp://tftp 的 IP 地址 // 配置文件名

Switch#copy tftp:// tftp 的 IP 地址 // 配置文件名 nvram 


6. VLAN的配置


(1)配置 VTP

Switch(config)#vtp [server | client | transparent ] [domain+VTP 域名 ] 

[trap (enable | disable) ] [password +密码 ] [pruning (enable | disable) ] 


(2)配置干道链路

Switch(config-if)#trunk [on | off | desirable | auto |nonnegotiate] 

Switch#show trunk [A | B] 


(3)创建和修改 VLAN 

Switch(config)#vlan +vlan 编号 [name+VLAN名称 ] 

Swtich#show vlan [VLAN 编号 ] 


(4)将某个端口加入到某个 VLAN 

Switch(config-if)# vlan-membership [static(vlan 编号 ) | dynamic] 

Switch#show vlan-membership




 文章声明 

本文素材整理自网络,由网络工程师俱乐部排版成文,转载请注明出处,侵删。

 策划制作 

策划:山城   丨   监制:一为
编辑:山城   丨   图源:网络






 网工界最有含金量的思科/华为认证,到底是啥?


拿下思科/华为认证之后,身为网工的你可以:


 跨越90%企业的招聘硬门槛

 增加70%就业机会

 拿下BAT全国TOP100大厂敲门砖

 体系化得到网络技术硬实力

 IE大佬年薪可达30w+


 如何了解+系统学习? 


 识别下方二维码加老杨为好友

 好友验证请备注“考证”

 获得1v1专属咨询+报班千元满减券


 前30名粉丝 免费获得老杨答疑机会 




标签

发表评论

苏ICP备2023052359号-1