カテゴリ:

IOSで利用するコマンドの多くは省略した形で利用できます。例えば"show running-config"は"sh run"に、"configure terminal"は"conf t"で代用できます。この省略形に馴れることで入力の手間を大幅に減らすことが出来ます。

もう一つ便利な方法にdoコマンドがあります。通常、設定以後はshowコマンドで設定を確認しますが、特権モードに戻るのが手間です。しかしdoコマンドを使えば、設定中のモードでそのままshowコマンドなどを実行できます。例えば"do sh run"の様に実行します。

下記はripの設定を認証を含め設定しています。まず全く省略せず、doコマンドを使わない例です。

R1#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.12.1    YES manual up                    up      
FastEthernet0/1            unassigned      YES unset  administratively down down   
Serial1/0                  unassigned      YES unset  administratively down down   
Serial1/1                  unassigned      YES unset  administratively down down   
Serial1/2                  unassigned      YES unset  administratively down down   
Serial1/3                  unassigned      YES unset  administratively down down   
Loopback0                  192.168.1.1     YES manual up                    up      
R1#configure terminal
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#network 192.168.12.1
R1(config-router)#network 192.168.1.1
R1(config-router)#^Z
R1#show ip protocols
Routing Protocol is "rip"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Sending updates every 30 seconds, next due in 16 seconds
  Invalid after 180 seconds, hold down 180, flushed after 240
  Redistributing: rip
  Default version control: send version 2, receive version 2
    Interface             Send  Recv  Triggered RIP  Key-chain
    FastEthernet0/0       2     2                    RIP            
    Loopback0             2     2                                    
  Automatic network summarization is not in effect
  Maximum path: 4
  Routing for Networks:
    192.168.1.0
    192.168.12.0
  Routing Information Sources:
  1  Gateway         Distance      Last Update
    192.168.12.2         120      00:00:15
  Distance: (default is 120)

R1#configure terminal
R1(config)#key chain RIP
R1(config-keychain)#key 1
R1(config-keychain-key)#key-string CISCO
R1(config-keychain-key)#^Z
R1#show key chain RIP
Key-chain RIP:
    key 1 -- text "CISCO"
        accept lifetime (always valid) - (always valid) [valid now]
        send lifetime (always valid) - (always valid) [valid now]

R1#configure terminal
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip rip authentication key-chain RIP
R1(config-if)#ip rip authentication mode md5
R1(config-if)#^Z
R1#debug ip rip
RIP protocol debugging is on

Feb  4 05:57:23.275: RIP: received packet with MD5 authentication
Feb  4 05:57:23.275: RIP: received v2 update from 192.168.12.2 on FastEthernet0/0
Feb  4 05:57:23.279:      192.168.2.0/24 via 0.0.0.0 in 1 hops
〜略〜

R1#show ip rou rip
R    192.168.2.0/24 [120/1] via 192.168.12.2, 00:00:08, FastEthernet0/0

次に省略形とdoコマンドを併用する例です。大幅に簡略化され、高速に実行出来ることが理解できると思います。

R1#sh ip int b
Interface                  IP-Address      OK? Method Status                Protocol
〜略〜
R1#conf t
R1(config)#router rip
R1(config-router)#no au
R1(config-router)#ver 2
R1(config-router)#net 192.168.12.1
R1(config-router)#net 192.168.1.1
R1(config-router)#do sh ip pro
Routing Protocol is "rip"
〜略〜
R1(config-router)#key ch RIP
R1(config-keychain)#ke 1
R1(config-keychain-key)#key-s CISCO
R1(config-keychain-key)#do sh ke ch RIP
Key-chain RIP:
〜略〜
R1(config-if)#ip rip aut ke RIP
R1(config-if)#ip rip aut m m
R1(config-if)#do deb ip rip
R1(config-if)#do sh ip rou rip
R    192.168.2.0/24 [120/1] via 192.168.12.2, 00:00:13, FastEthernet0/0