百度360必应搜狗淘宝本站头条
当前位置:网站首页 > IT知识 > 正文

精!锐捷路由器配置命令大全,有案例分析

liuian 2025-03-07 20:50 36 浏览

一、路由器基本配置命令

由远程终端登录路由器

Red-Giant>enable ——由用户模式进入特权模式
Password:****** ——输入密码
Red-Giant#configure ——由特权模式进入全局配置模式
Configuring from terminal, memory, or network [terminal]? t ——输入 t继续
Red-Giant(config)#hostname Router ——修改路由器名称

配置接口IP地址

Router(config)#interface fastethernet 0 ——进入以太网口 0接口模式
Router(config-if)#ip address 192.168.1.1 255.255.255.0 ——为其配置 IP地址
Router(config-if)#no shutdown ——启用配置
Router(config-if)#exit ——退至配置模式
Router(config)#interface fastethernet 1 ——进入以太网口 0接口模式
Router(config-if)#ip address 192.168.2.1 255.255.255.0 ——为其配置 IP地址
Router(config-if)#no shutdown ——启用配置
Router(config-if)#exit ——退至配置模式
Router(config)#interface serial 0 ——进入 Serial 0 接口模式
Router(config-if)#ip address 192.168.3.1 255.255.255.0 ——为其配置 IP地址
Router(config-if)#no shutdown ——启用配置
Router(config-if)#exit ——退至配置模式
Router(config)#interface serial 1 ——进入 Serial 1 接口模式
Router(config-if)#ip address 192.168.4.1 255.255.255.0 ——为其配置 IP地址
Router(config-if)#no shutdown ——启用配置
Router(config-if)#end ——退至特权模式
Router#write ——保存配置信息
Router(config)#interface loopback 0 ——新建 Loopback 0
Router(config-if)#ip add 10.10.1.1 255.255.255.0 ——为其配置 IP地址
Router(config-if)#int loopback 1 ——新建 Loopback 1
Router(config-if)#ip add 10.10.2.1 255.255.255.0 ——为其配置 IP地址
Router(config-if)#end——退至特权模式

查看路由器相关配置信息

Router#show ip interface brief ——查看配置状态
Router#show version ——显示路由器版本信息
Router#show ip interface fastethernet 0 ——查看以太网口 0接口配置状态
Router#show running-config——显示当前运行的配置参数
Router#show startup-config——显示 NVRAM中中配置参数的副本
Router#copy running-config startup-config ——将当前运行的配置参数复制到 NVRAM
Router#erase startup-config——清空 NVRAM中的配置参数
Router#reload——重新启动路由器

配置console 登陆密码

Router(config)#line console 0
Router(config-line)#login
Router(config-line)#password star

配置VTY登陆密码

Router(config)#line vty 0 4
Router(config-line)#login
Router(config-line)#password star

配置特权模式登录密码

Router(config)#enable password star——配置明文密码
Router(config)#enable secret star——配置的密码不能与 password密码相同

二、路由器密码丢失的处理方法

  1. 关闭路由器,重新登录超级终端,按默认方法设置;
  2. 启动路由器,不停地按 Ctrl+Pause Break,直至出现 Boot:提示符,输入 Setup-Reg;
Boot:Setup-Reg
  1. 出现如下提示信息,按“ Y”回车确认:
Do you wish to change the configuration?y/n[n]:
  1. 出现提示如下信息,按“ Y”回车确认:
Enable“bypass the system configure file”y/n[n]:
  1. 出现提示如下信息,按“ N”回车确认:
Enable“debug mode?”y/n[n]:
  1. 出现提示如下信息,按“ N”回车确认:
Enable“user break/abort enabled?”y/n[n]:
  1. 出现提示如下信息,按“ N”回车确认:
Change console speed?y/n[n]:
  1. 出现提示如下信息,按“ N”回车确认:
Do you wish to change the configuration?y/n[n]:
  1. 出现提示符“Boot:”,输入Reset;
Boot:reset
  1. 出现提示如下信息,按“ N”回车确认:
Would you like to enter the initial configuration dialog?[Yes]:

此时密码及路由器信息被清除,你就可以顺利进入路由器了······ 可以归纳为“Setup-Reg,两个Y五个N,Reset”。

三、静态路由配置

两台路由器,其中 :

Route A

  • S0:192.168.3.1 ,
  • F1:192.168.2.1 ,
  • Loopback 1:12.12.1.1 ,
  • Loopback 2:12.12.2.1

Route B

  • S0:192.168.3.2 ,
  • F0:192.168.5.1 ,
  • Loopback 3:10.10.1.1 ,
  • Loopback 4:10.10.2.1

具体配置如下:

登录路由器并配置 F0、F1、S0、S1的IP地址

Router>en
Password:
Router#con
Configuring from terminal, memory, or network [terminal]? t

Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#int f1
Router(config-if)#ip address 192.168.2.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#int s0
Router(config-if)#ip address 192.168.3.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#
Router(config)#int s1
Router(config-if)#ip address 192.168.4.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#end

新增Loopback1、Loopback2并为其配置 IP地址

Router#con
Configuring from terminal, memory, or network [terminal]? t
Router(config)#int loopback 1
Router(config-if)#ip address 12.12.1.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#int loopback 2
Router(config-if)#ip address 12.12.2.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit

指向下一跳 路由器

Router(config)#ip route 10.10.1.0 255.255.255.0 192.168.3.2
Router#show ip interface brief
Router#interface serial 0

设置接口物理时钟频率

Router#show control serial 0 ——查看Serial 0 接口型号
Router#configure
Configuring from terminal, memory, or network [terminal]? t
Router(config)#int s0
Router(config-if)#clock rate 64000 ——设置接口物理时钟频率为 64Kbps(DCE)
Router(config-if)#no shutdown
Router(config)#end

为Serial 0 封装PPP协议

Router#configure
Configuring from terminal, memory, or network [terminal]? t
Router(config)#int s0
Router(config-if)#enca ppp ——为Serial 0 封装PPP协议
Router(config-if)#end

测试路由配置信息及互联互通

Router#show ip route
Router#show ip interface brief
Router#show running-config
Router#Ping 192.168.3.1
Router#Ping 192.168.3.2
Router#Ping 10.10.1.1

接下来,在另一台路由器上进行相应配置,并测试互连互通。实验完成!!!

四、RIP动态路由配置

配置步骤:

  1. 启用RIP进程;
  2. 配置Network命令;
  3. 配置均载负衡(代价相等);
  4. 配置RIP发布初始度量值。

(一)配置命令

User Access Verification
Password:
Router>en
Password:

Router#con
Configuring from terminal, memory, or network [terminal]? t
Router(config)#router rip ——开启路由功能
Router(config-router)#version 2 ——升级至版本 2
Router(config-router)#no auto-summary ——在主类边界关闭自动汇总
Router(config-router)#network 192.168.1.0 ——配置 network命令
Router(config-router)#maximum-paths 4 ——配置均衡负载,缺省值为 4
Router(config-router)#default-metric 1 ——配置 RIP发布初始度量值,建议设置为 1
Router#show ip protocols ——验证RIP的配置
Router#show ip route ——显示路由表的信息
Router#clear ip route ——清除 IP路由表的信息
Router#debug ip rip ——在控制台显示 RIP的工作状态
Router#no debug all ——清除控制台显示 RIP的工作状态

(二)实验模型

拓朴图如下,用 RIP配置Route-A和Route-B之间的路由。

配置F0、F1和S0端口IP地址

User Access Verification
Password:
Router>en
Password:
Router#con
Configuring from terminal, memory, or network [terminal]? t
Router(config)#int f0
Router(config-if)#ip add 192.168.1.1 255.255.255.0

Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#int f1
Router(config-if)#ip add 192.168.2.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#int s0
Router(config-if)#ip add 10.1.1.2 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#exit

开启RIP路由功能, 配置Network命令

Router(config)#router rip
Router(config-router)#version 2
Router(config-router)#no auto-summary
Router(config-router)#network 10.1.1.0
Router(config-router)#network 172.16.1.0
Router(config-router)#network 172.16.2.0
Router(config-router)#end

查看配置信息,并测试配置正确与否

Router#show ip route
Router#show ip protocols
Router#debug ip rip
Router#no debug all
Router#ping 192.168.1.1
Router#ping 172.16.1.1
Router#ping 172.16.2.1

接下来,在另一台路由器上进行相应配置,并测试互连互通。实验完成!!!

五、交换机、路由器配置步骤简要说明

(一)配置说明

  1. 首先连接好设备,确保连接正确;
  2. 用超级终端进入路由器,如果忘记了密码,请按密码破解方法清除设置,还原默认设置;
  3. 查看各接口配置信息, “Show ip interface brief ” ,看以前的配置有没有保存在机器里面,视情进行清除设置;
  4. 查看交换机、路由器的配置, “show running -config”;
  5. 按自己的需要给交换机和路由器命名,以便于区分, “hostname XXXXXX”;
  6. 按照配置需求对交换机、路由器的各接口进行配置,配置之前最好查看一下接口时钟类型:
show controllers serial 0
clock rate 64000
no shutdown

记住:对接口配置完退至上一级时一定要保存配置,即 “no shutdown”;

  1. 配置完毕后,退至特权模式下,检查配置的正确与否。

(二)故障排除

如果两台路由器或交换机之间不能互连互通,请按照下列步骤进行检查:

  1. 检查Serial 接口的时钟频率;
  2. 检查同一介质上两个接口的 IP地址是不是在同一网段;
  3. 配置完接口后有没有 “no shutdwon”;
  4. 接口的封装协议是否相同;
  5. 有没有把 IP地址配置错误。

(三)三层交换机的有关说明

  1. 管理二层交换机的 IP地址只有一个生效,且为最后一个 “no shutdown”;
  2. 创建一个 Vlan,至少一个,为了冗余备份。

六、OSPF动态路由配置实验

配置步骤:

  1. 确定Area 0;
  2. 激活进程号;
  3. 反向掩码;
  4. 主干链路区域为 0。
User Access Verification
Password:
router>en


Password:
router#con
Configuring from terminal, memory, or network [terminal]? t
router(config)#int f0
router(config-if)#ip add 192.168.8.1 255.255.255.0
router(config-if)#no shutdown
router(config-if)#exit
router(config)#int f1
router(config-if)#ip add 192.168.2.1 255.255.255.0
router(config-if)#no shutdown
router(config-if)#exit
router(config)#int s0
router(config-if)#ip add 192.168.1.2 255.255.255.0
router(config-if)#no shutdown
router(config-if)#exit
router(config)#int s1
router(config-if)#ip add 192.168.3.2 255.255.255.0
router(config-if)#no shutdown
router(config-if)#int loopback 4
router(config-if)#ip add 12.12.1.1 255.255.255.0
router(config-if)#no shutdown
router(config-if)#int loopback 5
router(config-if)#ip add 12.12.2.1 255.255.255.0
router(config-if)#no shutdown
router(config-if)#int loopback 6
router(config-if)#ip add 12.12.3.1 255.255.255.0
router(config-if)#no shutdown
router(config-if)#exit

配置OSPF路由协议

router(config)#router ospf 11 ——激活进程号
router(config-router)#network 192.168.1.0 0.0.0.255 area 0 ——申明自治区域 0
router(config-router)#network 12.12.1.0 0.0.0.255 area 1 ——申明自治区域 1
router(config-router)#network 12.12.2.0 0.0.0.255 area 1
router(config-router)#network 12.12.3.0 0.0.0.255 area 1
router(config-router)#end
router#show ip protocols
router#show ip interface brief
router#show ip ospf neighbor

七、访问控制列表

Router#con
Configuring from terminal, memory, or network [terminal]? t
让用户D不能远程登录 A Router(config)#access-list 103 deny tcp host 192.168.3.139 host 192.168.5.165eq 23
Router(config)#access-list 103 permit ip any any
Router(config)#int Serial 0
Router(config-if)#ip access-group 103 out
记用户A不能问网络,而用户 B能够访问网络 Router(config)#access-list 12 deny 192.168.5.0 0.0.0.255
Router(config)#access-list 12 permit 192.168.6.0 0.0.0.255
Router(config)#int serial 0
Router(config-if)#ip access-group 12 out

Router(config-if)#no shutdown
Router(config-if)#end
Router#show ip access-list
八、封装 PPP协议验证 User Access Verification
Password:
router>en
Password:
router
#con
Configuring from terminal, memory, or network [terminal]? t
Red-Giant(config)#hostname Router
Router(config)#enable password star
Router(config)#line vty 0 4
Router(config-line)#login
Router(config-line)#password star
Router(config-line)#end
Router#show ip in b
Router#con
Configuring from terminal, memory, or network [terminal]? t
Router(config)#int f0
Router(config-if)#ip add 192.168.2.1 255.255.255.0
Router(config-if)#no sh
Router(config-if)#exit
Router(config)#int f1
Router(config-if)#ip add 192.168.3.1 255.255.255.0
Router(config-if)#no shu
Router(config)#int s0
Router(config-if)#clock rate 64000
Router(config-if)#ip add 192.168.1.1 255.255.255.0
Router(config-if)#no shu
Router(config-if)#end
Router#con
Configuring from terminal, memory, or network [terminal]? t
Router(config)#router ospf 11
Router(config-router)#network 192.168.1.0 0.0.0.255 area 0
Router(config-router)#network 192.168.2.0 0.0.0.255 area 1
Router(config-router)#network 192.168.3.0 0.0.0.255 area 1
Router(config-router)#end
Router#show ip ospf neighbor
Router#show ip interface brief
Router#ping 192.168.1.2
Router#show ip protocols
Router#show ip inter s0
Router#ping 192.168.1.2
Router#con
Configuring from terminal, memory, or network [terminal]? t
Router(config)#int loopback 1
Router(config-if)#ip add 11.1.1.1 255.255.255.0
Router(config-if)#no sh
Router(config-if)#exit
Router(config)#in loopback 2
Router(config-if)#ip add 11.1.2.1 255.255.255.0
Router(config-if)#end
Router#show ip interface brief
Router#con
Configuring from terminal, memory, or network [terminal]? t
将Serial 0 封装PPP Router(config)#int s0
Router(config-if)#enca ppp
Router(config-if)#exit
Router(config)#hostname A
A(config)#username A password star ——此处用户名和密码由服务器端定义,用于客户端验证
A(config)#int s0
封装类型为 PAP A(config-if)#ppp authentication pap
A(config-if)#ppp pap sent-username A password star ——发送服务端提供的用户名和密码
封装类型为 CHAP A(config-if)#ppp authentication chap
A(config-if)#ppp chap hostname A
A(config-if)#ppp chap password star
A(config-if)#end
A#show inter s0
A#show run

相关推荐

软件测试/测试开发丨Pytest 自动化测试框架(五)

公众号搜索:TestingStudio霍格沃兹测试开发的干货都很硬核测试报告在项目中是至关重要的角色,一个好的测试报告:可以体现测试人员的工作量;开发人员可以从测试报告中了解缺陷的情况;测试经理可以...

python爬虫实战之Headers信息校验-Cookie

一、什么是cookie上期我们了解了User-Agent,这期我们来看下如何利用Cookie进行用户模拟登录从而进行网站数据的爬取。首先让我们来了解下什么是Cookie:Cookie指某些网站为了辨别...

软件测试 | 结合Allure生成测试报告

简介测试报告在项目至关重要,测试人员可以在测试报告中体现自己的工作量,开发人员可以从测试报告中了解缺陷的情况,测试经理可以从测试报告中看到测试人员的执行情况及测试用例的覆盖率,项目负责人可以通过测...

使用FUSE挖掘文件上传漏洞(文件上传漏洞工具)

关于FUSEFUSE是一款功能强大的渗透测试安全工具,可以帮助广大研究人员在最短的时间内迅速寻找出目标软件系统中存在的文件上传漏洞。FUSE本质上是一个渗透测试系统,主要功能就是识别无限制可执行文件上...

第42天,我终于意识到,爬虫这条路,真的好艰难

昨天说到学爬虫的最初四行代码,第四行中的print(res.text),我没太懂。为啥最后的输出的结果,不是显示百度网页全部的源代码呢?这个世界上永远不缺好心人。评论区的大神告诉我:因为只包含静态h...

详解Pytest单元测试框架,轻松搞定自动化测试实战

pytest是目前企业里面使用最多、最流行的Python的单元测试框架,那我们今天就使用这个框架来完成一个网易163邮箱登录的自动化实战案例。下面我们先把我们案例需要的工具进行相关的介绍:01pyt...

干货|Python大佬手把手带你破解哔哩哔哩网滑动验证(上篇)

/1前言/有爬虫经验的各位小伙伴都知道,正常我们需要登录才能获取信息的网站,是比较难爬的。原因就是在于,现在各大网站为了反爬,与爬虫机制斗智斗勇,一般的都加入了图片验证码、滑动验证码之类的干扰,让...

Python 爬虫-如何抓取需要登录的网页

本文是Python爬虫系列第四篇,前三篇快速入口:Python爬虫-开启数据世界的钥匙Python爬虫-HTTP协议和网页基础Python爬虫-使用requests和B...

使用Selenium实现微博爬虫:预登录、展开全文、翻页

前言想实现爬微博的自由吗?这里可以实现了!本文可以解决微博预登录、识别“展开全文”并爬取完整数据、翻页设置等问题。一、区分动态爬虫和静态爬虫1、静态网页静态网页是纯粹的HTML,没有后台数据库,不含程...

从零开始学Python——使用Selenium抓取动态网页数据

1.selenium抓取动态网页数据基础介绍1.1什么是AJAX  AJAX(AsynchronouseJavaScriptAndXML:异步JavaScript和XML)通过在后台与服务器进...

PHP自动测试框架Top 10(php单元测试工具)

对于很多PHP开发新手来说,测试自己编写的代码是一个非常棘手的问题。如果出现问题,他们将不知道下一步该怎么做。花费很长的时间调试PHP代码是一个非常不明智的选择,最好的方法就是在编写应用程序代码之前就...

10款最佳PHP自动化测试框架(php 自动化测试)

为什么测试如此重要?PHP开发新手往往不会测试自己编写的代码,我们中的大多数通过不断测试我们刚刚所编写浏览器窗口的新特性和功能来进行检测,但是当事情出现错误的时候我们往往不知道应该做些什么。为我们的代...

自动化运维:Selenium 测试(seleniumbase搭建自动化测试平台)

本文将以Buddy中的Selenium测试流水线示例,来看看自动化测试就是如此简单易用!Selenium是一套用于浏览器测试自动化的工具。使用Buddy专有服务,您可以直接在Buddy中运行Selen...

Selenium自动化测试(selenium自动化测试工具)

Selenium是一系列基于web的自动化测试工具。它提供了一系列测试函数,用于支持Web自动化测试。这些函数非常灵活,它们能够通过多种方式定位界面元素,并可以将预期结果与系统实际表现进行比较。作为一...

技术分享 | Web自动化之Selenium安装

本文节选自霍格沃兹测试开发学社内部教材Web应用程序的验收测试常常涉及一些手工任务,例如打开一个浏览器,并执行一个测试用例中所描述的操作。但是手工执行的任务容易出现人为的错误,也比较费时间。因此,将...