LoginSignup
2
1

More than 1 year has passed since last update.

【2022年版】Cisco ルータ コマンド メモ

Last updated at Posted at 2022-06-04

Cisco ルータ コマンド メモ

設定モードへ

>enable

共通設定

  • ドメイン名を引かせない(コマンドをミスタイプすると名前解決しようとする不便を解決)
(config)#no ip domain-lookup

設定保存

現在の設定を起動時設定に保存

#copy running-config startup-config

パスワード設定

(config)#enable password {password}

ユーザ設定/作成

(config)#username {username} password {password}

ホスト名・ドメイン名・NTP・DNS設定

(config)#hostname {hostname}
(config)#ip domain-name {domain-name}
(config)#ntp server {ntp ip address}
(config)#ip name-server {dns ip address}

web(http/https)サーバ無効化

(config)#no ip http server
(config)#no ip http secure-server

IPアドレス設定

(config)#interface {interface}
(config-if)#ip address {ip address} {subnetmask}

ssh設定

(config)#ip access-list standard permit-ssh
(config-std-nacl)#permit {ip address}
(config-std-nacl)#exit
(config)#line vty 0 15
(config-line)#login local
(config-line)#access-class permit-ssh in
(config-line)#transport input ssh
(config-line)#transport output none
(config-line)#exit
(config)#crypto key generate rsa
How many bits in the modulus [512]: 2048
% Generating 2048 bit RSA keys, keys will be non-exportable...[OK]
(config)#ip ssh version 2
  • password は secret を使うことを推奨
  • route のsshクライアント機能を利用する場合は、transport output ssh に変更する

ルーティングテーブル確認

>show ip route

ルーティングテーブル設定

(config)#ip route {ip} {subnet} {interface}

デフォルトゲートウェイの設定

(config)#ip route 0.0.0.0 0.0.0.0 {gateway ip address}

アクセスリストの設定

  • 利用できる標準アクセスリスト番号
    1〜99
    1300〜1999

  • 利用できる拡張アクセスリスト番号
    100〜199
    2000〜2699

  • アクセスリストの確認

#show ip access-list
#show ip interface {interface}

バナー設定

(config)#banner motd #

pat/napt/IPマスカレードの設定

  • 内側のインターフェイスの設定
(config)#interface {interface}
(config-if)#ip nat inside
  • 外側のインターフェイスの設定
(config)#interface {interface}
(config-if)#ip nat outside
  • アドレスプールの設定(patなので1つ)
(config)#ip nat pool patpool {outside interface ip} {outside interface ip} netmask 255.255.255.0
  • アクセスリストの設定
(config)#access-list {1 - 99} permit {access allow ip} {access allow length}
  • アクセスリストの番号 10 を 192.168.0.0/24 を範囲とする場合
(config)#access-list 10 permit 192.168.0.0 0.0.0.255
  • アクセスリストをプールにマッピング
(config)#ip nat inside source list {access list number} pool patpool overload
  • NATテーブルの確認
#show ip nat translations

コマンド編集機能

コマンド 結果
ctrl a カーソルを行頭へ
ctrl e カーソルを行末へ
ctrl f カーソルを1文字すすむ
ctrl b カーソルを1文字もどる
esc f カーソルを1単語すすむ
esc b カーソルを1単語もどる
ctrl d カーソルの右側の1文字を削除(DELETE)
ctrl x カーソルから右側を全て削除
ctrl k カーソルから左側を全て削除
ctrl w カーソルの左側の1単語を削除
ctrl u 行の削除
ctrl r 行の再表示
ctrl p ひとつ前のコマンドを表示
ひとつ前のコマンドを表示
ctrl n ひとつ先のコマンドを表示
ひとつ先のコマンドを表示

macからルータへの接続

  • consoleへ物理的に接続する
  • インターフェイスの確認、usbserialのインターフェイスがルータへの接続
% ls -l /dev/tty.usbserial*
  • インターフェイスへの接続
% screen /dev/tty.usbserial-{確認した値}

Cisco IOSのダウンロード

2
1
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
2
1