欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

CCNA 实验01 设备基本操作

程序员文章站 2024-02-15 19:30:40
...

一、实验拓扑:

CCNA 实验01 设备基本操作

二、实验需求

  1. 修改设备名称;
  2. 修改系统时间;
  3. 关闭域名解析;
  4. 配置登陆Console口永不超时;
  5. 创建Motd;
  6. 设置和取消密码(Console密码、特权模式密码、VTY密码);
  7. 配置接口IP地址;
  8. 配置R2允许被Telnet;
  9. 查看设备配置及保存设备配置;

三、配置

  1. 修改设备名称;
Router#clock set hh:mm:ss day mouth year
// 修改当前设置的时间,如:clock set 12:15:30 5 jun 2011
Router#config terminal
Router(config)#clock timezone GMT +8
// 修改当前系统的时区为 GMT +8 GMT 全称 Greenwich Mean Time
  1. 修改系统时间;
Router#clock set hh:mm:ss day mouth year
// 修改当前设置的时间,如:clock set 12:15:30 5 jun 2011
Router#config terminal
Router(config)#clock timezone GMT +8
// 修改当前系统的时区为 GMT +8 GMT 全称 Greenwich Mean Time
  1. 关闭域名解析;
Router(config)#no ip domain lookup
// 关闭域名解析
// 在做实验的时候的优化命令时往往会由于打错命令造成路由器会自动去向DNS服务器发送内域名解析请求,容易造成耗损路由器CPU消耗很大,而且解析时间很长而没法继续其他命令。为了加快命令的执行就关闭域名解析功能;
  1. 配置登陆Console口永不超时;
Router(config)#line console 0
Router(config-line)#no exec-time
或 
Router(config-line)#exec-time 0 0
// 配置 console 永不超时(常用于实验环境)
  1. 创建Motd;
Router(config)#banner motd #Welcome to CISCO#
// 配置执行标志区,即为登录路由器时显示的信息,需要一个起始字符和相同的结束字符,如使用:#,此时为 Welcome to CISCO
  1. 设置和取消密码(Console密码、特权模式密码、VTY密码);
Router(config)#line console 0
Router(config-line)#password word
// 进入 console 口,配置 console 口密码,word 为自己指定的密码,例如:password cisco
Router(config-line)#login
// 使密码在 console 线路生效
Router(config-line)#no password word
// 删除密码
Router(config-line)#no login
// 取消密码,使不需要密码设置就能进入 console 口
Router(config-line)#exit
Router(config)#enable password word
// 设置 enable 明文密码,可通过 show run 查看密码
Router(config)#no enable password
// 取消 enable 明文密码
Router(config)#enable secret word
// 设置 enable 密文密码,show run 只能查看到字母、数字等的组合,安全级别高于明文密码,
与明文同时设置时,密文密码生效
Router(config)#no enable secret
// 取消 enable 密文密码
Router(config)#line vty 0 4
// 进入 VTY 0-4 线路
Router(config-line)#password word
// 设置 VTY 线路密码,即用户通过 telnet 登入路由器时输入的密码
Router(config-line)#login
// 使密码在线路上生效
Router(config-line)#no password
Router(config-line)#no login
// 取消 VTY 线路密码,使不需要密码就能远程登录
Router(config-line)#exit
  1. 配置接口IP地址;

两台路由器的基础配置

R1:
Router(config)#hostname R1
R1 (config)#no ip domain lookup
R1(config)#line console 0
R1(config-line)#no exec-timeout
R1(config-line)#logging synchronous
R1(conifg-line)#exit

R2 同理,此处不再赘述。
进入接口,配置 IP

Route(config)#interface type
// 接口类型: serial/ethernet/fastethernet solt/num
Route(config-if)#ip address ip mask
// 为接口配上 IP 地址

R1:

R1(config)#interface fastethernet 0/0
R1(config-if)#ip address 12.12.12.1 255.255.255.252
R1(config-if)#no shutdown

R2:

R2(config)#interface fastethernet 0/0
R2(config-if)#ip address 12.12.12.2 255.255.255.252
R2(config-if)#no shutdown

配置完成后使用show ip interface brief命令查看接口状态

R1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 12.12.12.1 YES manual up up

R2#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 12.12.12.2 YES manual up up

用PING来测试连通性

R1#ping 12.12.12.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.12.12.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/62/120 ms
R2#ping 12.12.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.12.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/41/100 ms
  1. 配置R2允许被Telnet;
    在R2 上完成 TELNET 密码的设置
R2(config)#line vty 0 4
R2(config-line)#password cisco
R2(config-line)#login
R1 telnet 到 R2
R1#telnet 12.12.12.2
Trying 12.12.12.2 ... Open
User Access Verification
Password:
R2>
// 密码输入时是不会显示字符的
  1. 查看设备配置及保存设备配置;
    1) 查看设备配置
Router#show running-config
// 显示设备当前配置(配置信息保存于 RAM 中)
Router#show start-config
// 显示设备开机配置(配置信息保存于 NVRAM 中)

2) 保存你的当前配置到开机配置文件中

Router#write
或 
Router#copy running-config start-config
// 上述两条命令效果相同

3) 删除开机配置文件

Router#erase start-config