admin管理员组

文章数量:1545141

CISCO路由器的基本配置

      • 实验要求
      • 开始实验
        • 1.初始化配置:
        • 2.搭建网络:
        • 3.测试网络:
        • 4.配置密码:
        • 5.查看信息:

实验要求

  1. 初始化相关配置;
  2. 设置接口IP地址; ( F0/0 S1/0 )
  3. 测试; ( ping 、 telnet )
  4. 设置密码; ( console口、VTY接口和特权 )
  5. 查看相关信息。 ( show 命令 )

开始实验

1.初始化配置:

1.1使用PC进入配置面板:拉出一个2811路由器,以及一台PC设备,用配置线链接路由器的Console接口和PC的RS 232接口。


点击PC——选择Desktop选项卡——选择Terminal窗口——点击“确定”。

即可进入配置界面。

1.2使用路由器进入控制面板(现实操作无此方法):拉出一个2811路由器。

选择路由器——选择CLI选项卡即可进入配置界面。

Router>
箭头即为用户模式,权限最小,在用户模式下输入en并回车,进入特权模式

Router#
井号即为特权模式,可以进行所有的查看、信息的清楚、重启等。在特权模式下输入config进入配置模式

Router(config)#
此为配置模式,可以进行相关参数的配置

用户之间的切换如下所示:


Router>en
Router#config
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#exit
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#exit
Router con0 is now available
Press RETURN to get started.
Router>

接下来进行初始化配置,在配置模式下输入host *即为对路由器命名。

Router(config)#host R1
R1(config)#

输入no ip domain-lookup关闭域名解析。

(如果忘记关闭,可在进行解析时按下Ctrl+Shift+6终止解析)

R1(config)#no ip domain-lookup

输入line con 0进入Console线路口。

R1(config)#line con 0
R1(config-line)#

输入logging synchronous实现日志自动同步(自动换行)。

R1(config-line)#logging synchronous

输入exec-time 0 0实现会话永不超时(默认10分钟)。

R1(config-line)#exec-time 0 0
2.搭建网络:

拉出两个2811路由器,一个2950交换机,4台PC,如下图摆放。


为两台路由器添加广域网接口,点击路由器——点击标红处断电(不断电无法添加模块)。

将A区域用直通线连接起来,B区域用交叉线连接起来(相同设备用交叉线,不用设备用直通线,路由器与PC均有网卡,所以此处视为相同设备),两个路由器用DCE串口线连接起来(先连接的一段为DCE端)。

接下来进入R1服务器配置端口,在配置模式下输入int f0/0进入对应端口。

R1(config)#int f0/0
R1(config-if)#

输入ip add 192.168.1.251 255.255.255.0为该端口配置IP及子网掩码。

R1(config-if)#ip add 192.168.1.251 255.255.255.0

输入no shutdown启用该端口。

R1(config-if)#no shutdown

R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

接下来输入int s1/0进入广域网端口。

R1(config-if)#int s1/0

输入ip add 192.168.2.1 255.255.255.0为该端口配置IP及子网掩码。

R1(config-if)#ip add 192.168.2.1 255.255.255.0

输入clock rate 64000为DCE配置同步时钟(仅DCE端需要进行此配置)

R1(config-if)#clock rate 64000

输入no shutdown启用该端口。

R1(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial1/0, changed state to down

R2服务器配置端口与R1相同,不再分开累述。

R2(config-if)#ip add 192.168.3.1 255.255.255.0
R2(config-if)#no shut

R2(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

R2(config-if)#int s1/0
R2(config-if)#ip add 192.168.2.2 255.255.255.0
R2(config-if)#no shut

R2(config-if)#
%LINK-5-CHANGED: Interface Serial1/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up

为PC配置IP,点开PC1——选择Desktop选项卡——选择IP Configuration——输入内容如下。

PC2输入内容如下。


PC3输入内容如下。


PC4输入内容如下。

3.测试网络:

使用PC2ping路由器R1的f0/0端口。

使用PC2telnet连接路由器R1的f0/0端口。

4.配置密码:

为路由器R1的console接口配置密码(进入用户模式时需要输入的密码)。

R1(config)#line con 0

R1(config-line)#password 123456

R1(config-line)#login

为路由器R1的VTY接口配置密码(telnet连接路由器时需要输入的密码)。

先输入line vty ? 显示0-15共16个接口可配置。

R1(config)#line vty ?
  <0-15>  First Line number

为0-4这5个接口设置密码(开启接口)。

R1(config)#line vty 0 4

R1(config-line)#password 654321

R1(config-line)#login

为路由器R1配置特权密码(从用户模式进入特权模式时需要输入的密码)。

设置特权明文密码:

R1(config)#enable password aaa

设置特权密文密码(明文密码与密文密码同时存在时,明文密码失效):

R1(config)#enable secret bbb

加密前查询配置显示结果:

对明文密码进行加密:

R1(config)#service password-encryption 

加密后查询配置显示结果:

此时,使用PC2telnet连接路由器:

输入VTY接口密码:654321,进入到用户模式。

输入特权密文密码:bbb(因为明文密码与密文密码同时启用,明文密码失效),进入到特权模式。

在配置服务器时,会话超时时,会要求输入console接口密码:123456,即可进入用户模式。

R1 con0 is now available

Press RETURN to get started.

User Access Verification

Password: 
5.查看信息:
  1. 查看当前内存中的配置
R1#show running-config 


Building configuration...

Current configuration : 978 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
service password-encryption
!
hostname R1
!
enable secret 5 $1$mERr$MBmafWD9.kwwwgArTAUad0
enable password 7 08204D4F
!
no ip cef
no ipv6 cef
!
spanning-tree mode pvst
!
interface FastEthernet0/0
 ip address 192.168.1.251 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Serial1/0
 ip address 192.168.2.1 255.255.255.0
 clock rate 64000
!
interface Serial1/1
 no ip address
 clock rate 2000000
 shutdown
!
interface Serial1/2
 no ip address
 clock rate 2000000
 shutdown
!
interface Serial1/3
 no ip address
 clock rate 2000000
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
ip classless
!
ip flow-export version 9
!
line con 0
 password 7 08701E1D5D4C53
 login
!
line aux 0
!
line vty 0 4
 password 7 0877191A5A4B54
 login
!
end
  1. 查看初始配置
R1#show startup-config 


Using 844 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname r1
!
no ip cef
no ipv6 cef
!
spanning-tree mode pvst
!
interface FastEthernet0/0
 ip address 192.168.1.251 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Serial1/0
 ip address 192.168.2.1 255.255.255.0
 clock rate 64000
!
interface Serial1/1
 no ip address
 clock rate 2000000
 shutdown
!
interface Serial1/2
 no ip address
 clock rate 2000000
 shutdown
!
interface Serial1/3
 no ip address
 clock rate 2000000
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
ip classless
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
end
  1. 查看版本号(包含启动顺序)
R1#show version 


Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Wed 18-Jul-07 06:21 by pt_rel_team

ROM: System Bootstrap, Version 12.1(3r)T2, RELEASE SOFTWARE (fc1)
Copyright (c) 2000 by cisco Systems, Inc.

System returned to ROM by power-on
System image file is "c2800nm-advipservicesk9-mz.124-15.T1.bin"

This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

cisco 2811 (MPC860) processor (revision 0x200) with 60416K/5120K bytes of memory
Processor board ID JAD05190MTZ (4292891495)
M860 processor: part number 0, mask 49
2 FastEthernet/IEEE 802.3 interface(s)
4 Low-speed serial(sync/async) network interface(s)
239K bytes of NVRAM.
62720K bytes of processor board System flash (Read/Write)

Configuration register is 0x2102
  1. 查看闪存大小及IOS文件名
R1#show flash: 


System flash directory:
File  Length   Name/status
  3   50938004 c2800nm-advipservicesk9-mz.124-15.T1.bin
  2   28282    sigdef-category.xml
  1   227537   sigdef-default.xml
[51193823 bytes used, 12822561 available, 64016384 total]
63488K bytes of processor board System flash (Read/Write)
  1. 查看接口的简略信息
R1#show ip interface brief 


Interface              IP-Address      OK? Method Status                Protocol
 
FastEthernet0/0        192.168.1.251   YES manual up                    up
 
FastEthernet0/1        unassigned      YES unset  administratively down down
 
Serial1/0              192.168.2.1     YES manual up                    up
 
Serial1/1              unassigned      YES unset  administratively down down
 
Serial1/2              unassigned      YES unset  administratively down down
 
Serial1/3              unassigned      YES unset  administratively down down
 
Vlan1                  unassigned      YES unset  administratively down down
  1. 查看某接口的详细信息
R1#show interfaces s1/0


Serial1/0 is up, line protocol is up (connected)
  Hardware is HD64570
  Internet address is 192.168.2.1/24
  MTU 1500 bytes, BW 128 Kbit, DLY 20000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation HDLC, loopback not set, keepalive set (10 sec)
  Last input never, output never, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0 (size/max/drops); Total output drops: 0
  Queueing strategy: weighted fair
  Output queue: 0/1000/64/0 (size/max total/threshold/drops)
     Conversations  0/0/256 (active/max active/max total)
     Reserved Conversations 0/0 (allocated/max allocated)
     Available Bandwidth 96 kilobits/sec
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     4 packets input, 196 bytes, 0 no buffer
     Received 4 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 packets output, 0 bytes, 0 underruns
     0 output errors, 0 collisions, 1 interface resets
     0 output buffer failures, 0 output buffers swapped out
     0 carrier transitions
     DCD=up  DSR=up  DTR=up  RTS=up  CTS=up

本文标签: 路由路由器基本配置Cisco