设为首页 收藏本站
查看: 899|回复: 0

[经验分享] 附录A 思科互联网络操作系统(IOS)

[复制链接]

尚未签到

发表于 2017-7-9 12:24:27 | 显示全部楼层 |阅读模式
思科互联网络操作系统(IOS)
要点
实现IP编址方案和IP服务,以满足中型企业分支机构网络的网络需求
口在路由器上配置和验证 DHCP和DNS 以及排除其故障(包括CLI/SDM )。
口配置和验证思科设备的基本运行方式和路由选择以及排除这些方面的故障。
口描述思科路由器的工作原理,包括路由器的启动过程、 POST 和路由器组件。
口访问路由器并设置基本参数(包括 CLII/SDM)。
口连接和配置设备接口以及查看其运行情况。
口使用 ping traceroute Telnet SSH 或其他实用工具验证设备的配置和网络连接性。
口使用 ping traceroute 以及 Telnet SSH 验证网络连接性。
口排除路由选择故障。
口使用 show 命令和debug 命令验证路由器硬件和软件的运行情况。
现在该介绍思科 IOS (Internetwork OperatingSystem ,互联网络操作系统)了 IOS 运行在思科路由器和思科交换机上,让你能够对设备进行配置。
在本章中,你将学习 IOS 。我将演示如何使用思科 IOS 命令行界面 (CLI )配置运行思科 IOS路由器 熟悉该界面后,你将能够使用思科 IOS 配置主机名、旗标 (banner) 、密码等,还能够用它排除故障。
本章内容还将帮助你快速掌握路由器配置和验证命令的重要基本知识,下面是本章将讨论的主题:
口理解并配置思科IOS;
口连接路由器;
口启动路由器;
口登录路由器;
口理解路由器提示符;
口理解 CLI 提示符;
口使用编辑和帮助功能;
口收集基本的路由选择信息;
口设置管理功能;
口设置主机名
口设置旗标;
口设置密码;
口设置接口描述:
口配置接口;
口查看、保存和删除配置;
口验证路由选择配置。

1.IOS用户界面
1.1思科路由器IOS
路由器控制台端口、通过调制解调器连接辅助(Aux)端口或通过Telnet访问思科IOS。
1.2 连接思科路由器
1.3 启动路由器
启动思科路由器时,它将执行加电自检(POST)。通过加电自检后,它将在闪存中查找思科IOS,如果找到IOS文件,将把它加载到内存(RAM)中。(注意,闪存是电可檫写可编程只读存储器,即EEPROM)。IOS加载后,它将寻找有效配置(启动配置),这种配置存储在非易失RAM(NVRAM)中。IOS加载并正常运行后,NVRAM中的预配置(也叫启动配置)将被复制到内存(RAM)中。该文件的副本被复制到内存(RAM)中,并被称为运行配置。
进入设置模式:setup

2.命令行界面(CLI)
2.1进入CLI
R1>用户EXEC模式
R1#特权EXEC模式
返回到用户模式
R1#disable
R1>
退出控制台
R1>logout

R1 con0 is now available
Press RETURN to get started.

2.2 路由器模式概述
特权模式进入全局模式
R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#

2.3 CLI提示符
1.接口
R1(config)#interface ?
  Async              Async interface
  BVI                Bridge-Group Virtual Interface
  CDMA-Ix            CDMA Ix interface
  CTunnel            CTunnel interface
  Dialer             Dialer interface
FastEthernet       FastEthernetIEEE
R1(config)#interface fastEthernet 0/0
R1(config-if)#
2.子接口
R1(config)#interface fastEthernet 0/0
R1(config-if)#
3.line命令
R1(config-subif)#end
R1#
R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#
R1(config)#line console 0
R1(config-line)#
4.配置路由选择协议
R1(config)#router rip
R1(config-router)#versi
R1(config-router)#version 2
R1(config-router)#
5.定义路由器术语
用户EXEC模式:只能执行基本的监视命令
特权EXEC模式:让你能够访问其他所有的路由器命令
全局配置模式:可执行影响整个系统的命令
具体的配置模式:可执行只影响接口/进程的命令
设置模式:交互式配置对话
2.4编辑和帮助功能
R1#?
Exec commands:
access-enable    Create atemporary Access-List entry
access-profile   Applyuser-profile to interface
access-template  Create atemporary Access-List entry
  alps             ALPS exec commands
  archive          manage archive files
  audio-prompt     load ivr prompt
  auto             Exec level Automation
  bfe              For manual emergency modessetting
  calendar         Manage the hardware calendar
  call             Voice call
  cd               Change current directory
--More--
空格下一页,回车显示一个,q返回提示符
R1#c?
calendarcall    cd         clear
clock     cns     configureconnect
copycrypto  ct-isdn
设置时间:
R1#clock set 15:21:36 15 november 2015
R1#
*Nov 15 15:21:36.000: %SYS-6-CLOCKUPDATE: System clockhas been updated from 15:22:35 UTC Sun Nov 15 2015 to 15:21:36 UTC Sun Nov 152015, configured from console by console.
命令不完整
R1#clock
% Incomplete command.
命令出错,小脱字符(^),准确指出命令不对的地方。
R1#clock jdf
         ^
% Invalid input detected at '^' marker.

R1#sh serial 0/0/0
        ^
% Invalid input detected at '^' marker.
正确命令
R1#sh interfaces f0/0
FastEthernet0/0 is administratively down, line protocolis down
多个命令以你输入的内容打头,因此含义不明确。要获悉你需要的命令,使用问号。
R1#sh ru?
rudpv1running-config  

高级编辑命令
Ctrl+A:将光标移到行首
Ctrl+E:将光标移到行尾
Esc+B:将光标左移一个字
Ctrl+B:将光标左移一个字符
Ctrl+F:将光标右移一个字符
Esc+F:将光标右移一个字
Ctrl+D:删除一个字符
Backspace:删除一个字符
Ctrl+R:重新显示一行
Ctrl+U:删除一行
Ctrl+W:删除一个字
Ctrl+Z:退出配置模式,返回到EXEC模式
Tab:帮你完成命令的输入

在命令行太长的情况下自动向左滚动
R1#$data you are hahaha too young too simple is a goodidea must know me   

查看路由器命令历史记录
Ctrl+P或上箭头:显示最后一次输入的命令
Ctrl+N或下箭头:显示以前输入的命令
show history:默认显示最近输入的20个命令
show terminal:显示终端配置和历史记录缓冲区的大小
terminal history size:修改缓冲区的大小(最大为256)
R1#show history
  configureterminal
  config t
  clock set15:21:36 november 2015
  clock set 15:21:3615 november 2015
  clock
  jddl
  clock jdf
  sh serial 0/0/0
  sh interfaceserial 0/0/0
  sh interfacesf0/0
R1#show terminal
Line 0, Location: "", Type:
History is enabled, history size is 20.
R1#terminal history size 256
R1#
R1#show terminal
History is enabled, history size is 256.

2.5 收集基本的路由选择信息
R1#show version
Cisco IOS Software, 7200 Software (C7200-IK9S-M),Version 12.4(13b), RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Wed 25-Apr-07 03:18 by prod_rel_team

ROM: ROMMON Emulation Microcode
BOOTLDR: 7200 Software (C7200-IK9S-M), Version12.4(13b), RELEASE SOFTWARE (fc3)

R1 uptime is 43 minutes
System returned to ROM by unknown reload cause - suspectboot_data[BOOT_COUNT] 0x0, BOOT_COUNT 0, BOOTDATA 19
System restarted at 15:00:34 UTC Sun Nov 15 2015
1 FastEthernet interface
125K bytes of NVRAM.

65536K bytes of ATA PCMCIA card at slot 0 (Sector size512 bytes).
8192K bytes of Flash internal SIMM (Sector size 256K).
Configuration register is 0x2102
R1#show interfaces
FastEthernet0/0 is administratively down, line protocolis down
R1#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unsetadministratively down down   
FastEthernet0/0.1          unassigned      YES unsetadministratively down down   
R1#

3.路由器和交换机的管理配置
在路由器和交换机上,可配置的管理功能如下:
主机名;
旗标;
密码;
接口描述。
3.1 主机名
R1#config t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#hostname sanyuan
sanyuan(config)#
3.2 旗标
创建一个旗标,向任何登录到路由器的人显示你想告诉他的信息。
有4种类型的旗标:
sanyuan(config)#banner ?
  exec            Set EXEC process creation banner
  incoming        Set incoming terminal line banner
  login           Set login banner
  motd            Set Message of the Day banner
MOTD是最常用的旗标。它向任何拨号或通过Telnet、辅助端口甚至控制台端口连接路由器的人显示一条消息
sanyuan(config)#banner motd #
Enter TEXT message.End with the character '#'.
hahaha
#

hahaha

sanyuan#
在一行中设置旗标:
sanyuan(config)#banner motd x wawawa x

wawawa
sanyuan#

EXEC旗标 可配置线路激活(EXEC)旗标,这种旗标在创建EXEC进程(如线路激活或有到来的VTY线路连接)时显示。通过控制台端口建立用户EXEC会话时,我们将激活EXEC旗标。
入站旗标可配置一个这样的旗标,即在连到到反向Telnet线路的终端上显示。这种旗标可用于给使用反向Telnet的用户提供操作说明。
登录旗标可配置在所有连接的终端上显示的登录旗标。这种旗标在MOTD旗标之后显示,并在登录提示出现前显示。我们不能基于线路禁用登录旗标,而必须全局禁用它,为此必须使用命令no banner login将其删除。

3.3 设置密码
1.启用密码
sanyuan(config)#enable ?
  last-resort  Define enable action if no TACACS serversrespond
  password     Assign the privileged level password
  secret       Assign the privileged level secret
  use-tacacs   Use TACACS to check enable passwords
sanyuan(config)#enable secret yanjin
sanyuan(config)#enable pas
sanyuan(config)#enable password yanjin
The enable password you have chosen is the same as yourenable secret.
This is not recommended.Re-enter the enable password.
sanyuan(config)#line ?
  <0-6>    First Line number
  aux      Auxiliary line
  console  Primary terminal line
  vty      Virtual terminal
2.辅助端口密码
sanyuan(config)#line aux ?
  <0-0>  First Line number

sanyuan(config)#line aux 0
sanyuan(config-line)#login
% Login disabled on line 1, until 'password' is set
sanyuan(config-line)#pass
sanyuan(config-line)#password aux
sanyuan(config-line)#login
sanyuan(config-line)#
请别忘了执行命令login,否则辅助端口将不进行身份验证。
给线路设置密码前,思科不允许执行命令login,因为如果执行命令login后没有设置密码,该线路将不可用——它将提示用户输入根本不存在的密码。
3.控制台端口密码
sanyuan(config-line)#line console ?
% Unrecognized command
sanyuan(config)#line console ?
  <0-0>First Line number

sanyuan(config)#line console 0
sanyuan(config-line)#pas
sanyuan(config-line)#password console
sanyuan(config-line)#login

命令exec-timeout 0 0将控制台EXEC会话的超时时间设置为0,这意味着永远不超时。
Logging synchronous,它可避免因不断出现控制台消息影响你的输入。配置该命令后,这些消息仍会出现,但会等到返回到路由器提示符后再出现,不会中断你的输入。这样,输入信息将更容易阅读。
sanyuan(config-line)#line con 0
sanyuan(config-line)#exec-
sanyuan(config-line)#exec-t
sanyuan(config-line)#exec-timeout 0 0
sanyuan(config-line)#login
sanyuan(config-line)#loggi
sanyuan(config-line)#logging sy
sanyuan(config-line)#logging synchronous
sanyuan(config-line)#
4.Telnet密码
sanyuan(config-line)#line vty 0 ?
% Unrecognized command
sanyuan(config-line)#line vty 0
sanyuan(config-line)#exit
sanyuan(config)#line vty 0 ?
<1-15>  Last Line number
  <cr>

sanyuan(config)#line vty 0 15
sanyuan(config-line)#passwo
sanyuan(config-line)#password telnet
sanyuan(config-line)#login
sanyuan(config-line)#

让路由器在没有设置Telnet密码也允许建立Telnet连接,我们可以使用no login命令:
sanyuan(config)#line vty 0 4
sanyuan(config-line)#no login
sanyuan(config-line)#
5.设置SSH
sanyuan(config)#hostname yanjin
yanjin(config)#ip dom
yanjin(config)#ip domain-nam
yanjin(config)#ip domain-name sanyuanempire.com
yanjin(config)#username yanjin password sanyuanempire
yanjin(config)#cry
yanjin(config)#crypto ke
yanjin(config)#crypto keyg
yanjin(config)#crypto key g
yanjin(config)#crypto key generate rs
yanjin(config)#crypto key generate rsa gen
yanjin(config)#crypto key generate rsa general-keys mo
yanjin(config)#crypto key generate rsa general-keysmodulus ?
  <360-2048>  size of the key modulus [360-2048]

yanjin(config)#crypto key generate rsa general-keysmodulus 1024
The name for the keys will be: yanjin.sanyuanempire.com

% The key modulus size is 1024 bits
% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]

yanjin(config)#
Nov 15 16:44:09.707: %SSH-5-ENABLED: SSH 1.99 has beenenabled
yanjin(config)#ssh ver
yanjin(config)#ssh versio
yanjin(config)#ssh version 2
                 ^
% Invalid input detected at '^' marker.

yanjin(config)#ssh ?
% Unrecognized command
yanjin(config)#line vty 0 ?
<1-15>  Last Line number
  <cr>

yanjin(config)#line vty 0 15
yanjin(config-line)#transpo
yanjin(config-line)#transport inp
yanjin(config-line)#transport input ssh telnet
yanjin(config-line)#

3.4 对密码进行加密
yanjin#sh running-config
Building configuration...
!
enable secret 5 $1$EtCD$nQpPMpOe/eSWrH9DptcoR1
enable password yanjin
yanjin#config t
Enter configuration commands, one per line.  End with CNTL/Z.
yanjin(config)#servi
yanjin(config)#service pas
yanjin(config)#service password-encryption
yanjin(config)#exit
yanjin#sh running-config
enable secret 5 $1$EtCD$nQpPMpOe/eSWrH9DptcoR1
enable password 7 105708170F1E1C
仅当路由器的CPU使用率很高时,才需禁用加密服务。如果在设置密码前就启用了加密服务,则即使不查看密码,它们也会被加密。
yanjin#configure t
Enter configuration commands, one per line.  End with CNTL/Z.
yanjin(config)#no ser
yanjin(config)#no service pa
yanjin(config)#no service pass
yanjin(config)#no service password-encryption

3.5 描述




来自为知笔记(Wiz)

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-391960-1-1.html 上篇帖子: 思科简单教程CCNA 下篇帖子: 2.2-VLAN间路由
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表