Cisco 基本コマンド2 | ちゃぶのブログ

Cisco 基本コマンド2

■Cisco 基本設定コマンド


///初期設定及び、インタフェース設定///

■ホスト名を指定

switch(config)# hostname switch1

■バナーを設定する

switch1(config)# banner motd #
this switch is test switch!
#

■インターフェイスにIPアドレスおよびサブネットマスクを設定

switch1(config)# interface ethernet0
switch1(config-if)# ip address 192.168.9.253 255.255.255.0
switch1(config-if)# no shutdown

■インターフェースに説明文をつける

switch1(config)# int e0
switch1(config-if)# description switch2-Link

■インターフェースの速度変更

switch1(config)# int e0
switch1(config-if)#speed {10|100|auto}

■インターフェースのduplex変更

switch1(config)# int e0
switch(config-if)#duplex {auto|full|half}

■スイッチポートモードを設定

switch1(config)# int e0
switch(config-if)#switchport mode {access|dynamic {auto|desirable}|trunk}

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

switch1(config)# ip route 0.0.0.0 0.0.0.0 192.168.9.254
switch1(config)#ip classless

※L2スイッチの場合
switch1(config)# ip default-gateway 192.168.9.254

■スタティックルートを設定

switch1(config)#ip route 10.129.0.0 255.255.0.0 192.168.1.254



///パスワードの設定///

■特権モードのパスワードを指定(暗号化)

switch1(config)# enable secret xxxxxxxxxx

■telnetパスワードの変更

switch1#conf t
switch1(config)#line vty 0 4
switch1(config)#login
switch1(config)#password xxxxxxxxxx

■コンソールへのパスワードの設定

switch1#conf t
switch1(config)#line console 0
switch1(config-line)#login
switch1(config-line)#password xxxxxxxxxx

■パスワードを手動で暗号化する

switch1#conf t
switch1(config)#service password-encryption


///時刻合わせ///

■NTPの設定

switch1#conf t
switch1(config)#ntp update-calendar
switch1(config)#ntp server 133.100.9.2

■手動設定

switch1#conf t
switch1(config)#clock timezone JST +9
switch1(config)#exit
switch1#clock set 16:00:00 1 Jan 2003

■サマータイム設定
switch1#conf t
switch1(config)#clock summer-time EST recurring first sunday april 2:00 last sunday october 2:00 1


///名前解決///

■デフォルトのDNS参照を止める

switch1(config)# no ip domain-lookup

■名前解決にDNSを使う

switch1(config)# ip domain-lookup
switch1(config)# ip name-server 192.168.0.3
switch1(config)# ip domain-name tk-net.dip.jp


///ロギング///

■syslogサーバの設定

switch1(config)# logging 192.168.0.100


///その他///

■アクセスの唯一の手段としてSSHを設定する

switch1(config)#ip domain-name tk-net.dip.jp
switch1(config)#aaa new-model ←SSH接続用のAAA認証を有効にする
switch1(config)#username cisco password cisco ←SSHセッション用のローカルユーザ名とパスワードを設定する
switch1(config)#crypto key generate rsa modulus 2048
The name for the keys will be: switch1.tk-net.dip.jp

% The key modulus sixe is 2048 bits
Generating RSA keys ...
{OK}

00:02:36: %SSH-5-ENABLED: SSH 1.5 has been enabled
switch1(config)#line vty 0 15
switch1(config)#transport input ssh