鄞州 发表于 2018-6-23 11:09:19

Cisco常用命令及缩写

↑/↓键:调出上/下一条命令 Tab键:补全命令
?键:调出当前模式下的所有命令
注销本次登录:exit、logout、quit
no:取消某配置例如“noip add 192.168.1.2 255.255.255.0”
或命令的反义例如“no shutdown”
Switch (vlan)# no vlan2 \\删除编号为2的VLAN<前提该VLAN不包含任何端口>
Switch(config-if)# no switchport access vlan 2
Router(config-router)# no router rip\\取消RIP配置的动态路由信息
缩写 enable →en configureterminal →conf t show →shinterface intfastethernet 0/1 → f0/1 ethernet 0/1 → e0/1 serial 2/0 → s2/0 address → add password pass shutdown → shut console →con hostname → host database →data encapsulation →enca

鄞州 发表于 2018-6-23 11:12:06

1.   > enable   # config terminal Router    (config)# interface fastethernet0/1    Switch(config)# interface vlan 1
用户模式→特权模式特权模式→全局配置模式(路由器)全局配置模式→接口模式(交换机)全局配置模式→接口模式
2.# disable 特权模式→用户模式
3.(config)# end 全局或接口模式→特权模式,等同于“ctrl+z”
4.exit从当前模式退回到前一模式
5.(config)#interface vlan 1进入vlan 1接口
6.(config-if)# ip address 192.168.1.2255.255.255.0 配置当前接口的IP地址(注意给交换机只能配置vlan1 的IP,而对路由器可以对物理端口配置IP)
7.(config-if)# no shutdown 打开当前接口
8.(config)# hostname R1 配置主机名,例如为R1(接口模式下也可用该命令)
9.# show version 显示系统IOS名称及版本信息
10.# show running-config显示当前配置信息
11.# show startup-config显示已保存的配置信息
12.# copy running-config startup-config保存当前已配置的信息(2种命令均可)
13.# write
14.# erase nvram删除已保存的配置信息(3种命令均可)
15.# deletenvram: startup-config
16.# erase startup-config
17.   (config)# line console 0 (config-line)#exec-timeout 0 0 修改会话超时时间,避免返回到初始界面(此时需按下Enter键才进入用户界面)。
18.(config)# line con 0(config-line)# logging synchronous 启动同步显示,避免在配置交换机时,控制台显示的一些信息会打断配置过程。
19.(config)# no ip domain-lookup 禁用DNS查找

鄞州 发表于 2018-6-23 11:31:07

32.Router(config)# ip route 192.168.1.0 255.255.255.0 192.168.10.2 50 配置(浮动)静态路由。假设目的网络地址为192.168.1.0,子网掩码255.255.255.0,本地接口192.168.10.2,管理距离50
33.Router(config)# ip route 192.168.1.0 255.255.255.0 192.168.11.2 50 配置备份链路的浮动静态路由
34. Router(config)# ip route 0.0.0.0 0.0.0.0 192.168.11.1 50 配置默认路由。假设下一跳路由器的接口地址为192.168.11.1,管理距离50
35. Router# show ip route 显示路由器的路由表
36.Router(config)# int s0/1 Router(config-if)# shut关闭路由器的s0/1接口
37. (config)# access-list 1 permit 192.168.1.0 0.0.0.255定义访问控制列表。假设控制列表号为1,permit允许访问的地址是192.168.1.0~192.168.1.255
38.Router(config)# ipnat inside source list 1 int f0/1 overload 实现外接口地址的复用及IP地址的动态转换。表示从inside接口进入并符合access-list1要求的数据包,它的源地址将被进行PAT转换;在 f0/1 接口上进行接口复用;overload过载。
39.Router(config)# int f0/0 Router(config-if)# ipnat inside Router(config)# int f0/1Router(config-if)# ipnat outside 在路由器当前接口上启用PAT端口复用

鄞州 发表于 2018-6-23 11:31:41

40. (config)# line con 0 (config-line)# password china123 (config-line)# login 配置console口密码。假设为china12341. (config)# enable password china123 配置进入特权模式的明文密码42. (config)# enable secret china456 配置进入特权模式的加密密码43. (config)# service password-encryption 加密明文密码44. (config)# line vty 0 4 (config-line)# password china123 (config-line)# login 配置交换机VTY密码。0 4表示允许进入的接口号数假设密码为china12345. # telnet 192.168.1.2远程登录交换机或路由器。用户模式也可用该命令。46. (config)# ip default-gateway 192.168.1.1 配置默认网关47.# copy tftp flash # copy flash tftp升级路由器IOS。从远程tftp服务器上复制路由器的IOS把路由器的IOS复制到远程tftp服务器上备份48.# copy ftp flash # copy flash ftp 升级路由器IOS。从远程ftp服务器上复制路由器的IOS 把路由器的IOS复制到远程ftp服务器上备份路由器密码恢复(拔电源重启60s内按Ctrl+Pause Break键进入ROM Monitor)49. rommon1>confreg 0x2142rommon2>reset                                  Router# copystartup-config running-config # conf t (config)# line con 0                           (config-line)# nopassword (config-line)# exit (config)# config-register 0x2102               (config)# exit # copy running-configstartup-config修改配置寄存器值为2142。重启,进setup模式。把startup-config配置保存到running-config中。设置console口密码为空将配置寄存器的值改回0x2102保存配置交换机密码恢复(按住MODE键→插电源→出现Switch:时松开MODE键)50. flash_init renameflash:config.textflash:config.old boot # renameflash:config.oldflash:config.text # copy flash:config.textsystem:running-config# conf t(config)# line con 0                           (config-line)# nopassword (config-line)# end# copyrunning-config startup-config初始化FLASH 重命名FLASH中的配置文件,这样就不会加载密码重启(或reset)→按Ctrl+C键直接进入系统。把配置文件的名字改回来手工加载配置文件设置console口密码为空保存配置第九章 Benet公司网络组建工程51.Router (cofig)# ipdhcp pool global 配置DHCP服务。定义地址池,假设poolname是global。52. Router(dhcp-config)# network 192.168.1.0 255.255.255.0 动态分配IP地址段53. Router(dhcp-config)# default-router 192.168.1.254 设定网关地址54. Router(dhcp-config)# dns-server 192.168.1.253 为客户端配置DNS地址55. Router(dhcp-config)# lease 3设定地址租期,假设为3天56.Router(dhcp-config)# ipdhcp excluded-address192.168.1.1192.168.1.20 预留静态分配的IP地址范围

鄞州 发表于 2018-6-23 12:20:39

怎么给路由器配置IP?
router(config)#interface fastethernet 0/1
router(config-if)#ip address 192.168.1.100 255.255.255.0
router(config-if)#no shutdown
怎么给交换机配置IP?
switch(config)#interface vlan 1
switch(config-if)#ip address 192.168.1.100 255.255.255.0
switch(config-if)#no shutdown
静态路由配置方式:
router(config)#ip route 192.168.1.0 255.255.255.0 192.168.10.1
默认路由配置方式:
router(config)#ip route 0.0.0.0 0.0.0.0 192.168.10.1
浮动路由配置:
router(config)#ip route 192.168.1.0 255.255.255.0 192.168.10.1 50
router(config)#ip route 0.0.0.0 0.0.0.0 192.168.10.1 50
给交换机配置默认网关,方便管理
switch(config)#ip default-gateway 192.168.2.254
辅助地址配置:
switch(config-if)#ip address 192.168.1.1 255.255.255.0 secondary
页: [1]
查看完整版本: Cisco常用命令及缩写