0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Catalystスイッチのコマンドメモ

Last updated at Posted at 2025-02-11

背景・目的

CiscoのCatalystスイッチについてコマンドをまとめます。

まとめ

分類 モード※1 目的
全般 ユーザ スイッチのバージョンを確認する
特権 設定(startup-config)を確認する
特権 設定(running-config)を確認する
特権 設定(running-config)をコピーする
グローバル ホスト名を変更する
グローバル ホスト名を削除する
特権 ルーターを初期化する
ライン VTYパスワードを設定する
グローバル enableパスワードを設定する
グローバル enableパスワード(暗号化)を設定する
グローバル パスワード全般を暗号化する
インターフェイス 特権 インターフェイスを確認する
特権 インターフェースのステータスを確認する
インターフェイス IPアドレスを設定する
特権 デフォルトに戻す
ルーティング 特権 ルーティングテーブルを確認する

※1 モードはIOSのモードを参照

概要

Cisco IOS

  • IOSは、Internetwork Operating Systemの略
  • Cisco 独自のOS

IOSのモード

  • IOSには以下のような操作モードがある
    • ユーザEXEC
    • 特権EXEC
    • グローバルコンフィギュレーション
    • 各種設定
      • インターフェイス

設定ファイル

  • ルーターやスイッチで、設定を行うと設定ファイルにその内容が書き込まれる
  • 設定ファイルには、startup-configとrunning-configがある

startup-config

  • ルーターが再起動されても消えない設定ファイル
  • ルーターが起動される場合、startup-configに記録されている内容を読み込み起動する

running-config

  • ルーターが再起動すると消えてしまう設定ファイル
  • 起動直後は、startup-configと同内容
  • ルーターで設定すると、リアルタイムに更新される

VTYポート

  • 仮想端末ポートと呼ばれる
  • Consoleポートと異なる。差込口がルーターにあるわけではない
  • 機器の内部に用意されている仮想ポート
  • telnet、SSHによるVTY接続ではEthernetポートなどの通信を行うポートから機器内部のVTYポートを経由して接続する

実践

前提

  • Packet Tracerがインストールされていること

全般

スイッチのバージョンを確認する

  • show versionを実行する

  • 下記のような情報がわかる

    • モデル名:C3560
    • Version:12.2
    sw1>
    sw1>show version
    Cisco IOS Software, C3560 Software (C3560-ADVIPSERVICESK9-M), Version 12.2(37)SE1, RELEASE SOFTWARE (fc1)
    Copyright (c) 1986-2007 by Cisco Systems, Inc.
    Compiled Thu 05-Jul-07 22:22 by pt_team
    Image text-base: 0x00003000, data-base: 0x01500000
    
    ・・・・
    sw1>
    

設定(startup-config)を確認する

  • 特権モードでshow startup-configを実行する
    sw1#show startup-config 
    Using 1179 bytes
    !
    version 12.2(37)SE1
    no service timestamps log datetime msec
    no service timestamps debug datetime msec
    no service password-encryption
    !
    hostname sw1
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    spanning-tree mode pvst
    !
    !
    !
    !
    !
    !
    interface FastEthernet0/1
    !
    interface FastEthernet0/2
    !
    interface FastEthernet0/3
    !
    interface FastEthernet0/4
    !
    interface FastEthernet0/5
    !
    interface FastEthernet0/6
    !
    interface FastEthernet0/7
    !
    interface FastEthernet0/8
    !
    interface FastEthernet0/9
    !
    interface FastEthernet0/10
    !
    interface FastEthernet0/11
    !
    interface FastEthernet0/12
    !
    interface FastEthernet0/13
    !
    interface FastEthernet0/14
    !
    interface FastEthernet0/15
    !
    interface FastEthernet0/16
    !
    interface FastEthernet0/17
    !
    interface FastEthernet0/18
    !
    interface FastEthernet0/19
    !
    interface FastEthernet0/20
    !
    interface FastEthernet0/21
    !
    interface FastEthernet0/22
    !
    interface FastEthernet0/23
    !
    interface FastEthernet0/24
    !
    interface GigabitEthernet0/1
    !
    interface GigabitEthernet0/2
    !
    interface Vlan1
     ip address 192.168.1.1 255.255.255.0
    !
    ip default-gateway 192.168.1.254
    ip classless
    !
    ip flow-export version 9
    !
    !
    !
    !
    !
    !
    !
    !
    line con 0
    !
    line aux 0
    !
    line vty 0 4
     login
    !
    !
    !
    !
    end
    
    

設定(running-config)を確認する

  • 特権モードでshow running-configを実行する
    sw1>enable
    sw1#show running-config
    Building configuration...
    
    Current configuration : 1179 bytes
    !
    version 12.2(37)SE1
    no service timestamps log datetime msec
    no service timestamps debug datetime msec
    no service password-encryption
    !
    hostname sw1
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    spanning-tree mode pvst
    !
    !
    !
    !
    !
    !
    interface FastEthernet0/1
    !
    interface FastEthernet0/2
    !
    interface FastEthernet0/3
    !
    interface FastEthernet0/4
    !
    interface FastEthernet0/5
    !
    interface FastEthernet0/6
    !
    interface FastEthernet0/7
    !
    interface FastEthernet0/8
    !
    interface FastEthernet0/9
    !
    interface FastEthernet0/10
    !
    interface FastEthernet0/11
    !
    interface FastEthernet0/12
    !
    interface FastEthernet0/13
    !
    interface FastEthernet0/14
    !
    interface FastEthernet0/15
    !
    interface FastEthernet0/16
    !
    interface FastEthernet0/17
    !
    interface FastEthernet0/18
    !
    interface FastEthernet0/19
    !
    interface FastEthernet0/20
    !
    interface FastEthernet0/21
    !
    interface FastEthernet0/22
    !
    interface FastEthernet0/23
    !
    interface FastEthernet0/24
    !
    interface GigabitEthernet0/1
    !
    interface GigabitEthernet0/2
    !
    interface Vlan1
     ip address 192.168.1.1 255.255.255.0
    !
    ip default-gateway 192.168.1.254
    ip classless
    !
    ip flow-export version 9
    !
    !
    !
    !
    !
    !
    !
    !
    line con 0
    !
    line aux 0
    !
    line vty 0 4
     login
    !
    !
    !
    !
    end
    
    
    sw1#
    

設定(running-config)をコピーする

  • 特権モードでcopyコマンドを実行します
  1. 変更前の状態を確認します

    sw1#show startup-config 
    Using 1179 bytes
    !
    version 12.2(37)SE1
    no service timestamps log datetime msec
    no service timestamps debug datetime msec
    no service password-encryption
    !
    hostname sw1
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    spanning-tree mode pvst
    !
    !
    !
    !
    !
    !
    interface FastEthernet0/1
    !
    interface FastEthernet0/2
    !
    interface FastEthernet0/3
    !
    interface FastEthernet0/4
    !
    interface FastEthernet0/5
    !
    interface FastEthernet0/6
    !
    interface FastEthernet0/7
    !
    interface FastEthernet0/8
    !
    interface FastEthernet0/9
    !
    interface FastEthernet0/10
    !
    interface FastEthernet0/11
    !
    interface FastEthernet0/12
    !
    interface FastEthernet0/13
    !
    interface FastEthernet0/14
    !
    interface FastEthernet0/15
    !
    interface FastEthernet0/16
    !
    interface FastEthernet0/17
    !
    interface FastEthernet0/18
    !
    interface FastEthernet0/19
    !
    interface FastEthernet0/20
    !
    interface FastEthernet0/21
    !
    interface FastEthernet0/22
    !
    interface FastEthernet0/23
    !
    interface FastEthernet0/24
    !
    interface GigabitEthernet0/1
    !
    interface GigabitEthernet0/2
    !
    interface Vlan1
     ip address 192.168.1.1 255.255.255.0
    !
    ip default-gateway 192.168.1.254
    ip classless
    !
    ip flow-export version 9
    !
    !
    !
    !
    !
    !
    !
    !
    line con 0
    !
    line aux 0
    !
    line vty 0 4
     login
    !
    !
    !
    !
    end
    
    
  2. スイッチのホスト名を変更し、running-confingを確認します。この時点でrunning-configはホスト名が変わっています

    sw1(config)#hostname switch1
    switch1(config)#
    switch1(config)#exit
    
    switch1#show running-config | include hostname
    hostname switch1
    switch1#
    
    
  3. 特権モードで copyコマンドでコピーします

    switch1#copy running-config startup-config 
    Destination filename [startup-config]? 
    Building configuration...
    [OK]
    switch1#
    
  4. show startup-configで確認します。変わっていました

    switch1#show startup-config 
    Using 1183 bytes
    !
    version 12.2(37)SE1
    no service timestamps log datetime msec
    no service timestamps debug datetime msec
    no service password-encryption
    !
    hostname switch1
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    spanning-tree mode pvst
    !
    !
    !
    !
    !
    !
    
    switch1#
    

ホスト名を変更する

  • グローバルコンフィギュレーションモードでhostname で変更します
    sw1#configure terminal
    Enter configuration commands, one per line.  End with CNTL/Z.
    sw1(config)#hostname switch
    switch(config)#exit
    switch#
    

ホスト名を削除する

  • すべての設定コマンドで先頭にnoをつけてコマンドを実行する
  1. まずは、グロバールコンフィギュレーションモードでhostnameを設定します
    Switch#configure terminal 
    Enter configuration commands, one per line.  End with CNTL/Z.
    Switch(config)#hostname SW01
    SW01(config)#
    
  2. 変更後の設定を確認します
    SW01(config)#do show running-config | include hostname
    hostname SW01
    SW01(config)#
    
  3. 変更します。削除されました(変わりました)
    SW01(config)#no hostname
    MultiLayerSwitch(config)#
    MultiLayerSwitch(config)#do show running-config | include hostname
    hostname MultiLayerSwitch
    MultiLayerSwitch(config)#
    

ルーターを初期化する

  • 既存の設定を消去します
  • 手順は、startup-configを削除し、再起動します
  1. 特権モードでerase startup-configコマンドを実行します

    switch1#erase startup-config 
    Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
    [OK]
    Erase of nvram: complete
    %SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram
    switch1#
    
  2. 何も表示されません

    switch1#show startup-config 
    startup-config is not present
    switch1#
    
  3. reloadコマンドで再起動します

    switch1#reload
    Proceed with reload? [confirm]
    C3560 Boot Loader (C3560-HBOOT-M) Version 12.2(25r)SEC, RELEASE SOFTWARE (fc4)
    cisco WS-C3560-24PS (PowerPC405) processor (revision P0) with 122880K/8184K bytes of memory.
    3560-24PS starting...
    Base ethernet MAC Address: 0006.2A77.D5B4
    Xmodem file system is available.
    Initializing Flash...
    flashfs[0]: 3 files, 0 directories
    flashfs[0]: 0 orphaned files, 0 orphaned directories
    flashfs[0]: Total bytes: 64016384
    flashfs[0]: Bytes used: 8918011
    flashfs[0]: Bytes available: 55098373
    flashfs[0]: flashfs fsck took 1 seconds.
    ...done Initializing Flash.
    
    Boot Sector Filesystem (bs:) installed, fsid: 3
    Parameter Block Filesystem (pb:) installed, fsid: 4
    
    
    Loading "flash:/c3560-advipservicesk9-mz.122-37.SE1.bin"...
    ########################################################################## [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, C3560 Software (C3560-ADVIPSERVICESK9-M), Version 12.2(37)SE1, RELEASE SOFTWARE (fc1)
    Copyright (c) 1986-2007 by Cisco Systems, Inc.
    Compiled Thu 05-Jul-07 22:22 by pt_team
    Image text-base: 0x00003000, data-base: 0x01500000
    
    
    
    POST: CPU MIC register Tests : Begin
    POST: CPU MIC register Tests : End, Status Passed
    
    POST: PortASIC Memory Tests : Begin
    POST: PortASIC Memory Tests : End, Status Passed
    
    POST: CPU MIC interface Loopback Tests : Begin
    POST: CPU MIC interface Loopback Tests : End, Status Passed
    
    POST: PortASIC RingLoopback Tests : Begin
    POST: PortASIC RingLoopback Tests : End, Status Passed
    
    POST: Inline Power Controller Tests : Begin
    POST: Inline Power Controller Tests : End, Status Passed
    
    POST: PortASIC CAM Subsystem Tests : Begin
    POST: PortASIC CAM Subsystem Tests : End, Status Passed
    
    POST: PortASIC Port Loopback Tests : Begin
    POST: PortASIC Port Loopback Tests : End, Status Passed
    
    Waiting for Port download...Complete
    
    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 WS-C3560-24PS (PowerPC405) processor (revision P0) with 122880K/8184K bytes of memory.
    Processor board ID CAT1037RJF7
    24 FastEthernet/IEEE 802.3 interface(s)
    2 Gigabit Ethernet/IEEE 802.3 interface(s)
    
    
    ~~~~~~~~~~ 省略 ~~~~~~~~~~
    
    
    
             --- System Configuration Dialog ---
    
    Would you like to enter the initial configuration dialog? [yes/no]: 
    %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
    
    %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
    
    %LINK-5-CHANGED: Interface FastEthernet0/2, changed state to up
    
    %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
    
    % Please answer 'yes' or 'no'.
    Would you like to enter the initial configuration dialog? [yes/no]: no
    
    
    Press RETURN to get started!
    
    
    
    Switch>
    

VTYパスワードを設定する

  • グローバルコンフィギュレーションモードでline vtyで設定します
  • 開始ライン番号と終了ライン番号を指定し、まとめてVTYポートを設定できる
  1. ラインコンフィギュレーションモードに切り替えます
    MultiLayerSwitch(config)#line vty 0 4
    MultiLayerSwitch(config-line)#
    
  2. パスワードを変更します
    MultiLayerSwitch(config-line)#password XXXXX
    MultiLayerSwitch(config-line)#
    
  3. 有効化します
    MultiLayerSwitch(config-line)#login
    MultiLayerSwitch(config-line)#
    
  4. 設定されていました
    MultiLayerSwitch#show running-config | section line
    line con 0
    line aux 0
    line vty 0 4
     password XXXX
     login
    MultiLayerSwitch#
    

enableパスワードを設定する

  • グローバルコンフィギュレーションモードでenable password {パスワード}を実行します
  1. 設定します
    MultiLayerSwitch(config)#enable password XXXX
    MultiLayerSwitch(config)#
    
  2. exitします
  3. あらためてenableするとパスワードが求められました
    MultiLayerSwitch>enable
    Password: 
    MultiLayerSwitch#
    

enableパスワード(暗号化)を設定する

  • 通常のenable passwordの場合、show running-configでは設定したパスワードが表示される
  • 文字列を判別されないように暗号化する
  1. グローバルコンフィギュレーションモードでenable secretを実行します
    MultiLayerSwitch#configure terminal 
    Enter configuration commands, one per line.  End with CNTL/Z.
    MultiLayerSwitch(config)#
    MultiLayerSwitch(config)#
    MultiLayerSwitch(config)#
    MultiLayerSwitch(config)#enable secret XXXXX
    MultiLayerSwitch(config)#
    
  2. secretが保存されていました。なお、以前設定していたpasswordも平文で残っていました(きえるとおもっていましt)
    MultiLayerSwitch#show running-config | section enable
    enable secret 5 XXXXXXXX
    enable password XXXXXXXX
    MultiLayerSwitch#
    

パスワード全般を暗号化する

  • コンソールパスワード、VTYパスワードは専用の暗号化コマンドがない
  • このコマンドにより下記で設定したパスワードを暗号化する
    • enable password
    • password
    • username
  • 今後設定するパスワードも暗号化する
  • enable secret コマンドより暗号化の強度が弱いため、enable パスワードはsecretを推奨
  1. グローバルコンフィギュレーションモードでservice password-encryptionを実行します
    MultiLayerSwitch#configure terminal 
    Enter configuration commands, one per line.  End with CNTL/Z.
    MultiLayerSwitch(config)#service password-encryption 
    MultiLayerSwitch(config)#
    
  2. 確認します。たしかにpasswordが暗号化されていました(伏せ字で書いていますが、たしかに、パスワード強度はsecretのほうが強そうです。)
    MultiLayerSwitch(config)#do show running-config | section enable
    enable secret 5 XXXX
    enable password 7 XXXXX
    MultiLayerSwitch(config)#
    
    MultiLayerSwitch(config)#do show running-config | section line
    line con 0
    line aux 0
    line vty 0 4
     password 7 XXXXXX
     login
    MultiLayerSwitch(config)#
    

インターフェイス

インターフェイスを確認する

  • 特権モードでshow interfaceを実行する

  • 個々のインターフェースの詳細な情報を確認するためのコマンド

  • 下記のような情報がわかる

    • FastEthernet0/1 is up
      • 物理層
    • line protocol is up
      • データリンク層
    sw1#show interface
    FastEthernet0/1 is up, line protocol is up (connected)
      Hardware is Lance, address is 0090.2110.c701 (bia 0090.2110.c701)
      MTU 1500 bytes, BW 100000 Kbit, DLY 1000 usec,
         reliability 255/255, txload 1/255, rxload 1/255
      Encapsulation ARPA, loopback not set
      Keepalive set (10 sec)
      Full-duplex, 100Mb/s
      input flow-control is off, output flow-control is off
      ARP type: ARPA, ARP Timeout 04:00:00
      Last input 00:00:08, output 00:00:05, output hang never
      Last clearing of "show interface" counters never
      Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
      Queueing strategy: fifo
      Output queue :0/40 (size/max)
      5 minute input rate 0 bits/sec, 0 packets/sec
      5 minute output rate 0 bits/sec, 0 packets/sec
         956 packets input, 193351 bytes, 0 no buffer
         Received 956 broadcasts, 0 runts, 0 giants, 0 throttles
         0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
         0 watchdog, 0 multicast, 0 pause input
         0 input packets with dribble condition detected
         2357 packets output, 263570 bytes, 0 underruns
    
    sw1#
    
  1. グローバルコンフィギュレーションモードで、interfaceコマンドを実行します
    MultiLayerSwitch(config)#interface FastEthernet 0/1
    MultiLayerSwitch(config-if)#
    

インターフェースのステータスを確認する

  • 特権でshow interface statusを実行する
  • 下記で確認できる
    • リンクの状態(Status):
      • connected: 接続されている
      • notconnect: 接続されていない
      • err-disabled: エラーディスエーブル状態(エラーが原因で無効化)
      • disabled: 手動でシャットダウンされている
    • VLAN
      • 各ポートが所属するVLAN番号が表示される
    • デュプレックス(Duplex)
      • full: 全二重(フルデュプレックス)
      • half: 半二重(ハーフデュプレックス)
      • a-full: 自動ネゴシエーションでフルデュプレックス
      • a-half: 自動ネゴシエーションでハーフデュプレックス
    • 通信速度(Speed)
      • 1000: 1Gbps
      • 100: 100Mbps
      • 10: 10Mbps
      • auto: 自動ネゴシエーション設定
    • ポートの種類(Type)
      • SFP: 光ファイバーのSFPポート
      • 10/100/1000Base-T: RJ45の規格
    sw1#show interface status
    Port      Name               Status       Vlan       Duplex  Speed Type
    Fa0/1                        connected    1          auto    auto  10/100BaseTX
    Fa0/2                        connected    1          auto    auto  10/100BaseTX
    Fa0/3                        notconnect   1          auto    auto  10/100BaseTX
    Fa0/4                        notconnect   1          auto    auto  10/100BaseTX
    Fa0/5                        notconnect   1          auto    auto  10/100BaseTX
    Fa0/6                        notconnect   1          auto    auto  10/100BaseTX
    Fa0/7                        notconnect   1          auto    auto  10/100BaseTX
    Fa0/8                        notconnect   1          auto    auto  10/100BaseTX
    Fa0/9                        notconnect   1          auto    auto  10/100BaseTX
    Fa0/10                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/11                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/12                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/13                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/14                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/15                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/16                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/17                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/18                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/19                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/20                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/21                       notconnect   1          auto    auto  10/100BaseTX
    
    sw1#
    

IPアドレスを設定する

  • インターフェイスに対して設定します
  • タイプとポートを指定します
  • タイプ
    • Ethernet / 10Mbps
    • FastEthernet / 100Mbps
    • GigabitEthernet / 1Gbps
    • Loopback / 自分自身
  • ポート
    • インターフェイス番号を指定
    • 0、1のようなもの、0/0のようにスロット番号/インターフェイス番号のような形式で指定する場合もある
  1. 設定対象のインターフェイスを確認します

    MultiLayerSwitch(config)#do show interface
    FastEthernet0/1 is up, line protocol is up (connected)
      Hardware is Lance, address is 0090.2110.c701 (bia 0090.2110.c701)
      MTU 1500 bytes, BW 100000 Kbit, DLY 1000 usec,
         reliability 255/255, txload 1/255, rxload 1/255
      Encapsulation ARPA, loopback not set
      Keepalive set (10 sec)
      Full-duplex, 100Mb/s
      input flow-control is off, output flow-control is off
      ARP type: ARPA, ARP Timeout 04:00:00
      Last input 00:00:08, output 00:00:05, output hang never
      Last clearing of "show interface" counters never
      Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
      Queueing strategy: fifo
      Output queue :0/40 (size/max)
      5 minute input rate 0 bits/sec, 0 packets/sec
      5 minute output rate 0 bits/sec, 0 packets/sec
         956 packets input, 193351 bytes, 0 no buffer
         Received 956 broadcasts, 0 runts, 0 giants, 0 throttles
         0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
         0 watchdog, 0 multicast, 0 pause input
         0 input packets with dribble condition detected
         2357 packets output, 263570 bytes, 0 underruns
    
    MultiLayerSwitch(config)#do show interface status
    Port      Name               Status       Vlan       Duplex  Speed Type
    Fa0/1                        connected    1          auto    auto  10/100BaseTX
    Fa0/2                        connected    1          auto    auto  10/100BaseTX
    Fa0/3                        notconnect   1          auto    auto  10/100BaseTX
    Fa0/4                        notconnect   1          auto    auto  10/100BaseTX
    Fa0/5                        notconnect   1          auto    auto  10/100BaseTX
    Fa0/6                        notconnect   1          auto    auto  10/100BaseTX
    Fa0/7                        notconnect   1          auto    auto  10/100BaseTX
    Fa0/8                        notconnect   1          auto    auto  10/100BaseTX
    Fa0/9                        notconnect   1          auto    auto  10/100BaseTX
    Fa0/10                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/11                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/12                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/13                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/14                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/15                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/16                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/17                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/18                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/19                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/20                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/21                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/22                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/23                       notconnect   1          auto    auto  10/100BaseTX
    Fa0/24                       notconnect   1          auto    auto  10/100BaseTX
    Gig0/1                       notconnect   1          auto    auto  10/100BaseTX
    Gig0/2                       notconnect   1          auto    auto  10/100BaseTX
    
    MultiLayerSwitch(config)#
    
  2. interfaceコマンドを実行し切り替えます

    MultiLayerSwitch(config)#interface FastEthernet 0/1
    MultiLayerSwitch(config)#
    
  3. no switchportを実行します。※本デモ環境はスイッチのため、Layer 2(L2)ポートではIPアドレスを設定できないので切り替えます

    MultiLayerSwitch(config-if)#no switchport
    MultiLayerSwitch(config-if)#
    
  4. ip addressコマンドにより、IPアドレスを設定します

    MultiLayerSwitch(config-if)#ip address 192.168.1.1 255.255.255.0
    MultiLayerSwitch(config-if)#
    
  5. no shutdownコマンドによりインターフェイスを有効化します

    MultiLayerSwitch(config-if)#no shutdown
    MultiLayerSwitch(config-if)#
    
  6. 設定を確認します。設定が反映されていました

    MultiLayerSwitch#show running-config | section FastEthernet0/1
    interface FastEthernet0/1
     no switchport
     ip address 192.168.1.1 255.255.255.0
     duplex auto
     speed auto
    interface FastEthernet0/10
    interface FastEthernet0/11
    interface FastEthernet0/12
    interface FastEthernet0/13
    interface FastEthernet0/14
    interface FastEthernet0/15
    interface FastEthernet0/16
    interface FastEthernet0/17
    interface FastEthernet0/18
    interface FastEthernet0/19
    MultiLayerSwitch#
    
    
    MultiLayerSwitch#show ip interface brief
    Interface              IP-Address      OK? Method Status                Protocol 
    FastEthernet0/1        192.168.1.1     YES manual up                    up 
    FastEthernet0/2        unassigned      YES NVRAM  up                    up 
    FastEthernet0/3        unassigned      YES NVRAM  down                  down 
    FastEthernet0/4        unassigned      YES NVRAM  down                  down 
    FastEthernet0/5        unassigned      YES NVRAM  down                  down 
    FastEthernet0/6        unassigned      YES NVRAM  down                  down 
    FastEthernet0/7        unassigned      YES NVRAM  down                  down 
    FastEthernet0/8        unassigned      YES NVRAM  down                  down 
    FastEthernet0/9        unassigned      YES NVRAM  down                  down 
    FastEthernet0/10       unassigned      YES NVRAM  down                  down 
    FastEthernet0/11       unassigned      YES NVRAM  down                  down 
    FastEthernet0/12       unassigned      YES NVRAM  down                  down 
    FastEthernet0/13       unassigned      YES NVRAM  down                  down 
    FastEthernet0/14       unassigned      YES NVRAM  down                  down 
    FastEthernet0/15       unassigned      YES NVRAM  down                  down 
    FastEthernet0/16       unassigned      YES NVRAM  down                  down 
    FastEthernet0/17       unassigned      YES NVRAM  down                  down 
    FastEthernet0/18       unassigned      YES NVRAM  down                  down 
    FastEthernet0/19       unassigned      YES NVRAM  down                  down 
    FastEthernet0/20       unassigned      YES NVRAM  down                  down 
    FastEthernet0/21       unassigned      YES NVRAM  down                  down 
    FastEthernet0/22       unassigned      YES NVRAM  down                  down 
    FastEthernet0/23       unassigned      YES NVRAM  down                  down 
    FastEthernet0/24       unassigned      YES NVRAM  down                  down 
    GigabitEthernet0/1     unassigned      YES NVRAM  down                  down 
    GigabitEthernet0/2     unassigned      YES NVRAM  down                  down 
    Vlan1                  unassigned      YES NVRAM  administratively down down
    MultiLayerSwitch#
    

デフォルトに戻す

  • 実行前の状態
    SW0#show running-config | section FastEthernet0/1
    interface FastEthernet0/1
     no switchport
     no ip address
     duplex auto
     speed auto
    interface FastEthernet0/10
    

ルーティング

ルーティングテーブルを確認する

  • 特権モードで、show ip routeを実行します
    MultiLayerSwitch#show ip route
    Default gateway is not set
    
    Host               Gateway           Last Use    Total Uses  Interface
    ICMP redirect cache is empty
    
    MultiLayerSwitch#
    

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?