思科网络配置软件 思科企业网络配置

昭棠笔记 2022-12-15

来自CCIE俱乐部老杨的分享。思科的网络通讯设备,包括:如何构建思科网络设备的配置平台、理解思科网络设备的相关配置模式等,通过本章的学习可以具备思科网络设备配置能力,为后续的核心技术学习做好准备。

一、认识思科的网络设备

1.路由器

①思科800系列路由器:为小型机构提供宽带接入、安全保证、无线接入,以集成多业务路由器系列为基础。

②思科2900系列路由器:提供四种平台2901291129212951集成多业务路由器(路由、语音、支持VPN、支持防火墙、入侵检测等功能集成到一起),应用于小型环境。提供嵌入式硬件加密加速、支持语音和视频数字信号处理插槽、可选择性防火墙、入侵检测、呼叫处理、语音信箱以及应用程序服务等。

③思科3900系列路由器:提供39253945两种平台集成多业务路由器,一般用于中小型到中大型环境。

④思科7200系列路由器:应用于大型环境。

⑤思科12000系列路由器:应用于运营商。

路由器背板和常规接口

控制口(console):使用该接口连接控制台配置路由器。

辅助控制口(AUX):主要用于带外管理(独立于业务网络的管理网络,当业务网络瘫痪后,仍然不影响管理)与远程配置路由器,也用于拨号连接,还可通过收发器与MODEM进行连接。支持硬件控制,AUX接口与console接口常放一起来完成路由器的配置与管理工作。

设备集成的以太网接口:提供以太网连接的网络接口,在用户只购买了路由器没有购买某个功能的接口模块时,通常设备机箱会集成一个网络接口,该接口与路由器面板集成固化,不以模块化形式体现。

以太网模块:可以理解为可“插拔”的以太网接口卡。

2.交换机

思科交换机主要有2918系列交换机、2900系列交换机、3750系列交换机、4500系列交换机、6500系列交换机,他们的性能可以在诉苦官网上查询:www.cisco.com

3.思科模块及编号原则

为什么设备方案做成模块化形式而不是相关功能固化到设备载体上?因为网络需求差异大,企业需求各异,组网时要求灵活性高。灵活的组网模块使得供应商和用户的性价比都提高。

以太网(Ethernet)编号原则:下图中使用了两个以太网模块01,以太网0号模块的第一个物理接口就是E0/0,因此,编号中第一个数字表示以太网模块号,第二个数字表示物理接口编号。

二、网络设备的配置

1.网络设备的配置平台

一般情况,有两种方法来配置网络设备。

①通过本地接口(console口)来完成配置。被配置的网络设备在管理员的本地范围类,基本构架由三部分组成:执行配置的主机、被配置的网络设备和控制线。

②是通过网络进行远程配置,没有距离的限制,如Telnet

2.网络设备的配置模式

一般用户模式:通常网络设备名称后有一个尖角符号>,这种模式只能查看配置信息,不能对设备进行配置的,这是访问设备的更低权限。

特权用户模式:一般用户模式下输入enable,进入特权用户模式,这时网络设备名称后有一个#号,这个模式下可以访问网络设备,修改配置命令,重启路由器和查看配置文件运行状态等。输入disable可以退回到一般用户模式。

全局配置模式:特权配置模式下,输入configureterminal进入全局配置模式,这是网络设备名后有(config)#标记号。全局模式好比园中园,进了动物园后想看具体的珍贵动物还得买门票才能进去。

接口配置模式:全局模式下,输入interface +接口(ethernet 1/0),进入接口配置模式,这是网络设备名后有(config- if)#标记号,这里的配置只针对这个接口生效。

路由配置模式:全局模式下,输入router +路由协议,进入路由配置模式,这是网络设备名后有(config- router)#标记号,

线路配置模式:全局模式下,输入line +线路号,进入接口配置模式,这是网络设备名后有(config-line)#标记号,

三、常用的路由配置命令

1. 进入特权模式 enable

router > enable

router #

2. 进入全局配置模式 configure terminal

router > enable

router #configure terminal

router (config)#

3. 重命名 hostname routera routerA为例

router > enable

router #configure terminal

router(config)#hostname routerA

routerA (config)#

4. 配置使能口令 enable password cisco cisco为例

router > enable

router #configure terminal

router(config)#hostname routerA

routerA (config)# enable password cisco

5. 配置使能密码 enable secret ciscolab cicsolab为例

router > enable

router #configure terminal

router(config)#hostname routerA

routerA (config)# enable secret ciscolab

6. 进入路由器某一端口 interface fastethernet 0/1

router > enable

router #configure terminal

router(config)#hostname routerA

routerA (config)# interface fastethernet 0/1

routerA (config-if)#

进入路由器的某一子端口 interface fastethernet 0/1.1 1端口的1子端口为例

router > enable

router #configure terminal

router(config)#hostname routerA

routerA (config)# interface fastehernet 0/1.1

7. 设置端口ip地址信息

router > enable

router #configure terminal

router(config)#hostname routerA

routerA(config)# interface fastethernet 0/1 1端口为例

routerA (config-if)#ip address 192.168.1.1 255.255.255.0 配置交换机端口ip和子网掩码

routerA (config-if)#no shut 启动此接口

routerA (config-if)#exit

8. 查看命令 show

router > enable

router # show version 察看系统中的所有版本信息

show controllers serial + 编号查看串口类型

show ip route 查看路由器的路由表

9. cdp相关命令

router > enable

router # show cdp 查看设备的cdp全局配置信息

show cdp traffic 查看有关cdp包的统计信息

show cdp neighbors 列出与设备相连的cisco设备

10. csico2600的密码恢复

重新启动路由器,在启动过程中按下ctrl+break键,使路由器进入rom monitor模式。

在提示符下输入命令修改配置寄存器的值,然后重新启动路由器。

rommon1>confreg 0×2142

rommon2>reset

重新启动路由器后进入setup模式,选择“no”,退回到exec模式,此时路由器原有的配置仍然保存在startup-config中,为使路由器恢复密码后配置不变,则需要把startup-config中配置保存到running-config中,然后重新设置enable密码,并把配置寄存器的值改回0×2102

router>enable

router#copy startup-config running-config

router#configure terminal

router(config)#enable password cisco

router(config)#config-register 0×2102

保存当前配置到startup-config , 重新启动路由器。

router #copy running-config startup-config

router #reload

11. 路由器telnet远程登录设置

router>en

router #configure terminal

router (config)#hostname routerA

routerA (config)#enable password cisco cisco为特权模式密码

routerA (config)#interface fastethernet 0/1

routerA (config-if)#ip address 192.168.1.1 255.255.255.0

routerA (config-if)#no shut

routerA (config-if)#exit

routerA (config)line vty 0 4 设置0-4 个用户可以telnet远程登陆

routerA (config-line)#password 123

routerA (config-line)#login

12. 配置路由器的标识 banner $……………$

在全局配置的模式下利用banner”命令可以配置路由器的提示信息,所有连接到路由器的终端都会收到。

router>en

router #configure terminal

router (config)#hostname routerA

routerA(config)#banner motd $This is aptech companyrouter ! Please dont change the configuration without permission!$

13. 配置接口标识 description ………

接口标识用于区分路由器的各个接口。用show run命令可以查看到这些标识。

router>en

router #configure terminal

router (config)#hostname routerA

routerA(config)#interface fastethernet 0/1 0/1 接口为例

routerA(config-if)# description this is a fast Ethernet port used to connecting the companys intranet!

14. 配置超时

超时用于设置在多长时间没有对console进行配置,自动返回exec会话时间。默认为10分钟。

router>en

router #configure terminal

router (config)#hostname routerA

routerA(config)#line console 0

routerA(config-line)#exec-timeout 0 0 第一个“0”代表分钟,第二个“0”代表秒

15. 配置串口参数

两台路由器通过串口连接需要一个做为DTE,一个做为DCEDCE设备要向DTE设备提供时钟频率和带宽。

DCE配置:

router>en

router #configure terminal

router (config)#hostname routerA

routerA(config)#interface serial 0/0

routerA(config-if)#clock rate 64000 提供时钟频率为64000

routerA(config-if)#bandwidth 64 提供带宽为64

routerA(config-if)#no shut

DTE配置:

router>en

router #configure terminal

router (config)#hostname routerB

routerB(config)#interface serial 0/0

routerB(config-if)#no shut

16. 静态路由的配置

配置路由器R1的名称和接口参数

router>enable

router#configure terminal

router(config)#hostname routerA

routerA(config)#interface fastethernet 0/0

routerA(config-if)#ip address 192.168.2.1 255.255.255.0

routerA(config-if)#no shutdown

routerA(config-if)#exit

routerA(config)# interface fastethernet 0/1

routerA(config-if)#ip address 192.168.3.1 255.255.255.0

routerA(config-if)#no shutdown

主机Aip地址为 192.168.3.2

255.255.255.0

192.168.3.1

配置路由器R2的名称和接口参数

router>enable

router#configure terminal

router(config)#hostname routerB

routerB(config)#interface fastethernet 0/0

routerB(config-if)#ip address 192.168.2.2 255.255.255.0

routerB(config-if)#no shutdown

routerB (config-if)#exit

routerB(config)# interface fastethernet 0/1

routerB(config-if)#ip address 192.168.1.1 255.255.255.0

主机Bip地址为 192.168.1.2

255.255.255.0

192.168.1.1

配置路由器R1的静态路由表

routerA(config)#ip router 192.168.1.0 255.255.255.0 192.168.2.2

配置路由器R2的静态路由表

routerA(config)#ip router 192.168.3.0 255.255.255.0 192.168.2.1

R1R2上配置默认路由

routerA(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.2

routerA(config)#ip classless

routerB(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.1

routerB(config)#ip classless(支持可变长子网掩码、无类域间路由)

routerArouterB上配置动态路由(RIP)

routerA(config)#router rip

routerA(config)#network 192.168.2.0

routerA(config)#network 192.168.3.0

routerB(config)# router rip

routerB(config)#network 192.168.2.0

routerB(config)#network 192.168.1.0

17. 配置单臂路由

router(config)# interface f0/0.1

router(config-subif)# ip address 192.168.1.1 255.255.255.0

router(config-subif)# encapsulation dot1q 1

router(config-subif)# exit

router(config)# interace f0/0.2

router(config-subif)# ip address 192.168.2.1 255.255.255.0

router(config-subif)# encapsulation dot1q 2

router(config-subif)# exit

router(config)# interface f0/0.3

router(config-subif)# ip address 192.168.3.1 255.255.255.0

router(config-subif)# encapsulation dot1q 3

router(config-subif)# exit

router(config)# interface f0/0

router(config-if)# no shut