CCNA対策 5回目 [ルータのパスワード設定とバックアップ]
・パスワードの設定
①特権モードのパスワード
暗号化なし:enable password *****
暗号化あり:enable secret *****
両コードでパスワード設定した場合、暗号化ありのパスワードが優先
されます。
②コンソールパスワード
ルータとロールオーバーケーブルで接続する際に使用するPW
ex)
Router(config)# line console 0
Router(config-line)# login
Router(config-line)# password *****
③Telnetパスワード
ルータにLANを介してTelnet接続する際に使用するPW
PW以外にIPアドレスの設定も必要になります。
ex)
Router(config)# line vty 0 4
Router(config-line)# login
Router(config-line)# password *****
※vtyとは、Virtual TeletYpe の略で「仮想ポート」を意味します。
ルータとの接続にはロールオーバーケーブルが必要で、接続する端末同士
が近くにないと接続できませんでした。しかし、LANで接続している場合
にこの接続を利用する、とした技術がTelnetやSSHです。
そして仮想的に接続しているので仮想ポートといいます。
基本的にポート数は0~4の5つなので、例では5つすべてに設定しました。
④SSHパスワード
設定の流れ
ホスト名設定[hostnameコマンド]
DNSドメイン名設定 [ip domain-nameコマンド]
認証用ユーザアカウント設定[usernameコマンド]
…[password]か[secret]を続けて入力し、暗号化の有無を設定します。
公開鍵暗号化のためのペアキー作成[crypto key generate rsaコマンド]
…RSA公開鍵暗号のペアキーを作成します。この時キー長さを設定します。
初期値が512ですが、SSHのバージョン2を選択する場合は768以上が必要
になります。セキュリティ上1024以上が好ましいとされています。
公開鍵は[show crypto key mypubkey rsa]で確認できます。
SSHバージョン指定[ip ssh versionコマンド]
…1と2があり、2は1に比べてセキュリティが高いバージョンになります。
ローカル認証有効化とSSHの選択
…vty回線に対して[login localコマンド]でローカル認証(ルータ内部で
行う認証)を有効化し、[transport inputコマンド]で[ssh]を
続けて入力することでSSHを選択します。[telnet]や、もしくは両方
[telnet ssh]を入力することでほかのプロトコルを選択できます。
ex)
Router(config)# hostname *ホスト名*
Router(config)# ip domain-name *ドメイン名*
Router(config)# username *ユーザ名* password(もしくはsecret) *PW*
Router(config)# crypto key generate rsa
The name for the keys will be : *ドメイン名*
Choose the size of the key modulus in the range of 360 to 2048 for your
General Purpose keys.Choosing a key modulus greater then 512 may take
a few minutes.
How many bits in the modulus [ 512 ] : 1024
%Generating 1024 bits RSA keys ... [ OK ]
Router(config)# ip ssh version 2
Router(config)# line vty *接続している回線の番号*
Router(config-line)# login local
Router(config-line)# transport input ssh
⑤補助パスワード
現在はほとんど使用されていませんが、モデムを使用して接続する際に使用
します。auxポート[AUxiliary Port]を使用しますが、誤用すると故障して
しまいますので注意が必要になります。
Router(config)# line aux 0
Router(config-line)# login
Router(config-line)# password *PW*
・パスワードの暗号化
ヴィジュネル暗号化の方法を使用します。1500年ごろからある暗号のため、脆弱性がすでに発見されています。
service password-encryption コマンドを使用することで、一括で暗号化されます。
・パスワードの復旧手順
①ROMモニタモードにアクセスします。
②コンフィグレーションレジスタ値を変更します。[confregコマンド]を使用します。
③再起動します。[resetコマンド]を使用します。
④無設定状態から特権モードに遷移して、startup-configをコピーします。
⑤グローバルコンフィギュレーションモードに遷移してから新しいパスワードを設定します。
⑥コンフィグレーションレジスタ値を元に戻します。
⑦再起動します。[reloadコマンド]を使用します。
ex)
System Boostrap, Version XX.X,RELEASE SOFTWARE
TAC Spport: http://www.cisco.com/tac
Copyright (c) 1999 by cisco Systems, Inc
program load complete, entry point: 0x00000000, size:0x000000
Self decompressing the image : ##########
<ここで Alt + b 、ハイパーターミナルでは Ctrl + Break でブートを中止します>
rommon 1 > confreg 0x2142
You must reset or power cycle for new config to take effect
rommon 2 > reset
--------------------------------------------------------------------
Router> enable
Router# copy startup-config running-config
Destination filename [running-config]?
888 bytes copied in 0.567 secs
Router# configure terminal
Router(config)# enable secret *NewPW*
Router(config)# config-register 0x2102
Router(config)# exit
Router# reload
・バックアップについて
<IOSイメージファイルの確認>
[show flash コマンド]を使用して、binファイルを確認します。このコマンドで、空き容量も確認できます。
空き容量のみを確認したい場合は[show flash | include bytes]で絞り込めます
ex)
Router# show flash
-#- --length--- -----date/time----- path
1 2147483649 jun 1 2000 00:01:01 c9xx-adventerprisek9-mz.xxx.xx.bin
2 2049 jun 1 2000 00:01:51 sdmconfig-9xx-xxx.cfg
3
~省略~
10 2097153 jun 00:10:01 xxx.tar
67108865 bytes available (3154116607 bytes used)
<バックアップ>
このファイルをバックアップ先のサーバへ転送します。
[copy flash *サーバプロトコル名*]で転送します。サーバはTFTPサーバであれば、*サーバプロトコル名*を[TFTP]にします。
ソースファイル名が表示されたもので間違いなければEnterで次へ進みます。
アドレス名を聞かれるので送信先のサーバIPアドレスを入力します。
ex)
Router# copy flash tftp
Source filename [c9xx-adventerprisek9-mz.xxx.xx.bin] ?
Address or name of remote host [ ] ? *IPアドレス*
Destination filename [c9xx-adventerprisek9-mz.xxx.xx.bin] ?
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2147483649 bytes copied
また、コンフィグレーションファイルも同様に転送ができます。
[copy running-config *サーバプロトコル名*]で転送ができます。
コンフィグレーションファイルのデータは、ターミナルソフトのログをテキストファイルであらかじめ記録することでもバックアップになります。
・ルータ設定の初期化
startup-configファイルを削除することで初期化します。
[erase startup-configコマンド]でコンフィグレーションファイルが削除されます。
起動中のためrunning-configが読み込まれていますが、再起動するとセットアップモードが起動します。
ex)
Router# erase startup-config
Erasing the nvram filesystem will remove all configuration files!
Continue? [confirm]
[OK]
Erase of nvram : complete
参考
CCNA対策から学ぶネットワーク運用ガイド1 ほか