三、telnet遠(yuǎn)程連接服務(wù)
注意:需要在目標(biāo)主機(jī)上配置特權(quán)密碼和開啟遠(yuǎn)程登錄服務(wù)。
實(shí)例1:R1遠(yuǎn)程登錄到R2/R3
(1)配置
R2(config)#enable password 123456 //配置進(jìn)入特權(quán)模式的密碼
R2(config)#line vty 0 4 //配置遠(yuǎn)程登錄的數(shù)量
R2(config-line)#logging synchronous //設(shè)置信息同步
R2(config-line)#exec-timeout 5 //設(shè)置退出時間
R2(config-line)#password 123456 //設(shè)置密碼
R2(config-line)#login //啟動遠(yuǎn)程登錄服務(wù)
或
R3(config)#enable password 123456 //配置進(jìn)入特權(quán)模式的密碼
R3(config)#line vty 0 4 //配置遠(yuǎn)程登錄的數(shù)量
R3(config-line)#logging synchronous //設(shè)置信息同步
R3(config-line)#exec-timeout 5 //設(shè)置退出時間
R3(config-line)#password 123456 //設(shè)置密碼
R3(config-line)#login //啟動遠(yuǎn)程登錄服務(wù)
(2)測試
R1#telnet 12.1.1.2
Trying 12.1.1.2 ...Open
[Connection to 12.1.1.2 closed by foreign host]
R1#telnet 12.1.1.2
Trying 12.1.1.2 ...Open
User Access Verification
Password: //輸入R2的遠(yuǎn)程登錄密碼
R2>en
Password: //輸入R2的特權(quán)密碼
R2#
說明:從R1遠(yuǎn)程連接到R2或R3,必須訪問R2的g0/0或者R3的G0/0地址,不能訪問其他地址。原因是在該網(wǎng)絡(luò)中未配置路由信息,只能訪問與R1直連的IP地址。
實(shí)例2:R1遠(yuǎn)程登錄到R4
注意:由于R4與R1是非直連的網(wǎng)絡(luò)設(shè)備,必須要配置從R1到達(dá)R4的路由,才能實(shí)現(xiàn)遠(yuǎn)程登錄。即R1必須能夠PING同R4.
R1#telnet 34.1.1.4
Trying 34.1.1.4 ...
% Connection timed out; remote host not responding
R1#//提示連接超時。
(1)R1的路由配置
R1(config)#router rip
R1(config-router)#ver 2
R1(config-router)#no auto-summary
R1(config-router)#networ 12.0.0.0
R1(config-router)#net 13.0.0.0
(2)R2的路由配置
R2(config)#router rip
R2(config-router)#ver 2
R2(config-router)#no auto-summary
R2(config-router)#network 12.0.0.0
R2(config-router)#network 23.0.0.0
(3)R3的路由配置
R3(config)#router rip
R3(config-router)#ver 2
R3(config-router)#no auto-summary
R3(config-router)#network 13.0.0.0
R3(config-router)#network 23.0.0.0
R3(config-router)#network 34.0.0.0
(4)R4的路由配置
R4(config)#router rip
R4(config-router)#ver 2
R4(config-router)#no auto-summary
R4(config-router)#network 34.0.0.0
(5)檢驗(yàn)路由配置
R1#show ip route rip
R 34.0.0.0/8 [120/2] via 12.1.1.2, 00:00:13, g0/0
R 23.0.0.0/8 [120/1] via 13.1.1.3, 00:00:13,g0/0
(6)遠(yuǎn)程登錄
R1#telnet 34.1.1.4
Trying34.1.1.4 ...Open
User Access Verification
Password: //輸入R4的遠(yuǎn)程登錄密碼
R4>en
Password: //輸入R4的特權(quán)密碼
R4#
四、域名服務(wù)器的配置
(1)配置設(shè)備的主機(jī)名和IP地址的對應(yīng)關(guān)系
R1(config)#ip host R1 12.1.1.1 //ip host 是關(guān)鍵詞,R1的設(shè)備名,12.1.1.1設(shè)備對于的IP地址。一般情況下,用該地址對R1進(jìn)行遠(yuǎn)程管理。
R1(config)#ip host R2 12.1.1.2
R1(config)#ip host R3 13.1.1.3
R1(config)#ip host R4 34.1.1.4
R2(config)#ip host R1 12.1.1.1 //ip host 是關(guān)鍵詞,R1的設(shè)備名,12.1.1.1設(shè)備對于的IP地址。一般情況下,用該地址對R1進(jìn)行遠(yuǎn)程管理。
R2(config)#ip host R2 12.1.1.2
R2(config)#ip host R3 13.1.1.3
R2(config)#ip host R4 34.1.1.4
R3(config)#ip host R1 12.1.1.1 //ip host 是關(guān)鍵詞,R1的設(shè)備名,12.1.1.1設(shè)備對于的IP地址。一般情況下,用該地址對R1進(jìn)行遠(yuǎn)程管理。
R3(config)#ip host R2 12.1.1.2
R3(config)#ip host R3 13.1.1.3
R3(config)#ip host R4 34.1.1.4
R4(config)#ip host R1 12.1.1.1 //ip host 是關(guān)鍵詞,R1的設(shè)備名,12.1.1.1設(shè)備對于的IP地址。一般情況下,用該地址對R1進(jìn)行遠(yuǎn)程管理。
R4(config)#ip host R2 12.1.1.2
R4(config)#ip host R3 13.1.1.3
R4(config)#ip host R4 34.1.1.4
R2到R4上做相同的操作;
(2)配置網(wǎng)絡(luò)的路由,配置同上題一樣【若已配置,無需在配置】
(3)配置域名服務(wù)器IP
R1(config)#ip domain-lookup
R1(config)#ip domain-name xmht.com //配置域名為xmht.com
R1(config)#ip name 12.1.1.1 //指定域名的主機(jī)
注意R2到R4的配置如下:
R4(config)#ip domain-lookup
R4(config)#ip domain-name xmht.com
(4)驗(yàn)證
R1#show hosts
Default domain is xmht.com
Name/address lookup uses domain service
Name servers are 12.1.1.1
Host Port Flags Age Type Address(es)
R4 None (perm, OK) 0 IP 34.1.1.4
R3 None (perm, OK) 0 IP 13.1.1.3
R2 None (perm, OK) 0 IP 12.1.1.2
R1 None (perm, OK) 0 IP 12.1.1.1
R1#ping R2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/7/8 ms
R1#telnet R2
Trying R2 (12.1.1.2)... Open
User Access Verification
Password:
R2>EN
Password:
R2#exit
[Connection to R2 closed by foreign host]
R1#