LoginSignup
0
0

CISCO ルーターを初期セットアップしてみてみた

Last updated at Posted at 2024-06-11

セットアップ モードには、新規ネットワーキング デバイスや、NVRAM から startup-config ファイルを削除してしまったデバイスの初期設定ファイル作成を支援するインタラクティブ メニューが用意されています。インタラクティブ メニューに従って、初期設定を最初から最後まで行うことができます。インターフェイス メニューは、シスコ製品や Command Line Interface(CLI; コマンドライン インターフェイス)に慣れていない場合や、コンフィギュレーションの変更が CLI の提供するレベルの詳細設定を必要としていない場合に便利です。また、セットアップ モードを使用して、既存のコンフィギュレーションを変更することもできます。
ということで、初期設定をしてみてみます。

■ Ciscoルータ起動

電源ケーブルを接続してスイッチON
電源ON.jpg

■ コンソール・ケーブル接続と起動表示

コンソール・ケーブルをPCとルーターへ接続しコンソール表示します。

■ 初期化

Ciscoルータで設定を初期化するためには、先ず erase startup-config と入力しNVRAM上の
コンフィグを削除します。次に、reloadコマンドで、Ciscoルータを再起動することにより初期化できます。

Router>enable
Router#erase startup-config
    Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
    [OK]
    Erase of nvram: complete

■ 再起動

Router#reload
    Proceed with reload? [confirm] <-- [Enterを入力]

    *May 31 00:40:24.107: %SYS-5-RELOAD: Reload requested by console. Reload Reason: Reload Command.
    System Bootstrap, Version 15.2(3r)XC, RELEASE SOFTWARE (fc1)
    Technical Support: http://www.cisco.com/techsupport
    Copyright (c) 2012 by cisco Systems, Inc.

    Total memory size = 512 MB
    C892FSP-K9         platform with 524288 Kbytes of main memory
    Main memory is configured to 32 bit mode

    Readonly ROMMON initialized
    program load complete, entry point: 0x4000000, size: 0x18c40
    program load complete, entry point: 0x4000000, size: 0x18c40


    IOS Image Load Test
    ___________________
    Digitally Signed Production Software
    program load complete, entry point: 0x4000000, size: 0x318add8
    Self decompressing the image : ################################################################################################################################################################################################################################################################################################################################################################################################################################################ [OK]
    *** No sreloc section
    Smart Init is enabled
    smart init is sizing iomem
                    TYPE      MEMORY_REQ
        Onboard devices &
            buffer pools      0x022ECEC0
    -----------------------------------------------
                TOTAL:      0x022ECEC0

    Rounded IOMEM up to: 34Mb.
    Using 6 percent iomem. [34Mb/512Mb]

                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, C800 Software (C800-UNIVERSALK9-M), Version 15.2(4)M5, RELEASE SOFTWARE (fc2)
    Technical Support: http://www.cisco.com/techsupport
    Copyright (c) 1986-2013 by Cisco Systems, Inc.
    Compiled Fri 13-Sep-13 23:06 by prod_rel_team


    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.

    Installed image archive
    Cisco C892FSP-K9 (revision 1.0) with 488524K/35763K bytes of memory.
    Processor board ID FGL23181
    10 Gigabit Ethernet interfaces
    1 Virtual Private Network (VPN) Module
    DRAM configuration is 32 bits wide
    255K bytes of non-volatile configuration memory.
    250880K bytes of ATA System CompactFlash (Read/Write)

■ セットアップ モードを使用したシスコ ネット ワーキング デバイスの設定

セットアップ モードには、新規ネットワーキング デバイスや、NVRAM から startup-config ファイルを削除してしまったデバイスの初期設定ファイル作成を支援するインタラクティブ メニューが用意されています。インタラクティブ メニューに従って、初期設定を最初から最後まで行うことができます。インターフェイス メニューは、シスコ製品や Command Line Interface(CLI; コマンドライン インターフェイス)に慣れていない場合や、コンフィギュレーションの変更が CLI の提供するレベルの詳細設定を必要としていない場合に便利です。また、セットアップ モードを使用して、既存のコンフィギュレーションを変更することもできます。

● システム設定ダイアログを使用した初期設定

1) デバイス電源ON
デバイスの電源を入れます。

2) System Configuration Dialog
プロンプトで yes と入力し、初期設定ダイアログに入ります。
開始シーケンスの最後に、次のメッセージが表示された場合、システム設定ダイアログは自動的に呼び出されます。
基本管理画面が表示されます。

         --- System Configuration Dialog ---

Would you like to enter the initial configuration dialog? [yes/no]: yes

3) Continue with configuration dialog?
この設定ダイアログで続行するかどうかを確認するプロンプトが表示されたら yes と入力して、次に進みます(この手順は表示されないこともあります)。

Continue with configuration dialog? [yes/no]: yes 

4) configuration dialog画面

At any point you may enter a question mark '?' for help.
Use ctrl-c to abort configuration dialog at any prompt.
Default settings are in square brackets '[]'.

Basic management setup configures only enough connectivity
for management of the system, extended setup will ask you
to configure each interface on the system

プロンプトで yes と入力して、基本管理の設定に入ります。

Would you like to enter basic management setup? [yes/no]: yes
Configuring global parameters:

5) host name 設定
デバイスのホスト名を入力します。

  Enter host name [Router]: C892

6) enable secret設定
イネーブル シークレット パスワードを入力します。
このパスワードは暗号化され、コンフィギュレーションを表示しても、見ることはできません。

  The enable secret is a password used to protect access to
  privileged EXEC and configuration modes. This password, after
  entered, becomes encrypted in the configuration.
  Enter enable secret: イネーブル・シークレット・パスワード

7) enable password設定
イネーブル シークレット パスワードとは異なるイネーブル パスワードを入力します。
イネーブル パスワードは暗号化されず、コンフィギュレーションを表示したときに見ることができます。

  The enable password is used when you do not specify an
  enable secret password, with some older software versions, and
  some boot images.
  Enter enable password:イネーブル・パスワード

8) virtual terminal password設定
仮想端末のパスワードを入力します。
このパスワードは、コンソール ポートを通じてデバイスにアクセスする場合だけ使用します。

  The virtual terminal password is used to protect
  access to the router over a network interface.
  Enter virtual terminal password:
% No defaulting allowed
  Enter virtual terminal password: ターミナル・パスワード

9) SNMP Network Management設定
使用しているネットワークにあわせて、プロンプトに答えます。
この例では、 Enter キーを押して、現在の設定 [no] をそのまま使用します。

  Configure SNMP Network Management? [yes]: no

使用可能なインターフェイスの概要が表示されます。表示されるインターフェイス番号はプラットフォームの種類と、インストールされているインターフェイス モジュールおよびカードによって異なります。

Current interface summary

Any interface listed with OK? value "NO" does not have a valid configuration

Interface                  IP-Address      OK? Method Status                Protocol
GigabitEthernet0           unassigned      YES unset  down                  down
GigabitEthernet1           unassigned      YES unset  down                  down
GigabitEthernet2           unassigned      YES unset  down                  down
GigabitEthernet3           unassigned      YES unset  down                  down
GigabitEthernet4           unassigned      YES unset  down                  down
GigabitEthernet5           unassigned      YES unset  down                  down
GigabitEthernet6           unassigned      YES unset  down                  down
GigabitEthernet7           unassigned      YES unset  down                  down
GigabitEthernet8           unassigned      NO  unset  down                  down
GigabitEthernet9           unassigned      NO  unset  down                  down
Vlan1                      unassigned      YES unset  down                  down

10) 管理ネットワーク・インターフェイス選択
ルータを管理ネットワークに接続するためのインターフェイスを選択します。

Enter interface name used to connect to the
management network from the above interface summary: Vlan1

11) 管理ネットワーク・インターフェイス設定
使用しているネットワークにあわせて、プロンプトに答えます。
この例では、IP を設定しています。IP アドレスを入力し、現在のサブネット マスクをそのまま使用します。画面には、作成されたコマンド スクリプトが表示されています。

Configuring interface Vlan1:
    Configure IP on this interface? [no]: yes
    IP address for this interface: Vlan1
% Bad Internet address.
% Enter an Internet address of the form 'X.X.X.X', where each
% letter corresponds to a decimal number between 0 and 255.

    IP address for this interface: 192.168.10.252
    Subnet mask for this interface [255.255.255.0] :
    Class C network is 192.168.10.0, 24 subnet bits; mask is /24

The following configuration command script was created:

hostname C892
enable secret 5 mGqQ$PuaMQ9kSI5trEB
enable password password
line vty 0 4
no snmp-server
!
!
interface GigabitEthernet0
shutdown
no ip address
!
interface GigabitEthernet1
shutdown
no ip address
!
interface GigabitEthernet2
shutdown
no ip address
!
interface GigabitEthernet3
shutdown
no ip address
!
interface GigabitEthernet4
shutdown
no ip address
!
interface GigabitEthernet5
shutdown
no ip address
!
interface GigabitEthernet6
shutdown
no ip address
!
interface GigabitEthernet7
shutdown
no ip address
!
interface GigabitEthernet8
shutdown
no ip address
!
interface GigabitEthernet9
shutdown
no ip address
!
interface Vlan1
no shutdown
ip address 192.168.10.252 255.255.255.0
!
end

12) configuration保存
2 を入力して、NVRAM にコンフィギュレーション ファイルを保存し、終了します。

[0] Go to the IOS command prompt without saving this config.
[1] Return back to the setup without saving this config.
[2] Save this configuration to nvram and exit.

Enter your selection [2]: 2
 Warning: The CLI will be deprecated soon
 'enable secret 5 mGqQ$PuaMQ9kSI5trEB
 Please move to 'enable secret <password>' CLI
Building configuration...
Use the enabled mode 'configure' command to modify this configuration.


Press RETURN to get started!


*Jan  2 00:00:01.495: %IOS_LICENSE_IMAGE_APPLICATION-6-LICENSE_LEVEL: Module name = c800 Next reboot level = advipservices and License = advipservices
*May 31 00:41:42.471: %VPN_HW-6-INFO_LOC: Crypto engine: onboard 0  State changed to: Initialized
*May 31 00:41:43.987: %VPN_HW-6-INFO_LOC: Crypto engine: onboard 0  State changed to: Enabled
*May 31 00:41:58.299: %LINK-3-UPDOWN: Interface GigabitEthernet8, changed state to up
*May 31 00:41:58.299: %LINK-3-UPDOWN: Interface GigabitEthernet9, changed state to up
*May 31 00:41:59.223: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down
*May 31 00:41:59.299: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet8, changed state to down
*May 31 00:41:59.299: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet9, changed state to down
*May 31 00:42:01.231: %LINK-3-UPDOWN: Interface GigabitEthernet9, changed state to down
*May 31 00:42:01.231: %LINK-3-UPDOWN: Interface GigabitEthernet8, changed state to down
*May 31 00:53:53.483: %SYS-5-CONFIG_I: Configured from console by console
*May 31 00:53:55.327: %LINK-5-CHANGED: Interface GigabitEthernet0, changed state to administratively down
*May 31 00:53:55.327: %LINK-5-CHANGED: Interface GigabitEthernet1, changed state to administratively down
*May 31 00:53:55.327: %LINK-5-CHANGED: Interface GigabitEthernet2, changed state to administratively down
*May 31 00:53:55.327: %LINK-5-CHANGED: Interface GigabitEthernet3, changed state to administratively down
*May 31 00:53:55.327: %LINK-5-CHANGED: Interface GigabitEthernet4, changed state to administratively down
*May 31 00:53:55.327: %LINK-5-CHANGED: Interface GigabitEthernet5, changed state to administratively down
*May 31 00:53:55.427: %LINK-5-CHANGED: Interface GigabitEthernet6, changed state to administratively down
*May 31 00:53:55.427: %LINK-5-CHANGED: Interface GigabitEthernet7, changed state to administratively down
*May 31 00:53:55.427: %LINK-5-CHANGED: Interface GigabitEthernet8, changed state to administratively down
*May 31 00:53:55.427: %LINK-5-CHANGED: Interface GigabitEthernet9, changed state to administratively down
*May 31 00:53:56.499: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0, changed state to down
*May 31 00:53:56.499: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1, changed state to down
*May 31 00:53:56.499: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet2, changed state to down
*May 31 00:53:56.499: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet3, changed state to down
*May 31 00:53:56.499: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet4, changed state to down
*May 31 00:53:56.499: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet5, changed state to down
*May 31 00:53:56.499: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet6, changed state to down
*May 31 00:53:56.499: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet7, changed state to down
*May 31 00:54:04.383: %SYS-5-RESTART: System restarted --
Cisco IOS Software, C800 Software (C800-UNIVERSALK9-M), Version 15.2(4)M5, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
Compiled Fri 13-Sep-13 23:06 by prod_rel_team
*May 31 00:54:04.595: %SNMP-5-COLDSTART: SNMP agent on host C892 is undergoing a cold start
*May 31 00:54:04.603: %SYS-6-BOOTTIME: Time taken to reboot after reload =  820 seconds
*May 31 00:54:04.635: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is OFF
*May 31 00:54:04.635: %CRYPTO-6-GDOI_ON_OFF: GDOI is OFF
C892>

■ 設定ファイル確認

C892#show running-config
Building configuration...

Current configuration : 1315 bytes
!
version 15.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname C892
!
boot-start-marker
boot-end-marker
!
!
enable secret 5 mGqQ$PuaMQ9kSI5trEB
enable password password
!
no aaa new-model
!
!
ip cef
!
!
!
!


!
!
!
!
no ipv6 cef
!
!
multilink bundle-name authenticated
license udi pid C892FSP-K9 sn FGL23181
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface GigabitEthernet0
 no ip address
 shutdown
!
interface GigabitEthernet1
 no ip address
 shutdown
!
interface GigabitEthernet2
 no ip address
 shutdown
!
interface GigabitEthernet3
 no ip address
 shutdown
!
interface GigabitEthernet4
 no ip address
 shutdown
!
interface GigabitEthernet5
 no ip address
 shutdown
!
interface GigabitEthernet6
 no ip address
 shutdown
!
interface GigabitEthernet7
 no ip address
 shutdown
!
interface GigabitEthernet8
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface GigabitEthernet9
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Vlan1
 ip address 192.168.10.252 255.255.255.0
!
ip forward-protocol nd
no ip http server
no ip http secure-server
!
!
!
!
!
control-plane
!
!
!
line con 0
 no modem enable
line aux 0
line vty 0 4
 password イネーブル・パスワード
 login
 transport input all
!
scheduler allocate 20000 1000
!
end

■ SSH設定

● 非 SSH 接続の防止

transport input ssh

● ドメイン名の設定

SSH暗号鍵の生成のためにドメイン名を設定します。ホスト名とドメイン名ともにローカルの適当な内容で問題ありません。

ip domain name shirok.com

● RSA暗号鍵の設定

暗号鍵のbit長は、1024を設定します。

crypto key generate rsa

	The name for the keys will be: C892-01.shirok.com
	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]: 1024
	% Generating 1024 bit RSA keys, keys will be non-exportable...
	[OK] (elapsed time was 1 seconds)
	
	*Jan  1 12:23:40.140: %SSH-5-ENABLED: SSH 1.99 has been enabled

● VTYポート設定

SSH接続でVTYポートにログインする際に、line vtyに設定されたパスワードではなく、上記で設定した
 ユーザ名とパスワードを認証の際に使用するようにするために、line vtyにローカル認証の設定をします。
VTYポートを5つ作成し同時に5セッションを可能にします。

line vty 0 4
login local
transport input ssh

● ユーザ認証の設定

ユーザ名とパスワードを入力することでCiscoルータへSSH接続してログインできるようになります。

username shirok passwor 

● SSH接続タイムアウト設定

ip ssh time-out 60
ip ssh authentication-retries 2

● SSH バージョン2 の設定

SSHのバージョンには1と2があります。バージョン2の方がよりセキュアなのでここでは、SSH version2を使用するようにします。

ip ssh version 2

● サブネットへの SSH アクセスを制限

SSH 接続を特定のサブネットワークに制限し、サブネットワーク外 IP からのその他すべての SSH 接続試行がドロップされるようにする必要があります。
この設定は、次の手順を使用して実行できます。
1) 特定サブネットワークからのトラフィックを許可するアクセス リスト定義
この例では、192.168.0.0 255.255.0.0 サブネットへの SSH アクセスのみが許可され、その他のアクセスは拒否されます。

access-list 22 permit 192.168.0.0 0.0.255.255

2) access-class を備える VTY ライン インターフェイスへのアクセスを制限

line vty 0 4
transport input ssh
access-class 22 in
exit

● SSH情報確認

show sshコマンドで、現在使用されているSSHバージョン、現在接続しているユーザ名などの情報が分かります。

show ssh
	%No SSHv2 server connections running.
	%No SSHv1 server connections running.

■ DHCPサーバー設定

● 設定

1) DHCPサービスの有効化

service dhcp

2) 除外するIPアドレスの設定

ip dhcp excluded-address 192.168.10.200 192.168.10.254

3) DHCPプールの設定

ip dhcp pool dhcp-pool                    DHCPプールを識別するための名前
network 192.168.0.0 255.255.255.0         DHCPクライアントに割り当てるネットワークアドレス
address range 192.168.0.10 192.168.0.20   アドレス範囲を設定
default-router 192.168.0.1                DHCPクライアントに通知するデフォルトゲートウェイ
dns-server 192.168.0.1 1.1.1.1            DHCPクライアントに通知するDNSサーバのIPアドレス(最大8つ)
domain-name infraexpert.com               DHCPクライアントに通知するドメイン名
lease 0 2                                 IPアドレスの払い出し期間を12時間
lease infinite                            IPアドレスの払い出し期間を無制限
end

● 設定確認

C892#show ip dhcp pool

Pool dhcp-pool :
 Utilization mark (high/low)    : 100 / 0
 Subnet size (first/next)       : 0 / 0
 Total addresses                : 254
 Leased addresses               : 0
 Pending event                  : none
 1 subnet is currently in the pool :
 Current index        IP address range                    Leased addresses
 192.168.10.1         192.168.10.1     - 192.168.10.254    0


C892#show ip dhcp conflict
IP address        Detection method   Detection time          VRF

C892#show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address          Client-ID/              Lease expiration        Type
                    Hardware address/
                    User name
192.168.0.1        0100.e04c.d294.25       Jun 01 2024 02:23 AM    Automatic

■ 参考

 ・ Cisco IOS Configuration Fundamentals コンフィギュレーション ガイド
 ・ Cisco IOS - How to CLI 3
 ・ルータおよびスイッチでの SSH の設定
 ・ Cisco Router - SSH
 ・ Cisco IOS DHCP サーバ設定

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0