要通过 telnet 访问路由器,需要先通过 console 口对路由器进行基本配置,例如:IP

地址、密码等。

1.  实验目的

通过本实验,读者可以掌握如下技能:

1  配置路由器以太网接口的 IP 地址,并打开接口;

2  配置路由器的 enable 密码和 vty 密码;

3  telnet 程序的使用。

2.  实验拓扑

 

 

3.  实验步骤

(1)  步骤 1:配置路由器以太网接口 IP 地址

Router>enable

Router#

//以上是进入路由器的特权模式

Router#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router (config)#

//以上是进入路由器的配置模式

Router (config)# interface g0/0

Router (config-if)#

//以上是进入路由器的以太网口 g0/0 接口,g0/0 g 表示是 Gig abitEthernet, 0/0 表示

是第 0 个插槽中的第 0 个接口。S0/0/0 则表示为第 0 个插槽中的第 0 个模块上的第 0 个串

行接口。

Router (config-if)#ip address 192.168.1.1 255.255.255.0 

//以上是配置接口的 IP 地址

Router (config-if)#no shutdown 

//以上是打开接口,默认时路由器的所有接口都是关闭的,这一点和交换机有很大差别

Router (config-if)#end 

//退出配置模式

(2)  步骤 2:配置路由器密码

Router#conf terminal 

Router(config)#line vty 0 4

//以上是进入路由器的 VTY 虚拟终端下, vty 0 4”表示 vty 0 vty 4,共 5 个虚拟终端

Router(config-line)# password CISCO

Router(config-line)# login 

//以上是配置 vty 的密码,即 telnet 密码

Router(config-line)# exit

Router(config)#enable password CISCO 

//以上是配置进入到路由器特权模式的密码

Router(config)#end 

(3)  步骤 3:通过 telnet 访问路由器

在计算机上配置网卡的 IP 地址为 192.168.16.2/255.255.255.0,并打开 DOS 命令行窗口。

首先测试计算机和路由器的 IP 连通性,再进行 telnet 远程登录。如下:

C:\>ping 192.168.1.1

Pinging  192.168.1.1 with 32 bytes of data:

Reply from  192.168.1.1: bytes=32 time<1ms TTL=255

Reply from  192.168.1.1: bytes=32 time<1ms TTL=255

Reply from  192.168.1.1: bytes=32 time<1ms TTL=255

Reply from  192.168.1.1: bytes=32 time<1ms TTL=255

Ping statistics for  192.168.1.1:

    Packets: Sent = 4, Received = 4, Lost = 0 (0% lo

Approximate round trip times in milli-seconds:

    Minimum = 0ms, Maximum = 0ms, Average = 0ms

//以上表明计算机能 ping 通路由器

 

C:\>telnet  192.168.1.1  

//telnet 路由器以太网卡上的 IP 地址

User Access Verification

Password:

Router>enable

Password:

Router#exit

//输入 vty 的密码 CISCO、输入 enable 的密码 CISCO,能正常进入路由器的特权模式。

4.  实验调试

如果无法从计算机上 ping 通路由器,依照以下步骤进行

1  检查计算机、交换机、路由器之间的连接是否松动;

2  检查连接线应该是否是直通线;

3  检查计算机的网卡和 IP 地址是否正常;

4  在路由器上,检查以太网接口是否正常

Router#show  int g0/0     

GigabitEthernet0/0 is up, line protocol is up 

  Hardware is MV96340 Ethernet, address is 0019.5535.b828 (bia 0019.5535.b828)

  Internet address is  192.168.1.1/24

应该看到两个“up”,否则检查路由器和交换机之间的连接。