實驗 在路由器上配置 Telnet
【實驗名稱】
在路由器上配置 Telnet。
【實驗目的】
掌握如何在路由器上配置 Telnet,以實現路由器的遠程登錄訪問。
【背景描述】
路由器用於連接多個子網時,通常放置位置都相距較遠,察看和修改配置都比較麻煩,
此時如果可以遠程登錄到路由器上進行操作,將能夠大大降低管理員的工作量。
【需求分析】
需要掌握如何配置路由器的密碼, 如何配置 Telnet 服務, 以及如何通過 Telnet 遠程登錄
路由器進行操作的方法。
【實驗拓撲】
圖 6-2 實驗拓撲圖
【實驗設備】
路由器(帶串口) 2 臺
V.35 DCE/DTE 線纜 1 對
【預備知識】
路由器的工作原理和基本配置方法
【實驗原理】
將兩臺路由器通過串口,以 V.35 DTE/DCE 電纜連接在一起,分別配置 Telnet,可以互
相以 Telnet 方式登錄對方。
路由器提供廣域網接口(serial 高速同步串口) ,使用 V.35 線纜連接廣域網接口鏈路。
在廣域網連接時一端爲 DCE(數據通信設備) ,一端爲 DTE(數據終端設備) 。要求必須在
DCE 端配置時鐘頻率(clock rate)才能保證鏈路的連通。
【實驗步驟】
第一步:配置路由器的名稱、接口 IP 地址和時鐘
R3740#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3740(config)#hostname RouterA
!配置路由器的名稱
RouterA(config)#interface serial 4/0
!進入串口的接口配置模式
RouterA(config-if)#clock rate 512000
!設置 DCE 端的時鐘頻率
RouterA(config-if)#ip address 192.168.1.1 255.255.255.0
!配置接口 IP 地址
RouterA(config-if)#no shutdown
!啓用端口
RouterA(config-if)#exit
R3740#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3740(config)#hostname RouterB
RouterB(config)#interface serial 4/0
RouterB(config-if)#ip address 192.168.1.2 255.255.255.0
RouterB(config-if)#no shutdown
RouterB(config-if)#exit
第二步:配置 Telnet
RouterA(config)#enable password ruijie
!配置路由器的特權模式密碼
RouterA(config)#line vty 0 4
!進入線程配置模式
RouterA(config-line)#password star
!配置 Telnet 密碼
RouterA(config-line)#login
!設置 Telnet 登錄時進行身份驗證
RouterA(config-line)#end
RouterB(config)#enable password ruijie
RouterB(config)#line vty 0 4
RouterB(config-line)#password star
RouterB(config-line)#login
RouterB(config-line)#end
第三步:測試網絡連通性,以 Telnet 方式登錄路由器
RouterB#ping 192.168.1.1
Sending 5, 100-byte ICMP Echoes to 192.168.1.1, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/10 ms
RouterB#telnet 192.168.1.1
Trying 192.168.1.1, 23...
User Access Verification
Password:
!提示輸入 Telnet 密碼,此處輸入 ruijie
RouterA>en
Password:
!提示輸入特權模式密碼,此處輸入 star
RouterA#en
!遠程登錄路由器 A,可進行配置
RouterA#
RouterA#conf t
Enter configuration commands, one per line. End with CNTL/Z.
RouterA(config)#exit
RouterA#
RouterA#
RouterA#exit
!使用 exit 命令退出 Telnet 登錄
RouterB#
RouterA#ping 192.168.1.2
Sending 5, 100-byte ICMP Echoes to 192.168.1.2, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/10 ms
RouterA#telnet 192.168.1.2
Trying 192.168.1.2, 23...
User Access Verification
Password:
RouterB>en
Password:
RouterB#
RouterB#conf t
Enter configuration commands, one per line. End with CNTL/Z.
RouterB(config)#exit
RouterB#
RouterB#exit
RouterA#
【注意事項】
1、如果兩臺路由器通過串口直接互連,則必須在其中一端設置時鐘頻率(DCE) 。
2、如果沒有配置 Telnet 密碼,則登錄時會提示“Password required, but none set” 。
3、 如果沒有配置 enable 密碼,則遠程登錄到路由器上後不能進入特權模式,提示
“Password required, but none set” 。
【參考配置】
RouterA#show running-config
Building configuration...
Current configuration : 582 bytes
!
version RGNOS 10.1.00(4), Release(18443)(Tue Jul 17 21:16:17 CST 2007 -ubu1server)
hostname RouterA
!
!
enable password 7 035122110c3706
!
interface serial 4/0
ip address 192.168.1.1 255.255.255.0
clock rate 512000
!
interface serial 4/1
clock rate 64000
!
interface GigabitEthernet 0/0
duplex auto
speed auto
!
interface GigabitEthernet 0/1
duplex auto
speed auto
!
!
line con 0
line aux 0
line vty 0 4
login
password 7 0133574225
!
end
RouterB#show running-config
Building configuration...
Current configuration : 562 bytes
!
version RGNOS 10.1.00(4), Release(18443)(Tue Jul 17 21:16:17 CST 2007 -ubu1server)
hostname RouterB
!
!
enable password 7 0251563e120f3b
!
interface serial 4/0
ip address 192.168.1.2 255.255.255.0
!
interface serial 4/1
clock rate 64000
!
interface GigabitEthernet 0/0
duplex auto
speed auto
!
interface GigabitEthernet 0/1
duplex auto
speed auto
!
line con 0
line aux 0
line vty 0 4
login
password 7 0059344251
!
end