先ごろ落札入手したL2SW、Catalyst 2960-X(WS-C2960X-48TS-L)。
取り急ぎシリアルコンソールにつないで、次の3点を目標として設定する。
- MGMTポートを生かす。
- 時刻同期させる。
- SSHログインしてターミナルを叩けるようにする。
ホスト名、enableパスワードの設定と合わせて、パスワード表示の暗号化もセットする。
(以降入力値は斜体、環境変数値は<>囲み)
>enable
#configure terminal
(config)#hostname <hostname>
(config)#service password-encryption
(config)#enable secret <enable password>
次にMGMTポート(FastEthernet0)を生かす。
(config)#interface FastEthernet 0
(config-if)#description ManagementPort
(config-if)#ip address <IP Addr> <Netmask>
(config-if)#no shutdown
(config-if)#exit
これでTCP/IPで通信がMGMTポートを使ってできるようになったので、SSH設定に必要になるドメイン、時刻同期のためのNTPとデフォルトゲートウェイを設定。
NTPの向け先は取り急ぎ’ntp.nict.jp’にしておく、後々自家NTPを立てたらそっちに変更する予定。
(config)#ip domain-name <domainname>
(config)#ip name-server <DNS IP Addr>
(config)#ip default-gateway <Default Gateway>
(config)#clock timezone JST 9
(config)#ntp server ntp.nict.jp
Translating "ntp.nict.jp"...domain server (<DNS IP Addr>) [OK]
これで一通りの設定が入ったのでSSHの設定。
ローカル認証用ユーザーを作って、RSA鍵を設定できる最大長4096で作成。
SSH Versionは’2’を指定。
(config)#username <username> 0 password <password>
(config)#crypto key generate rsa
The name for the keys will be: <hostname>.<domainname>
Choose the size of the key modulus in the range of 360 to 4096 for your
General Purpose Keys. Choosing a key modulus greater than 512 may take
a few minutes.
How many bits in the modulus [512]: 4096
% Generating 4096 bit RSA keys, keys will be non-exportable...
[OK] (elapsed time was 78 seconds)
(config)#ip ssh version 2
ラインコンフィグでSSHだけ許可して、使わない分は全てふさぎます。
セッション数も’5’あれば作業上の不都合もないでしょう。
(config)#line vty 0 4
(config-line)#login local
(config-line)#transport input ssh
(config-line)#exit
(config)#line vty 5 15
(config-line)#login local
(config-line)#transport input none
puttyを使って、SSHログインを試してみる。
login as: <username>
Keyboard-interactive authentication prompts from server:
| Password: <password>
End of keyboard-interactive prompts from server
>enable
Password:<enable password>
#exit
リモートからSSHで設定できる事が確認できたので、startup-configに書き込んで、一旦作業を中断、続きは後日。
(config-line)#exit
(config)#exit
#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]