zoukankan      html  css  js  c++  java
  • CCNA 之 四 管理和配置CISCO设备

    管理和配置CISCO设备

    路由器组件

    route-about

    • cpu 执行操作系统的指令
    • 随机访问存储器RAM - RAM中内容断电丢失
      - 运行操作系统;
      - 运行配置文件;
      - IP 路由表;
      - ARP 缓存;
      - 数据包缓存区;
    • 只读存储区ROM - 保存开机自检软件,存储路由器的启动引导程序
      - bootstrap 指令
      - 基本的自检软件
      - 迷你版IOS,简化的系统,用于主操作系统丢失之后,用于紧急恢复和故障处理时使用;
    • 非易失RAM(NVRAM) - 存储启动配置。包括IP地址、路由协议、主机名
    • 闪存FLASH - 存储运行操作系统Cisco IOS,相当于硬盘;
    • Interfaces - 拥有多种物理接口用于连接网络接口类型;

    路由器启动的主要步骤:

    • 检测路由器硬件
      - Power-on Self Test(POST)
      - 执行bootstrap
    • 定位加载Cisco IOS 软件
      - 定位IOS
      - 加载IOS
    • 定位加载启动配置文件或进入配置模式
      - 启动程序搜寻配置文件

    Cisco Internetwork Operating System(IOS)

    就是为Cisco设备配备的系统软件。它是Cisco的一项核心技术,应用于路由器、局域网交换机、小型无线接入点、具有几十个接口的大型路由器及许多其他设备。

    Cisco IOS 可为设备提供下列网络服务

    • 基本的路由和交换功能
    • 安全可靠地访问网络资源
    • 网络可伸缩性

    访问CLI环境,常用方法有

    • 控制台 console 终端
    • Telnet 或 SSH
    • 辅助端口

    主要的模式有:

    • 用户执行模式">"
    • 特权执行模式"#"
    • 全局配置模式
    • 其他特定配置模式

    全局配置模式

    从全局配置模式可进入多种不同的配置模式。其中的每种模式可以用于配置IOS设备的特定该部分或特定功能。下表列出了这些模式中的一小部分:

    • 接口模式:用于配置一个网络接口(Fa0/0、s0/0/0等)
    • 线路模式:用于配置一条线路(实际线路模或虚拟链路)(例如控制台、AUX或VTY等等)
    • 路由配置模式:用于配置一个路由选择协议进程的相关参数

    详解如下图:
    route-config


    基本IOS命令结构

    • 每个IOS命令都具有特定的格式或语法,并在相应的提示付下执行。
    • 常规命令语法为命令后接相应的关键字和参数。
    • 某些命令包含一个关键字和参数子集,次子集可提供额外功能。

    使用CLI的帮助

    • 命令提示补全
      • 通过问好?来进行
    • 命令语法检查
      • 在命令没有输入完整,会提示% Incomplete command.
      • 当命令输入错误是,会有个尖括号^指定的位置,提示有误% Invalid input detected at '^' marker.
      • 当输入一个位置的命令时会提示% Ambiguous command: "xxxx"
    • 热键和快捷键方式
      • Tab 填写命令或关键字的剩下部分。
      • Ctrl-R 重新显示一行
      • Ctrl-Z 退出配置模式并返回执行模式
      • 向下箭头 用于在重用的命令的列表中向前滚动
      • 向上箭头 用于在重用的命令的列表中向后滚动
      • Ctrl-Shift-6 用于终端诸如pingtraceroute之类的IOS进程
      • Ctrl-C 放弃当前命令并退出配置模式

    基本配置
    配置设备名称需要进入全局配置模式

    R1>enable
    R1#configure terminal
    Enter configuration commands, one per line. End with CNTL/Z.
    R1(config)#hostname sijiayong_route1
    sijiayong_route1(config)#

    配置用户登录密码
    需要进入全局配置模式

    • 控制台口令 - 用于限制人员通过控制台链接访问设备

    sijiayong_route1>en
    sijiayong_route1#conf t
    sijiayong_route1(config)#line console 0
    sijiayong_route1(config-line)#password sijiayong
    sijiayong_route1(config-line)#login # 使设置的登录配置生效
    取消的设置如下
    sijiayong_route1>en
    sijiayong_route1#conf t
    sijiayong_route1(config)#line console 0
    sijiayong_route1(config-line)#no password sijiayong

    • 使能口令 - 用于限制人员访问特权执行模式

    sijiayong_route1>en
    sijiayong_route1#config t
    sijiayong_route1(config)#enable password sijiayong
    注意:这种方式目前已经不用了,安全性很差
    取消:
    sijiayong_route1>en
    sijiayong_route1#config t
    sijiayong_route1(config)#no enable password sijiayong

    • 使能加密口令 - 经加密,用于限制人员访问特权执行模式

    sijiayong_route1>en
    sijiayong_route1#conf t
    sijiayong_route1(config)#enable secret sijiayong
    注意:目前最常用的就是这种模式
    测试:
    sijiayong_route1>en
    Password: # 这里需要密码才能进入特权模式
    sijiayong_route1#
    取消:
    sijiayong_route1>en
    sijiayong_route1#conf t
    sijiayong_route1(config)#noenable secret sijiayong

    • VTY口令 - 用于限制人员通过Telnet访问设备

    VTY是需要手动开启,否则Telnet是不能连接的
    同时需要进入到线路模式配置line
    sijiayong_route1>en
    sijiayong_route1#conf t
    sijiayong_route1(config)#
    注释:这里的 0 4 表示开启 0 1 2 3 4 共五个链接通道,表示同时可有有5个用户同时登陆
    sijiayong_route1(config)#line vty 0 4
    sijiayong_route1(config-line)#pass
    sijiayong_route1(config-line)#password sijiayong
    sijiayong_route1(config-line)#login
    注释:login表示登录时用密码验证

    此时当使用Telnet登陆时,则需要使用密码验证才能登陆。


    查看配置

    • running-config 表示存在RAM中的配置,是当前正在运行的配置,当断电重启,配置则会丢失。

    sijiayong_route1#show running-config
    Building configuration...
    Current configuration : 726 bytes
    !
    version 12.4
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    !
    hostname sijiayong_route1
    !
    boot-start-marker
    boot-end-marker
    !
    enable secret 5 $1$HeNB$RLIM61UEesQr7oaf4W9rb/
    !
    no aaa new-model
    memory-size iomem 5
    ........................显示的太多,这里不复制了........................

    • startup-config 启动配置,非易失存储器,表示存放在NVRAM或者FLASH中的配置,断电重启后是不会丢失的,当重启后会重新加载到RAM中。

    注意:

    在常规的配置中,所有的操作都是临时存放在RAM
    也就是说,当设备断电重启后,则配置就会丢失
    一定要记得在配置后,使用writecp running-config startup-config这两个命令,来把当前RAM中保存的配置写到非易失存储器中。

    演示如下:

    方式一:
    sijiayong_route1#write
    Building configuration...
    [OK]
    方式二:
    sijiayong_route1#copy running-config startup-config
    Destination filename [startup-config]? #这里需要回车确认
    Building configuration...
    [OK]

    删除启动配置文件
    也就是清空配置

    对于一些比较老旧的设备我们使用erase startup-config命令来清空,因为配置都存放在NVRAM中。
    对于当前的新的设备,配置都存放在FLASH当中,需要使用delete

    基本配置 接口配置
    网络设备的接口是有编号的,是从0开始的,并且接口所在的槽位也是从0开始的,也就是说,第一个槽位的第一个接口的编号是:0/0
    这里需要注意:思科设备的接口,默认情况下是关闭的,需要手动开启。
    那么进入接口配置的命令就如下:

    R2>enable
    R2#configure terminal
    R2(config)#interface fastEthernet 0/0
    R2(config-if)#ip address 10.0.0.2 255.255.255.0
    R2(config-if)#no shutdown # 这里表示启动该端口

    特别注意:如果设备是串行网络,在DCE端需要配置clock时钟频率,在DTE端不需要配置;

    R2>enable
    R2#configure terminal
    R2(config)#interface fastEthernet 0/0
    R2(config-if)#ip address 10.0.0.3 255.255.255.0
    R2(config-if)#no shutdown
    R2(config-if)@clock rate 64000

    查看刚刚的配置:

    R2#show interfaces f0/0
    FastEthernet0/0 is up, line protocol is up
    Hardware is AmdFE, address is cc01.0bcc.0000 (bia cc01.0bcc.0000)
    Internet address is 10.0.0.2/24
    MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100 usec,
    reliability 255/255, txload 1/255, rxload 1/255
    Encapsulation ARPA, loopback not set
    Keepalive set (10 sec)
    Full-duplex, 100Mb/s, 100BaseTX/FX
    ARP type: ARPA, ARP Timeout 04:00:00
    Last input 00:00:46, output 00:00:02, output hang never
    Last clearing of "show interface" counters never
    Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
    Queueing strategy: fifo
    Output queue: 0/40 (size/max)
    5 minute input rate 0 bits/sec, 0 packets/sec
    5 minute output rate 0 bits/sec, 0 packets/sec
    31 packets input, 9382 bytes
    Received 26 broadcasts, 0 runts, 0 giants, 0 throttles
    0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
    0 watchdog
    0 input packets with dribble condition detected
    183 packets output, 18783 bytes, 0 underruns
    0 output errors, 0 collisions, 1 interface resets
    0 unknown protocol drops
    0 babbles, 0 late collision, 0 deferred
    0 lost carrier, 0 no carrier
    0 output buffer failures, 0 output buffers swapped out

    这里查看的是详细信息,如果只是想查看配置的ip:

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

    show ip int brief 命令,能看到接口状态,ip地址、协议的状态。

    技术男一枚,喜欢做技术分享,把学习的过程,以及遇到问题的解决过程都愿意分享给大家,博客中如有不足,请留言或者联系博主,感谢。 邮箱: sijiayong000@163.com Q Q: 601566386
  • 相关阅读:
    JavaScript事件冒泡简介及应用
    个人作业——软件工程实践总结&个人技术博客
    个人技术总结
    个人作业——软件测评
    寒假作业(2/2)
    寒假作业(1/2)
    gitlab-ci.yml可用关键字描述
    gitlab-Runner配置参数详解
    gitlab-ci部署实现持续集成(centos7)
    linux时间同步操作命令
  • 原文地址:https://www.cnblogs.com/winstom/p/9227822.html
Copyright © 2011-2022 走看看