概要
ルーターにコンソールパスワード、イネーブルパスワード、またpcAから遠隔操作(telnet)をかけられるようVTYパスワードを設定し、それぞれ設定がされたことを確認する。
設定操作ログ
Router>en
Router#
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#
Router(config)#
Router(config)#line console 0
Router(config-line)#
Router(config-line)#password aaaa
Router(config-line)#
Router(config-line)#login
Router(config-line)#
Router(config-line)#exi
Router(config)#
Router(config)#
Router(config)#line vty 0 4
Router(config-line)#
Router(config-line)#password bbbb
Router(config-line)#
Router(config-line)#login
Router(config-line)#
Router(config-line)#exi
Router(config)#
Router(config)#
Router(config)#enable password cccc
Router(config)#
Router(config)#enable secret dddd
Router(config)#
Router(config)#exi
Router#
*Nov 12 18:29:04.863: %SYS-5-CONFIG_I: Configured from console by console
Router#
Router#
Router#sh run
Building configuration...
Current configuration : 1329 bytes
!
! Last configuration change at 18:29:04 UTC Tue Nov 12 2019
version 15.1
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Router
!
boot-start-marker
boot-end-marker
!
!
enable secret 5 $1$lke7$DYTK3gwAjs/9miz0p3lOM0
enable password cccc
!
no aaa new-model
!
crypto pki token default removal timeout 0
!
!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
control-plane
!
!
!
line con 0
password aaaa
login
line aux 0
line vty 0 4
password bbbb
login
transport input all
--More-- !
end
Router#
Router#
Router#show running-config | include enable
Current configuration : 1329 bytes
no service password-encryption
boot-end-marker
enable secret 5 $1$lke7$DYTK3gwAjs/9miz0p3lOM0
enable password cccc
crypto pki token default removal timeout 0
multilink bundle-name authenticated
license udi pid CISCO1812-J/K9 sn FHK111413WD
encapsulation hdlc
end
Router#
Router#
Router#exi
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Press RETURN to get started.
User Access Verification
Password:
Router>
Router>en
Password:
Router#
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#
Router(config)#
Router(config)#no enable password
Router(config)#
Router(config)#
Router(config)#exi
Router#
*Nov 12 18:40:24.695: %SYS-5-CONFIG_I: Configured from console by console
Router#
Router#
Router#show running-config | include enable
Current configuration : 1308 bytes
no service password-encryption
boot-end-marker
enable secret 5 $1$lke7$DYTK3gwAjs/9miz0p3lOM0
crypto pki token default removal timeout 0
multilink bundle-name authenticated
license udi pid CISCO1812-J/K9 sn FHK111413WD
encapsulation hdlc
end
Router#
Router#
Router#exi
コンソールパスワードの設定
Router(config)#line console 0
Router(config-line)#
Router(config-line)#password aaaa
Router(config-line)#
Router(config-line)#login
----------------------------------------------------
line con 0
password aaaa
login
line console 0コマンドでコンソールポートの設定モードに移行し、
passwordコマンドでパスワードaaaaを設定、
loginコマンドで認証機能の有効化を行います。
running-configを確認するとコンソールポートにパスワードにaaaaが設定され、
認証機能が有効化されていることが確認できます。
イネーブルパスワードの設定
Router(config)#enable password cccc
Router(config)#
Router(config)#enable secret dddd
Router(config)#
Router(config)#exi
Router#
*Nov 12 18:29:04.863: %SYS-5-CONFIG_I: Configured from console by console
-------------------------------------------------------------------------------------
enable secret 5 $1$lke7$DYTK3gwAjs/9miz0p3lOM0
enable password cccc
enable passwordコマンドでパスワードccccを設定、
enable secretコマンドでシークレットパスワードddddを設定します。
running-configを確認するとパスワードはccccがされ、
シークレットパスワードは暗号化されて表示されていることが確認できます。
補足:イネーブルパスワードはイネーブルパスワードとイネーブルシークレットパスワードの両方を設定した場合、
シークレットパスワードが認証機能として優先されます。
また、暗号化されないイネーブルパスワードはrunning-config確認中に画面を背後から覗かれるなど、パスワードの流出の危険があるため、通常はシークレットパスワードのみを使用します。
パスワードの検証
Password:
Router>
Router>en
Password:
Router#
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#
Router(config)#
Router(config)#no enable password
Router(config)#
Router(config)#
Router(config)#exi
Router#
*Nov 12 18:40:24.695: %SYS-5-CONFIG_I: Configured from console by console
Router#
Router#
Router#show running-config | include enable
Current configuration : 1308 bytes
no service password-encryption
boot-end-marker
enable secret 5 $1$lke7$DYTK3gwAjs/9miz0p3lOM0
crypto pki token default removal timeout 0
multilink bundle-name authenticated
license udi pid CISCO1812-J/K9 sn FHK111413WD
encapsulation hdlc
end
コンソールポートからログインし直すとパスワードの入力を要求されます。
ここでコンソールパスワードを入力するとユーザーモードに入ることができます。
続けてenableコマンドを入力するとここでもパスワードの入力が要求されます。
ここでパスワードを入力しようとすると、通常のパスワードではなくシークレットパスワードが優先されていることがわかります。
パスワードの削除はno enable passwordコマンドの通り頭にnoをつけたコマンドで削除することができます。
Router#show running-config | include enableコマンドで確認するとパスワードccccは削除されたことが確認できます。
telnetの設定
Router(config)#line vty 0 4
Router(config-line)#
Router(config-line)#password bbbb
Router(config-line)#
Router(config-line)#login
------------------------------------------------
line vty 0 4
password bbbb
login
line vty 0 4コマンドでVTY(仮装端末)ポートの設定モードに移行します。
0 4の部分でポート0番から4番までが指定され、まとめて設定ができます。
passwordコマンドでパスワードbbbbを設定、
loginコマンドで認証機能の有効化を行います。
running-configを確認するとVTYポート0番から4番にパスワードbbbbが設定され、
認証機能が有効化されていることが確認できます。
補足:前回のrunning-configでも確認できるとおり、VTYポートの0番から4番はデフォルトで認証機能が有効化されています。
したがって、telnetサーバーとなるルーターおよびスイッチには事前にパスワードを設定しておく必要があります。
また遠隔操作では特権(enable)モードへの移行時にパスワードが要求されます。
したがって、事前にイネーブルパスワード、イネーブルシークレットパスワード、もしくはコンソールパスワードのいずれかを設定しておく必要があります(コンソールパスワードのみしか設定されていない場合、遠隔操作での特権モード移行時に要求されるパスワードがコンソールパスワードのものになります)。
参考
ICND1:第13章