https://www.cnblogs.com/longhai3/longhai

CISCO>>基础笔记1-2

Posted on 2022-02-12 22:35  凡是过去,皆为序曲  阅读(99)  评论(0编辑  收藏  举报

从路由器用户模式进入特权模式:Router>enable

从特权模式进入全局配置模式:Router#configure terminal

全局模式退出到特权模式:Router(config)#exit

各种子模式下退出到特权模式:Router(config)#end

特权模式退出到用户模式:Router#disable

从全局配置模式进入子配置模式:

进入线路配置模式:如控制台口线路Router(config)#line console number

vty线路:Router(config)#line vty 0 4

进入接口配置模式:如以太网接口Router(config)#interface fast 0/1

============================================================

  • 交换机的命名:Switch(config)#hostname s1
  • 特权明文密码的设置:Switch(config)#enable password 123
  • 特权加密密码的设置:Switch(config)#enable secret 456
  • 控制台密码的设置:

Switch(config-line)#line console 0

Switch(config-line)#password 1234

Switch(config-line)#login

  • 虚拟线密码的配置:

Switch(config-line)#line vty 0 15

Switch(config-line)#password 1234

Switch(config-line)#login


============================================================

  • 全局配置模式下设置密码:

router(config)# enable  password   设置特权明文密码

router(config)# enable  secret      设置特权加密密码

注意:密码区分大小写,空格也可做密码;

同时配置两种密码情况下,优先使用加密密码。

  • 配置线路模式下的密码:

router(config)#line console  | vty  start-number  end-number

router(config-line)#password  ****

router(config-line)#login

注意:线路配置模式下,只能配置明文密码。

  • 明文密码文件加密:router(config)#service password-encryption

注意:开启该服务后,即使将该命令取消或删除,已加密的密码效果不变。

  • 查看当前运行配置:show

特权模式下  router#show running-config --显示RAM中起作用的路由配置信息

全局模式下  router(config )#do show running-config

  • 删除或取消命令:

no 需要删除或取消的命令

  • 保存当前设备配置

router(config )#copy running-config startup-config  -- 把当前设备的运行配置保存到flash中

router(config )#write  --保存配置信息(推荐)


============================================================

(一)交换机

1、交换机是工作在OSI模型第二层(数据链路层)的中间设备,可识别通信数据中MAC地址,并根据MAC地址与对应的端口进行数据转发。

2、相关配置命令:

  • 虚拟端口ip地址的分配:

Switch(config-if)#interface vlan1

Switch(config-if)#ip address 192.168.1.2 255.255.255.0

Switch(config-if)#no shutdown

  • 给接口配地址:

Switch(config-if)#interface interface0/1

Switch(config-if)#ip address 192.168.1.2 255.255.255.0

Switch(config-if)#no shutdown   

  • 配置默认网关

Switch (config)#ip default gateway

(二)路由器

1、路由器是工作在OSI模型第三层(网络层)的中间网络设备,是连接局域网与局域网、局域网与广域网、广域网与广域网的设备,具有判断网络地址并选择路由的功能。

2、相关配置命令:

  • 查看当前运行配置:show

特权模式下  router#show running-config --显示RAM中起作用的路由配置信息

全局模式下  router(config )#do show running-config


============================================================

(一)交换机

1、二层交换机是工作在OSI模型第二层(数据链路层)的中间设备,可识别通信数据中MAC地址,并根据MAC地址与对应的端口进行数据转发。

2、相关配置命令:

  • 交换机的命名:Switch(config)#hostname s1
  • 特权明文密码的设置:Switch(config)#enable password 123
  • 特权加密密码的设置:Switch(config)#enable secret 456
  • 控制台密码的设置:

Switch(config-line)#line console 0

Switch(config-line)#password 1234

Switch(config-line)#login

  • 虚拟线密码的配置:

Switch(config-line)#line vty 0 15

Switch(config-line)#password 1234

Switch(config-line)#login

  • 进入全局配置模式,设置标语信息:Router(config)#banner motd  # text#
  • 虚拟端口ip地址的分配:

Switch(config-if)#interface vlan1

Switch(config-if)#ip address 192.168.1.2 255.255.255.0

Switch(config-if)#no shutdown

  • 给接口配地址:

Switch(config-if)#interface interface0/1

Switch(config-if)#ip address 192.168.1.2 255.255.255.0

Switch(config-if)#no shutdown   

  • 配置默认网关

Switch (config)#ip default gateway

(二)路由器

1、路由器是工作在OSI模型第三层(网络层)的中间网络设备,是连接局域网与局域网、局域网与广域网、广域网与广域网的设备,具有判断网络地址并选择路由的功能。

2、相关配置命令:

  • 全局配置模式下设置密码:

router(config)# enable  password   设置特权明文密码

router(config)# enable  secret      设置特权加密密码

注意:密码区分大小写,空格也可做密码;

同时配置两种密码情况下,优先使用加密密码。

  • 配置线路模式下的密码:

router(config)#line console  | vty  start-number  end-number

router(config-line)#password  ****

router(config-line)#login

注意:线路配置模式下,只能配置明文密码。

  • 明文密码文件加密:router(config)#service password-encryption

注意:开启该服务后,即使将该命令取消或删除,已加密的密码效果不变。

  • 查看当前运行配置:show

特权模式下  router#show running-config --显示RAM中起作用的路由配置信息

全局模式下  router(config )#do show running-config

 

随心,随记

https://www.cnblogs.com/w1hg/331817