急に比較的信頼性の高いルータが一時的に必要な事案があり、とっくに退役した Cisco 871 ルータをサーバルームから見つけたので、初期化と基本的なルータ機能の設定を行います。
このCisco 871ルータは私が電脳部に奉公するようになった頃すでに稼働していて、自分にとってはCisco機器キャリアの始まりの一台でした。一線を退いた後、サブルータとしてnexthopの2ndゲートウェイを努め、それも栄光退役して数年、パスワードすら忘れてしまったのと、少し特殊なルーティングしていた記憶があるので、そのまま使うより一度初期化することに。
初期化
コンソールを母艦(Ubuntu 18.04.4LTSで通信にはminicomを使用)に繋いでからルータの電源オン、ブートシーケンスの初期で処理を中断させます。
が、止まりません…。ESCキーか、Break Key、Ctrl+Breakいずれも止めることは出来ず、もう一度サポートページを調べてみると、minicomでは「Ctrl-a f」とのことで、通信ソフトに依存する点は盲点でした。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
System Bootstrap, Version 12.3(8r)YI3, RELEASE SOFTWARE Technical Support: http://www.cisco.com/techsupport Copyright (c) 2006 by cisco Systems, Inc. C870 series (Board ID: 3-148) platform with 131072 Kbytes of main memory Booting flash:/c870-advsecurityk9-mz.124-4.T4.bin Self decompressing the image : ######################################################################### [OK] Restricted Rights Legend Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c) of the Commercial Computer Software - Restricted Rights clause at FAR sec. 52.227-19 and subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at DFARS sec. 252.227-7013. cisco Systems, Inc. 170 West Tasman Drive San Jose, California 95134-1706 Cisco IOS Software, C870 Software (C870-ADVSECURITYK9-M), Version 12.4(4)T4, RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2006 by Cisco Systems, Inc. Compiled Thu 03-Aug-06 17:20 by kellythw Image text-base: 0x8002008C, data-base: 0x813F7CD8 This product contains cryptographic features and is subject to United States and local country laws governing import, export, transfer and use. Delivery of Cisco cryptographic products does not imply third-party authority to import, export, distribute or use encryption. Importers, exporters, distributors and users are responsible for compliance with U.S. and local country laws. By using this product you agree to comply with applicable laws and regulations. If you are unable to comply with U.S. and local laws, return this product immediately. A summary of U.S. laws governing Cisco cryptographic products may be found at: http:/www.cisco.com/wwl/export/crypto/tool/stqrg.html If you require further assistance please contact us by sending email to export@cisco.com. Cisco 871 (MPC8272) processor (revision 0x200) with 118784K/12288K bytes of memory. Processor board ID FHK10351248 MPC8272 CPU Rev: Part Number 0xC, Mask Number 0x10 5 FastEthernet interfaces 128K bytes of non-volatile configuration memory. 24576K bytes of processor board System flash (Intel Strataflash) --- System Configuration Dialog --- Would you like to enter the initial configuration dialog? [yes/no]: System Bootstrap, Version 12.3(8r)YI3, RELEASE SOFTWARE Technical Support: http://www.cisco.com/techsupport Copyright (c) 2006 by cisco Systems, Inc. C870 series (Board ID: 3-148) platform with 131072 Kbytes of main memory rommon 1 > |
ようやく止まりました。ここで既存の設定を消して再起動すれば初期状態になり、そこから設定すれば良い、と思っていたのですが、もう少し手順が必要でした。サポートページに書いてあることを最後まできちんと読んで実行しないと、何度起動してもいつも初期状態という現象に陥ります(陥りました)。
まず、以下のコマンドを発行して、再起動させます。
1 2 3 |
rommon 1 > confreg 0x2142 rommon 2 > reset rommon 3 > |
再起動後、初期設定ウィザードをnoで拒否してプロンプトに、そして実行モードへ昇格の後、「configure memory」します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Cisco 871 (MPC8272) processor (revision 0x200) with 118784K/12288K bytes of memory. Processor board ID FHK10351248 MPC8272 CPU Rev: Part Number 0xC, Mask Number 0x10 5 FastEthernet interfaces 128K bytes of non-volatile configuration memory. 24576K bytes of processor board System flash (Intel Strataflash) --- System Configuration Dialog --- Would you like to enter the initial configuration dialog? [yes/no]: no Press RETURN to get started! Cisco IOS Software, C870 Software (C870-ADVSECURITYK9-M), Version 12.4(4)T4, RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2006 by Cisco Systems, Inc. Compiled Thu 03-Aug-06 17:20 by kellythw Router>enable Router#conf memory |
そして設定モードに移って、予めテキストファイルに組んでおいた設定をコピペでどさっと送り込むのが私の定番です。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
version 12.4 no service pad service tcp-keepalives-in service tcp-keepalives-out service timestamps debug datetime msec localtime show-timezone service timestamps log datetime msec localtime show-timezone service password-encryption service sequence-numbers ! hostname Cisco871 ! boot-start-marker boot-end-marker ! logging buffered 4096 debugging enable secret 5 ################################# ! no aaa new-model ! resource policy ! clock timezone HKT 8 ip subnet-zero no ip source-route ip cef ! ! ip tcp synwait-time 10 no ip bootp server no ip domain lookup ip domain name yourdomain.com ip ssh time-out 60 ip ssh authentication-retries 2 ! ! crypto pki trustpoint TP-self-signed-######### enrollment selfsigned subject-name cn=IOS-Self-Signed-Certificate-######### revocation-check none rsakeypair TP-self-signed-######### ! ! username ######################################################### ! ! ! ! ip dhcp pool LANPOOL network 192.168.27.0 255.255.255.0 default-router 192.168.27.254 dns-server 192.168.27.254 8.8.8.8 8.8.4.4 lease 0 1 ! ip dhcp excluded-address 192.168.27.1 192.168.27.99 ip dhcp excluded-address 192.168.27.200 192.168.27.254 ! ! ! ! interface FastEthernet0 no shutdown ! interface FastEthernet1 no shutdown ! interface FastEthernet2 no shutdown ! interface FastEthernet3 no shutdown ! interface FastEthernet4 ip address ###.###.###.### 255.255.255.248 no shutdown no ip redirects no ip unreachables no ip proxy-arp ip nat outside ip virtual-reassembly ip route-cache flow duplex auto speed auto ! interface Vlan1 ip address 192.168.27.254 255.255.255.0 no shutdown no ip redirects no ip unreachables no ip proxy-arp ip nat inside ip virtual-reassembly ip route-cache flow ip tcp adjust-mss 1452 ! ip classless ip route 0.0.0.0 0.0.0.0 ###.###.###.### ! no ip http server no ip http secure-server ! ! ip nat inside source list 1 interface FastEthernet4 overload access-list 1 permit 192.168.27.0 0.255.255.255 ! no cdp run ! control-plane ! ! line con 0 login local no modem enable transport output telnet line aux 0 login local transport output telnet line vty 0 4 exec-timeout 120 0 privilege level 15 login local length 0 transport input telnet ssh ! scheduler max-task-time 5000 scheduler allocate 4000 1000 scheduler interval 500 ntp clock-period 17175024 ntp server 118.143.17.82 version 2 |
最後に設定モードの終わりに、次のコマンドを送り込み、保存したら再起動して完了です。
1 2 3 4 5 6 7 |
Cisco871(config)#config-register 0x2102 Cisco871(config)#end Cisco871#wri mem Building configuration... [OK] Cisco871#reload Proceed with reload? [confirm] |
DHCPサーバの設定
社内ではいつもWindows ServerをDHCPサーバに立てる場合ばかりでしたが、今回はネットワーク上に他のサーバが一切無いので、CiscoルータをDHCPサーバにするしかなく、初めて設定してみました。設定のうちリース時間について補足すると、何も指定しないと1日貸出し、leaseオプションで指定する際の引数は、Day, Hour, Minutesの順になっていて、
- lease 1 : 1日(デフォルト)
- lease 0 1 : 1時間
- lease 0 0 30 : 30分
のように指定します。他の基本的な設定項目と併せ、DHCP関連は次のように設定しました。
1 2 3 4 5 6 7 8 |
ip dhcp pool LANPOOL network 192.168.27.0 255.255.255.0 default-router 192.168.27.254 dns-server 192.168.27.254 8.8.8.8 8.8.4.4 lease 0 1 ! ip dhcp excluded-address 192.168.27.1 192.168.27.99 ip dhcp excluded-address 192.168.27.200 192.168.27.254 |
市販のルータではWebUIからDHCPの払い出し状況をモニタリングしていましたが、このルータのWebUIは期待出来ないことから、CLIベースで監視するのが良さそうです。関連コマンドを確認します。
1 2 3 4 5 6 7 8 9 10 |
Cisco871#sh ip dhcp binding Bindings from all pools not associated with VRF: IP address Client-ID/ Lease expiration Type Hardware address/ User name 192.168.27.101 ################# Aug 05 2020 10:57 AM Automatic 192.168.27.102 ################# Aug 05 2020 10:44 AM Automatic 192.168.27.104 ################# Aug 05 2020 04:58 PM Automatic Cisco871#clear ip dhcp bindings 192.168.27.100 Cisco871# |
実際に伏せ字の部分はMACアドレスが表示されるのですが、結局ホスト名を知る手段が無いので、これだけではかなり微妙です。
sshでの接続
初期化で鍵も消去してしまったので、新たに生成します。
1 2 3 4 5 6 7 8 9 10 11 |
Cisco871(config)#crypto key generate rsa The name for the keys will be: Cisco871.yourdomain.com Choose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes. How many bits in the modulus [512]: 2048 % Generating 1024 bit RSA keys, keys will be non-exportable...[OK] Cisco871(config)#end |
Ubuntu 18.04.4LTSをクライアントとして接続する際、古いアルゴリズムを例外的に許可しないと接続は成功しません。
1 |
ssh -o KexAlgorithms=diffie-hellman-group1-sha1 -c aes256-cbc username@192.168.27.254 |
telnet/sshでのアクセス制限
telnet, sshでのコンソールアクセスをACLを使い、LANサブネットと外部特定アドレス(保守用)に限定します。
1 2 3 4 5 6 7 8 9 10 11 |
access-list 23 permit ###.###.###.### access-list 23 permit 192.168.27.0 0.0.0.255 access-list 23 deny any line vty 0 4 access-class 23 in exec-timeout 120 0 privilege level 15 login local length 0 transport input telnet ssh |
ACLも勉強がてら色々試していたのですが、ことごとく玉砕で時間切れ、ルータを引き渡しました。いつも中途半端に組み、時間の経過と共にまた忘れて、の繰り返しなので、ACLを含めて基本的な設定をじっくり組んでみたいと思っています。