*[[Cisco]]/CaseStudy [#vaeacfb7] #contents **設定の初期化 [#w21a3287] ルータやスイッチを初期化するには、スタートアップコンフィグとVLANデータを消去して再起動する。~ 誤って「del flash:」と入力するとIOSが削除されるので慎重に作業すること。~ GNS3でreloadするとハングアップするので、GUIから電源を切り入れする。~ Ro-E#erase start Erasing the nvram filesystem will remove all files! Continue? [confirm] ←Enterキーを押して実行 [OK] Erase of nvram: complete Ro-E# Ro-E#dir (あるいは#sh flash:) Directory of flash:/ 1 -rw- 12054760 <no date> c2600-advsecurityk9-mz.123-12.bin 2 -rw- 720 <no date> vlan.dat 33554428 bytes total (21498820 bytes free) Ro-E# Ro-E#del flash:vlan.dat Delete filename [vlan.dat]? ←Enterキーを押して実行 Delete flash:vlan.dat? [confirm] ←Enterキーを押して実行 Ro-E# Ro-E#reload ←スタートアップコンフィグの再読み込み=再起動 Proceed with reload? [confirm] ←Enterキーを押して実行 00:06:06: %SYS-5-RELOAD: Reload requested System Bootstrap, Version 12.2(7r)XM2, RELEASE SOFTWARE (fc1) TAC Support: http://www.cisco.com/tac Copyright (c) 2003 by cisco Systems, Inc. (以下略) ~ ~ **初回電源投入時および設定初期化後 [#t398238c] 「no」を選択して対話型セットアップモードに入らないようにする。~ --- System Configuration Dialog --- Would you like to enter the initial configuration dialog? [yes/no]: n ←入力 Press RETURN to get started! (中略) Router> ~ ~ **割り込みコンソール入力の再表示 [#iedd2152] R1# conf t R1(config)# line con 0 R1(config-line)#logging sync R1(config-line)#end R1# sh *Mar 1 00:28:01.499: %SYS-5-CONFIG_I: Configured from console by console R1# sh ←上の入力中のコマンドが再表示される ~ ~ **出力結果から特定の文字列を含む行を抽出 [#o6b8d683] R1# sh run | i log service timestamps log datetime msec logging synchronous login ~ 詳細 http://www.cisco.com/japanese/warp/public/3/jp/service/manual_j/sec/asa/sacr/chapter01/6935_02_1.shtml#21634~ ~ ~ **名前解決を無効に設定 [#fd3ec8b2] R1# conf t R1(config)# no ip domain-lookup R1(config)# end DNSサーバを未設定のまま間違えたコマンドを入力すると、DNSサーバとタイムアウトまでコマンドの入力ができなくなる。~ DNSサーバが存在しない場合、DNSサーバへの問い合わせを禁止する。~ ~ **タイムアウト時間変更 [#y9ebef97] R1# exec-timeout R1# conf t R1(config)# line con 0 R1(config-line)#exec-t 20 30 R1(config-line)#end R1# sh run | i exec exec-timeout 20 30 「 exec-timeout 0」でタイムアウトが無効になる。~ ~ ~ **内蔵時計を日本時間に設定 [#fb2d9757] R1# clock timezone *00:34:39.515 UTC Mon Mar 1 1993 R1# conf t R1(config)# clo time JST 9 R1(config)# end R1# sh clo *09:35:14.263 JST Mon Mar 1 1993 ~ ~ **内蔵時計の日時を合わせる [#l1b8d2f1] clock set R1# clo set 23:09:00 ? <1-31> Day of the month MONTH Month of the year R1# clo set 23:10:00 08 December 2010 R1# sh clo 23:10:49.435 JST Wed Dec 8 2010 ~ ~ **特権モードパスワードの設定 [#a43cc791] enable { password | secret } 特権モードへ移行するためのパスワードを「CCNA」に設定(暗号化なし)。~ R1(config)# enable pass CCNA ~ 特権モードへ移行するためのパスワードを「cisco」に設定(暗号化あり)。~ enableパスワードと両方を設定するとこちらが有効になる。~ R1(config)# enable sec cisco ~ 設定を確認。secretパスワードは暗号化されて表示される。~ R1# sh run | b pass no service password-encryption (中略) ! enable secret 5 $1$iERE$9xpYq9fkKNDJC03aKyg8A. enable password CCNA (後略) 別の機器で同じパスワードを設定しても、secretパスワードは同じようには表示されない。~ R2# sh run | b pass (中略) ! enable secret 5 $1$U7C5$8.b9qSZwLuQ37L/.wuOaI. enable password CCNA ~ enableパスワードとsecretパスワードを同じにすることはできるが、適用時に注意される。~ R1(config)# enable sec CCNA The enable secret you have chosen is the same as your enable password. This is not recommended. Re-enter the enable secret. ~ ~ **ログインパスワードの設定 [#o6559b5e] password コンソールやtelnetでログインするためのパスワードを「cisco」に設定する。~ vtyパスワードを設定しないとtelnetからのログインは拒否される。~ vtyは複数のセッションが張れるので終了番号も指定する。~ R1(config)# line con 0 R1(config-line)# password cisco R1(config-line)# login ←パスワードの有効化を忘れずに! R1(config-line)# login R1(config-line)# line vty 0 4 R1(config-line)# pass cisco R1(config-line)# login ←同上 R1(config-line)# login R1(config-line)# exec-timeout 0 0 R1(config-line)# end R1# sh run | b line line con 0 exec-timeout 0 0 password cisco logging synchronous login line aux 0 line vty 0 4 exec-timeout 0 0 password cisco login ! (以下略) ~ コンソールパスワードを取り消す。~ R1(config)# line con 0 R1(config-line)# no pass ←no passwordでパスワードが消去される R1(config-line)# login ←パスワードが消去されたか確認 % Login disabled on line 0, until 'password' is set ~ **パスワードの暗号化 [#w7eb0381] service password-encryption show run実行時にsecret以外のパスワードの表示も暗号化させる。~ R1(config)# service password-encryption R1(config)# end R1# sh run Building configuration... Current configuration : 1158 bytes ! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec service password-encryption ←パスワードの暗号化を有効化 (中略) ! enable secret 5 $1$iERE$9xpYq9fkKNDJC03aKyg8A. enable password 7 112A3A2B36 (中略) ! line con 0 exec-timeout 0 0 password 7 00071A150754 logging synchronous login line aux 0 line vty 0 4 password 7 0822455D0A16 login ! ! end ~ サービスを停止しても既存のパスワードは平文には戻らない。~ サービス停止後に新規入力されたものは平文で表示される。~ R1(config)# no service password-encryption R1(config)# end R1# sh run (中略) no service password-encryption (中略) enable secret 5 $1$iERE$9xpYq9fkKNDJC03aKyg8A. enable password 7 112A3A2B36 ~ **インターフェースにIPアドレスを設定 [#x1584104] R1(config-if)# ip address [IPアドレス] [サブネットマスク] R1のFastEthernet0/1に192.168.1.1/24を設定する。~ R1# conf t R1(config)# int fa0/1 R1(config-if)# ip add 192.168.1.1 255.255.255.0 R1(config-if)# no shut ←no shutdownでインタフェースを有効にする R1(config-if)# end R1# sh int fa0/1 FastEthernet0/1 is up, line protocol is up Hardware is AmdFE, address is c806.0b70.0001 (bia c806.0b70.0001) Internet address is 192.168.1.1/24 MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, reliability 255/255, txload 1/255, rxload 1/255 (後略) ~ ~ **インタフェースのIPアドレスを手早く再設定 [#pfe04250] +#show run でrunning-configを表示~ +fa0/0の箇所が表示されたら「q」またはCtrl+Cで表示を停止~ +conf t でグローバルコンフィグレーションモードへ~ +int fa0/0 でfa0/0のインターフェースコンフィグレーションモードへ~ +no ipaddressで設定を削除~ +ip addressコマンドで再設定する際、さきほどshow runで表示した内容を適切にコピーアンドペーストしながら新しい設定を入力する~ +endまたはCtrl+Cで特権モードに戻る~ +show runで正しく修正できていることを確認したら#cop r sでスタートアップコンフィグに保存~ ~ ~ **インターフェースのデフォルトの帯域幅とカプセル化方式 [#c5fce6ad] |インターフェース|帯域幅|カプセル化方式| |Ethernet|10Mbps&br;(10000Kbps)|ARPA| |Fast Ethernet|10Mbps&br;(100000Kbps)|ARPA| |Gigabit Ehternet|10Mbps&br;(1000000Kbps)|ARPA| |Serial|1.544Mbps&br;(1544Kbps)|HDLC| R1# show interface e1/0 Ethernet1/0 is up, line protocol is up Hardware is AmdP2, address is c80f.0380.0010 (bia c80f.0380.0010) Internet address is 10.1.1.1/30 MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec, ←BW(帯域幅)が10000KbpsなのでEthernet(10baseT) reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set ←ARPAなのでEthernet (以下略) ~ ~ **シリアルインターフェースs0のクロックレートを「64000bps」に設定 [#p3a7e159] Router# configure terminal Router(config)# interface serial 0 Router(config-if)# clock rate 64000 Router(config-if)# nd ~ ~ **シリアルインターフェースs0の論理帯域幅を「64kbps」に設定 [#u559ba30] Router# configure terminal Router(config)# interface serial 0 Router(config-if)# bandwidth 64 Router(config-if)# end ~ ~ **ルータのインタフェースの状態を確認 [#y82dd799] show ip interface brief StatusとProtocolの結果に注意する~ R1# show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 192.168.1.1 YES NVRAM up up Serial0/0 10.0.0.1 YES manual up down FastEthernet0/1 unassigned YES unset administratively down down Serial0/1 unassigned YES unset administratively down down Ethernet1/0 172.16.1.1 YES manual up up ~ |CENTER:BGCOLOR(#f0f8ff):Status|CENTER:BGCOLOR(#f0f8ff):Protocol|CENTER:BGCOLOR(#f0f8ff):状態| |up|up|正常| |up|down|物理層正常、リンク層異常、イーサネットケーブル間違い※| |administratively down|down|インタフェースがshutdown| |down|down|物理層異常| ※CCNAの教科書ではケーブル間違いはdown-downと書かれているが、実際はup-downであることが多い~ ~ ~ **インターフェース毎のハードウェア情報 [#q6c2f19d] show controllers シリアルの接続ケーブルの種類と、バックツーバック接続時にインタフェースがDCEまたはDTEなのか確認する。~ R1# show controllers s0/0 Interface Serial0/0 Hardware is PowerQUICC MPC860 DCE 530, no clock ←DCE/DTEとケーブルが表示される(※GNS3では正しい結果にならない) idb at 0x82089F6C, driver data structure at 0x82091D00 (以下略) ~ 隣接Cisco機器の簡易情報を表示~ Router# show cdp neighbors ~ 隣接Cisco機器の詳細情報を表示~ Router# show cdp neighbors detail ~ **ルータに静的経路を設定 [#b2fd838b] ip route ポイント:~ - ルータを静的にルーティングすると、ルーターの負荷やネットワークへのトラフィックを減少できる。~ - 必要な経路をすべて設定しなければならないので、複雑なネットワークには向かない。 - 経路の変更や障害時に管理者が経路を再入力しなければならない。~ ~ 検証:~ ~ 10.1.1.0/30 10.1.1.4/30 192.168.1.0/25 192.168.1.128/25~ ┏━━━┓ ┏━━━┓ ┏━━━┓ ~ ────┨ R1 ┠─────┨ R2 ┠─────┨ R3 ┠───~ ┗━━━┛ ┗━━━┛ ┗━━━┛ ~ R1:fa0/0 10.1.1.2/30 fa0/1 10.1.1.5/30~ R2:fa0/0 10.1.1.6/30 fa0/1 192.168.1.1/25~ R3:fa0/0 192.168.1.2/25 fa0/1 192.168.1.129/25~ ~ ~ R1に、192.168.1.0が10.1.1.6の向こうに接続されていることをルーティングテーブルに設定する。 R1# conf t R1(config)# ip route 192.168.1.0 255.255.255.128 10.1.1.6 ←192.168.1.0/25へは10.1.1.6を経由 R1(config)# end ~ 経路情報を確認するにはshow ip routeコマンドを使用する。~ R1# sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/30 is subnetted, 2 subnets C 10.1.1.0 is directly connected, FastEthernet0/0 C 10.1.1.4 is directly connected, FastEthernet0/1 192.168.1.0/25 is subnetted, 1 subnets S 192.168.1.0 [1/0] via 10.1.1.6 ~ 同様にR3も10.1.1.4/30への経路を設定する。~ R3# conf t R3(config)# ip route 10.1.1.4 255.255.255.252 192.168.1.1 R3(config)# end R3# sh ip route (中略) 10.0.0.0/30 is subnetted, 1 subnets S 10.1.1.4 [1/0] via 192.168.1.1 192.168.1.0/25 is subnetted, 2 subnets C 192.168.1.0 is directly connected, FastEthernet0/0 C 192.168.1.128 is directly connected, FastEthernet0/1 ~ R2には192.168.2.0と172.16.3.0が直接接続されているので、経路情報を追加する必要はない。~ R2# sh ip route (中略) 10.0.0.0/30 is subnetted, 1 subnets C 10.1.1.4 is directly connected, FastEthernet0/0 192.168.1.0/25 is subnetted, 1 subnets C 192.168.1.0 is directly connected, FastEthernet0/1 ~ pingで疎通を確認する。~ R1# ping 192.168.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 28/46/84 ms R3# ping 10.1.1.5 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.5, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 32/43/88 ms ~ ~ R1とR3の疎通が確認できたら、R2に10.1.1.0/30と192.168.1.128/25への経路を設定する。~ R2# conf t R2(config)# ip route 10.1.1.0 255.255.255.252 10.1.1.5 R2(config)# ip route 192.168.1.128 255.255.255.128 192.168.1.2 R2(config)# end R2# sh ip route (中略) 10.0.0.0/30 is subnetted, 2 subnets S 10.1.1.0 [1/0] via 10.1.1.5 C 10.1.1.4 is directly connected, FastEthernet0/0 192.168.1.0/25 is subnetted, 2 subnets C 192.168.1.0 is directly connected, FastEthernet0/1 S 192.168.1.128 [1/0] via 192.168.1.2 R2# ping 10.1.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 8/24/48 ms R2# ping 192.168.1.129 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.1.129, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 12/24/56 ms ~ これらの設定だけではR1から192.168.1.128/25へ、またはR3から10.1.1.0/30への通信はできない。~ R1# ping 192.168.1.129 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.1.129, timeout is 2 seconds: ..... Success rate is 0 percent (0/5) R3# ping 10.1.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds: ..... Success rate is 0 percent (0/5) ~ 次のデフォルトルートと組み合わせて動作を確認する。~ ~ ~ **デフォルトルートの設定 [#o73c769e] ~ ポイント:~ - 宛先ネットワークがルーティングテーブルに登録されていない場合使用する特別なルート。 - ip classressが有効になっている場合のみ機能する。 ~ 検証:~ ~ 10.1.1.0/30 10.1.1.4/30 192.168.1.0/25 192.168.1.128/25~ ┏━━━┓ ┏━━━┓ ┏━━━┓ ~ ────┨ R1 ┠─────┨ R2 ┠─────┨ R3 ┠───~ ┗━━━┛ ┗━━━┛ ┗━━━┛ ~ ~ R1:fa0/0 10.1.1.2/30 fa0/1 10.1.1.5/30~ R2:fa0/0 10.1.1.6/30 fa0/1 192.168.1.1/25~ R3:fa0/0 192.168.1.2/25 fa0/1 192.168.1.129/25~ すべてのルータに1ホップの静的経路を設定済み~ ~ ~ 設定には3つの方法がある。~ 送信インタフェースを指定して設定する場合は、インタフェースがピアトゥピア接続であること。(スイッチを介した転送先に同じ名前のインタフェースが3つ以上あると、相手を特定できなくなるため)~ ラストリゾートについてはhttp://www.cisco.com/JP/support/public/ht/tac/100/1008507/default-j.shtmlを参照。~ R1(config)# ip route 0.0.0.0 0.0.0.0 10.1.1.6 ←ネクストホップのIPアドレス R3(config)# ip route 0.0.0.0 0.0.0.0 f0/0 ←送信インタフェース R2(config)# ip default-network [ネットワークアドレス] (ラストリゾートの設定に使用) ~ R1とR3で、ip classressが有効であることを確認し、デフォルトルートを設定する。~ R1# sh run | i class ip classless R1# conf t R1(config)# ip route 0.0.0.0 0.0.0.0 10.1.1.6 R1(config)# R1(config)# end R3# sh run | i class ip classless R3# conf t R3(config)# ip route 0.0.0.0 0.0.0.0 f0/0 R3(config)# end ~ pingが飛ぶことを確認する。~ R1# ping 192.168.1.129 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.1.129, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 28/48/100 ms R3# ping 10.1.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 32/41/60 ms ~ ~ **フレームリレーによるルーター間の接続 [#he3e835c] ポイント:~ - DLCIは接続するフレームリレースイッチのインターフェースの設定に合わせる。 - フレームリレースイッチとはサブインターフェースで通信する。(1対多が可能) ~ ~ 検証:~ - GNS3で検証する際はR1とR2を同じフレームリレースイッチに接続する。またデバイス間の配線を済ませてからルーターを起動する。 - 実機を設定する場合、クロックレート等の設定も必要となる。http://www.infraexpert.com/study/framerelay7.htm ~ (PVC)10.1.1.0/30~ ┏━━━┓ ┏━━━┓ ┏━━━┓~ ────┨ R1 ┠──────┨ FR1 ┠──────┨ R2 ┠────~ ┗━━━┛ ┗━━━┛ ┗━━━┛~ ~ FR1:Port1 dlci:100 Port2 dlci:200~ R1:s0/0 no ip address s0/0.1 10.1.1.1/30~ R2:s0/0 no ip address s0/0.1 10.1.1.2/30~ ~ ~ 初期状態ではs0/0にIPアドレスが振られていても、疎通はない。~ R1# sh run Building configuration... (中略) interface Serial0/0 ip address 10.1.1.1 255.255.255.0 (後略) R2# sh run Building configuration... (中略) interface Serial0/0 ip address 10.1.1.2 255.255.255.0 (後略) R1# ping 10.1.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds: ..... Success rate is 0 percent (0/5) ~ フレームリレーを設定する。~ R1# conf t R1(config)# int s0/0 R1(config-if)# no ip address ←IPアドレスを削除 R1(config-if)# encapsulation frame-relay ←カプセル化タイプにフレームリレーを指定 R1(config-if)# frame-relay lmi-type ansi ←IOS 11.2以降不要(自動認識) R1(config-if)# exit R1(config)# int s0/0.1 point-to-point R1(config-subif)#ip address 10.1.1.1 255.255.255.252 R1(config-subif)#no shutdown R1(config-subif)#frame-relay interface-dlci 100 R1(config-fr-dlci)#end R2# conf t R2(config)# int s0/0 R2(config-if)# no ip address R2(config-if)# encapsulation frame-relay R2(config-if)# frame-relay lmi-type ansi R2(config-if)# exit R2(config)# int s0/0.1 point-to-point R2(config-subif)#ip address 10.1.1.2 255.255.255.252 R2(config-subif)#no shutdown R2(config-subif)#frame-relay interface-dlci 200 R2(config-fr-dlci)#end ~ 設定と疎通を確認する。~ R1# sh run Building configuration... (中略) interface Serial0/0 no ip address encapsulation frame-relay frame-relay lmi-type ansi ! interface Serial0/0.1 point-to-point ip address 10.1.1.1 255.255.255.252 frame-relay interface-dlci 100 (後略) R1# sh int s0/0 Serial0/0 is up, line protocol is up Hardware is PowerQUICC Serial MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation FRAME-RELAY, loopback not set ←カプセル化タイプはフレームリレー Keepalive set (10 sec) (後略) R2# sh run Building configuration... (中略) interface Serial0/0 no ip address encapsulation frame-relay frame-relay lmi-type ansi ! interface Serial0/0.1 point-to-point ip address 10.1.1.2 255.255.255.252 frame-relay interface-dlci 200 (後略) R2# sh int s0/0 Serial0/0 is up, line protocol is up Hardware is PowerQUICC Serial MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation FRAME-RELAY, loopback not set Keepalive set (10 sec) (後略) R1# ping 10.1.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/22/84 ms ~ ~ **PPPによるルーター間の接続 [#t080f725] ポイント:~ - PPPによるシリアル回線での接続、およびCHAPによる認証を設定する。 - PPPの設定で、ユーザー名は対向ルーターのホスト名、パスワードは対向ルーターと共通にする。 ~ ~ 検証:~ ~ 10.1.1.0/30~ ┏━━━┓ ┏━━━┓~ ────┨ R1 ┠────────┨ R2 ┠────~ ┗━━━┛ ┗━━━┛~ ~ R1:s0/0 10.1.1.1/30~ R2:s0/0 10.1.1.2/30~ ~ ~ R1# conf t R1(config)# username R2 password cisco ←ユーザー名は対向ルーターのホスト名 R1(config)# int s0/0 R1(config-if)# shutdown ←設定前に必ずインターフェースをshutdownさせる R1(config-if)# ip address 10.1.1.1 255.255.255.252 R1(config-if)# encapsulation ppp R1(config-if)# ppp authentication chap R1(config-if)# no shutdown R1(config-if)# end R1# sh int s0/0 Serial0/0 is up, line protocol is up Hardware is PowerQUICC Serial Internet address is 10.1.1.1/30 MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation PPP, LCP Open Open: CDPCP, IPCP, loopback not set Keepalive set (10 sec) R2# conf t R2(config)# username R1 password ccna ←確認のため間違えてみる R2(config)# int s0/0 R2(config-if)# shutdown R2(config-if)# ip address 10.1.1.2 255.255.255.252 R2(config-if)# encapsulation ppp R2(config-if)# ppp authentication chap R2(config-if)# no shutdown R2(config-if)# end R2# ping 10.1.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: ..... Success rate is 0 percent (0/5) ~ パスワードを修正し、疎通を確認する。~ R2# conf t R2(config)# no username R1 password ccna R2(config)# username R1 password cisco R2(config)# end R2# ping 10.1.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/19/68 ms ~ PPPの解除はno encapsulationでデフォルトに戻る。 ~ ~ **アクセスコントロールリストのインバウンドとアウトバウンド [#nc76ab57] ~ ポイント: -インターフェースにインバウンドで適用したアクセスリストは、パケットがそのインターフェースに入るときフィルタリングを行う。 -インターフェースにアウトバウンドで適用したアクセスリストは、パケットがそのインターフェースに出るときフィルタリングを行う。 ~ 使い方:~ f0/1またはfa0/2のインバウンドに設定すれば、その先のセグメントからのアクセス許可を設定できる。~ f1/0にアウトバウンドを設定すれば、f1/0から先へのアクセス許可を設定できる。~ ~ f0/1┏━━━━┓~ ────┨ ┃f1/0~ ┃ Roter ┠──── ~ ────┨ ┃~ f0/2┗━━━━┛~ ~ ~ 検証:~ - R2に標準ACLで「192.168.20.0からの接続を拒否、それ以外は許可」の設定をインバウンドとアウトバウンドで個別に行い、pingのパケットを往復させることで動作の違いを見る。 ~ 192.168.10.0/30 192.168.20.0/30 192.168.30.0/30 192.168.40.0/30~ ┏━━━┓ ┏━━━┓ ┏━━━┓~ ────┨ R1 ┠──────┨ R2 ┠──────┨ R3 ┠────~ ┗━━━┛ f0/0┗━━━┛f0/1 f0/0┗━━━┛f0/1~ ~ R2:f0/0 192.168.20.2/30 f0/1 192.168.30.1/30~ R3:f0/0 192.168.30.2/30 f0/1 192.168.40.1/30~ ~ R2# conf t R2(config)# ip access-list standard test ←ACL名をtestに設定 R2(config-std-nacl)#deny 192.168.20.0 0.0.0.3 R2(config-std-nacl)#permit 0.0.0.0 255.255.255.255 R2(config-std-nacl)#exit R2(config)# int f0/0 R2(config-if)# ip access-group test in ←f0/0にインバウンドを設定 R2(config-if)# no ip access-group test in ←解除 R2(config-if)# ip access-group test out ←f0/0にアウトバウンドを設定 R2(config-if)# no ip access-group test out R2(config-if)# int f0/1 R2(config-if)# ip access-group test in R2(config-if)# no ip access-group test in R2(config-if)# ip access-group test out R2(config-if)# no ip access-group test out ~ R1からR3へpingによる疎通の結果 |ping送信先|192.168.30.1|192.168.30.2|192.168.40.1| |アクセスリストなし|○|○|○| |f0/0 in|×|×|×| |f0/0 out|○|○|○| |f0/1 in|○|○|○| |f0/1 out|○|u|u| f0/0のインバウンドに設定された場合、R1から送られてきた信号はすべて拒絶される。~ f0/0のアウトバウンドに設定すると、R3から返信されたpingのIPヘッダはR3のものになっているためすべて許可される。~ 同じ理由でf0/1のインバウンドの設定も信号は通過する。~ ~ f0/1のアウトバウンドでは.30.1(R2のf0/1)はR2内部で直接接続されているので応答するが、R3側には信号が届かないので到達不可になる。~ アウトバウンドはVTYのアクセス制御で機器の内部から他の機械への制御を禁止したいときに利用される。~ ~ ~ おまけ:設定の有無を確認~ R2(config)# int f0/0 R2(config-if)# ip access-group test in R2(config-if)# end R2# sh ip int f0/0 FastEthernet0/0 is up, line protocol is up Internet address is 192.168.20.2/30 Broadcast address is 255.255.255.255 Address determined by non-volatile memory MTU is 1500 bytes Helper address is not set Directed broadcast forwarding is disabled Multicast reserved groups joined: 224.0.0.10 Outgoing access list is not set Inbound access list is test ←セットされた (後略) ~ ~ **標準アクセスコントロールリスト [#i8e9b347] ポイント: -標準ACLは宛先アドレスを条件に指定できないので、拒否すべきトラフィックの宛先にできるだけ近い場所に配置する必要がある。 -ACLに記述しなくても「すべてを拒否(暗黙のdeny)」が最後の行として設定されるので、拒絶のステートメントの後には「すべてのパケットを許可」のステートメントを必ず追加する。 ~ 検証:~ ~ 10.1.1.1/30~ ┏━━━┓ ┏━━━┓~ ┃ R1 ┠──────────────┨ R2 ┃~ ┗━┯━┛ ┗━┯━┛~ | |~ | |~ 10.1.1.4/30 | | 10.1.1.8/30~ | |~ ┏━┷━┓ ┏━┷━┓~ ┃ R3 ┃ ┃ R4 ┃~ ┗━━━┛ ┗━━━┛~ ~ ~ R1:e1/0 10.1.1.1/30 e1/1 10.1.1.5/30~ R2:e1/0 10.1.1.2/30 e1/1 10.1.1.9/32~ R3: e1/1 10.1.1.6/30~ R3: e1/1 10.1.1.10/30~ ~ R3とR4はPCの代わりとして使用する。~ 10.1.1.6から10.1.1.10へのアクセスを禁止するため、R2に標準ACLを設定する。 ~ ~ R3からR4へのpingを確認。 R3# ping 10.1.1.10 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.10, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 28/32/36 ms ~ R2にACLを設定する。~ 1. ACL番号を決める~ 2. 「10.1.1.6からのパケットは拒否する」ステートメントを作成~ 3. 「すべてのパケットを許可する」ステートメントを作成~ 4. インターフェイスに適用する~ R2# conf t R2(config)# access-list 1 deny 10.1.1.6 0.0.0.0 (←標準ACLでは0.0.0.0は省略可) R2(config)# access-list 1 permit 0.0.0.0 255.255.255.255 R2(config)# int e1/0 R2(config-if)# ip access-group 1 in R2(config-if)# end この設定は、以下の様にもできる。~ R2# conf t R2(config)# access-list 1 deny host 10.1.1.6 R2(config)# access-list 1 permit any R2(config)# int e1/0 R2(config-if)# ip access-group 1 in R2(config-if)# end ~ R3からR4へpingが飛ばなくなったことを確認する。~ R3# ping 10.1.1.10 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.10, timeout is 2 seconds: U.U.U Success rate is 0 percent (0/5) ~ アクセスコントロールを無効にする。~ R2# conf t R2(config)# int e1/0 R2(config-if)# no ip access-group 1 in R2(config-if)# end ~ ~ **拡張アクセスコントロールリスト [#wbc89ee8] ~ ポイント: -拡張ACLは送信元IPアドレスと宛先IPアドレスの両方を条件に指定することができるため、経路上のどのルータにでもACLを配置することが可能だが、無駄なパケットを流さないよう拒否すべきトラフィックの送信元にできるだけ近い場所に配置する必要がある。 -宛先アドレスを明示的に指定していない拡張ACLは、標準ACL同様トラフィックの宛先近くに配置する必要がある。~ -標準ACL同様「すべてを拒否」ステートメントが最後の行に設定される。(暗黙のdeny)~ ~ ~ 検証:標準ACLと同じ環境を使用。~ 10.1.1.4/30から10.1.1.10へのTelnetを禁止するため、R1に拡張ACLを設定する。~ ~ ~ R3からR4へTelnetで接続できることを確認。 R3# telnet 10.1.1.10 Trying 10.1.1.10 ... Open User Access Verification Password: R4>exit [Connection to 10.1.1.10 closed by foreign host] R1にACLを設定する。 1. ACL番号を決める~ 2. 「サブネット10.1.1.0/30から10.1.1.10へのTelnetを拒否する」ステートメントを作成~ 3. 「すべてのパケットを許可する」ステートメントを作成~ 4. インターフェイスに適用する。~ R1# conf t R1(config)# access-list 100 deny tcp 10.1.1.4 0.0.0.3 10.1.1.10 0.0.0.0 eq 23 R1(config)# access-list 100 permit ip 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 R1(config)# int e1/1 R1(config-if)# ip access-group 100 in R1(config-if)# end 許可のステートメントのプロトコルで「ip」を指定すると、その上位層の全トラフィックをまとめて指定することができる 。~ この設定は、以下の様にもできる。~ R1# conf t R1(config)# access-list 100 deny tcp 10.1.1.4 0.0.0.3 host 10.1.1.10 eq telnet R1(config)# access-list 100 permit ip any any R1(config)# int e1/1 R1(config-if)# ip access-group 100 in R1(config-if)# end ~ R3からR4へTelnetで接続できなくなったが、pingは通ることを確認。~ R3# telnet 10.1.1.10 Trying 10.1.1.10 ... % Destination unreachable; gateway or host down R3# ping 10.1.1.10 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.10, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/20/36 ms ~