• 计算机网络实验-思科路由器操作


    欢迎留言纠错

    路由器的CLI状态

    普通用户模式 Router>
    
    Router>enable进入下一个状态
    
    特权用户模式 Router#
    
    Router#configure terminal进入下一个状态
    
    全局配置模式 Router(config)#
    
    接口配置模式 Router(config-if)#
    

    修改路由器的名字(Hostname)

    Router(config)# hostname Ra  //改名为Ra
    Ra(config)#
    

    设置特权密码

    Router# enable secret password
    

    配置路由器子接口

    Router(config)#interface fastethernet 0/0.1
    //配置封装模式为IEEE802.1Q ,对应VLAN号为10
    Router(config-subif)#encapsulation dot1q 10
    Router(config-subif)#ip address 192.168.10.1 255.255.255.0
    

    配置以太网接口

    //打开该接口的配置 [注意接口的引用方式interfacetype slot#/port#]
    Router(config)# interface FastEthernet0/0
    [下面的命令执行之前都需要执行此命令]
    
    //为该接口配置IP地址
    Router(config-if)# ip address 192.168.1.1 255.255.255.0
    
    //将端口设置为全双工模式 [端口需要成对配置]
    Router(config-if)# duplex full
    
    //将端口速率设为100bps
    Router(config-if)# speed 100
    
    //将端口划分到 Vlan 10
    Router(config-if)# switchport access vlan 10
    
    //将端口设为Trunk(全双工)模式 [端口需要成对配置]
    Router(config-if)# switchport mode trunk
    
    //缺省时,接口都是关闭的。输入此命令开启接口
    Router(config-if)# no shutdown
    

    配置串行接口

    //打开该接口的配置
    Router(config)# interface Serial0/0
    [下面的命令执行之前都需要执行此命令]
    
    //串行线两端都需要设定带宽
    Router(config-if)# bandwidth 56
    
    //串行线中DCE端需设定时钟,DTE端则不需要
    Router(config-if)# clock rate 56000
    
    //为该接口配置IP地址
    Router(config-if)# ip address 192.168.2.1 255.255.255.0
    
    //缺省时,接口都是关闭的。输入此命令开启接口
    Router(config-if)# no shutdown
    

    配置路由协议

    [配置静态路由]-[ip route命令]
    [ip route destination_ip maskcode interface_ip/port_num]
    
    //配置目的IP为192.168.3.0的下一跳是192.168.2.2
    Router(config)# ip route 192.168.3.0 255.255.255.0 192.168.2.2
    
    //利用静态路由配置的方法配置默认路由为192.168.2.1,此处也可当前路由器的某个端口的名称
    Router(config)# ip route 0.0.0.0 0.0.0.0 192.168.2.1
    
    [配置动态路由]-[network命令]
    
    //启用RIP路由协议
    Router(config)# router rip
    //将网络加入路由通报网络
    Router(config-router)# network 192.168.1.0
    Router(config-router)# network 192.168.2.0
    
    [路由相关信息的查看]
    
    //检查路由协议
    Router# show ip protocol
    
    //显示路由表信息
    Router# show ip route
    /*路由表信息中
    C表示路由器直连网络,不给出下一跳地址
    R表示非直连网络,需要给出下一跳地址*/
    
    //查看RIP路由的更新
    Router# debug ip rip
    
    //关闭所有debug进程
    Router# undebug all
    

    配置vlan

    //创建一个vlan
    Router(config)# vlan 10
    //按下回车后紧接着进入当前vlan配置状态
    Router(config-vlan)#
    
    //将vlan重命名为v10
    Router(config-vlan)# name v10
    
    //将vlan 10分配到端口Fa 0/1
    Router(config)# interface Fa 0/1
    Router(config-if)# switchport access vlan 10
    
    //查看已创建的VLAN
    Router# show vlan
    

    查看配置信息

    //查看运行配置信息
    Router# show running-config
    [PS] show running-config命令中出现more时,用空格来显示下一页
    
    //查看开机配置信息
    Router# show startup-config
    
    //将RAM中的当前配置保存到NVRAM中
    Router# copy running-config startup-config
    
    //显示端口信息
    Router# show interface type slot#/port#
    
    //加载来自NVRAM的配置信息
    Router# copy startup-config running-config
    
    //显示路由表信息
    Router# show ip route
    
    //查看已创建的VLAN
    Router# show vlan
    
    //清除缓存的配置文件
    Router# erase startup-config
    
    //重启路由器
    Router# reload
    

    以上是基础知识和实验5、6、7中的重点命令

  • 相关阅读:
    Xshell6提示“要继续使用此程序,您必须应用最新的更新或使用新版本”的解决办法
    设置UIImage的边框和圆角大小以及颜色
    CATransition使用
    [转]C/C++中extern关键字详解
    New ipad与ipad2有何不同
    使用Xcode收藏自己常用的代码模板
    objectivec 关于 self 的用法总结
    查找 EXC_BAD_ACCESS 问题根源的方法
    结构体的对齐方式
    添加three20模板的方法
  • 原文地址:https://www.cnblogs.com/savennist/p/14153126.html
Copyright © 2020-2023  润新知