1. HOME
  2. ブログ
  3. ブログ
  4. テックブログ
  5. テックブログ
  6. 【cisco関連】名前付き拡張ACLの設定手順

Article

記事一覧

テックブログ

【cisco関連】名前付き拡張ACLの設定手順

こんにちは!(*´▽`*)☆ミ
最近新しくチャレンジしようと思っていることがありまして…………(*´艸`*)♪
本格的に始められるのは試験に合格してからなんですけどね笑
まずは勉強から!わくわくを活力に今日もはりきっていきますよー!!

では。今日は「名前付き拡張ACLの設定手順」について書きます☆

1. はじめに

この手順書ではCiscoスイッチの名前付き拡張IP-ACL(アクセスコントロールリスト)の設定手順をまとめます。

今回は、「サーバーホスト”testserver”が接続されているスイッチ(3番ポート)に対して、192.168.10.10 – 19は全ての接続先からの接続を許可し、それ以外は全て拒否する」という設定を行います。

下記パラメータが今回の設定内容となります。
【サーバパラメータ】
サーバホスト名 :testserver

許可するIP : 192.168.10.10 – 19

【スイッチパラメータ】
サーバー接続ポート :Gi 0/3

 

2. 設定手順

ターミナルを立ち上げてスイッチに接続する。
(接続方法は、ssh、telnet、コンソールのどれでも良い)

特権モード切り替える。
switch> enable

showコマンドでrunning-configとaccess-listsを確認していく。
switch# show running-config interface gigabitEthernet 0/3
Building configuration...

Current configuration : 84 bytes
!
interface GigabitEthernet0/3
switchport mode access
ip access-group testacl0 in
spanning-tree portfast

end

witch# show access-lists
Extended IP access list testacl0
10 deny udp any any eq bootpc
20 permit ip any any

上記、確認コマンドから現在、3番ポート(以下、GigabitEthernet0/3)は、
testacl0という名前付き拡張ACLが適用されているのがわかる。

 

次に、名前付き拡張ACLの作成をします。

グローバルコンフィグレーションモードに移動する。
switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)#

名前付き拡張ACLを作成し、条件文を記入する。

switch(config)#ip access-list extended 任意のACL名(testacl1)
switch(config-ext-nacl)#行番号 <permit>or<deny> ip 開始IPアドレス ワイルドカードマスク 許可するIPアドレス
switch(config)#ip access-list extended testacl1
switch(config-ext-nacl)#10 permit ip 192.168.10.10 0.0.0.1 any
switch(config-ext-nacl)#20 permit ip 192.168.10.12 0.0.0.3 any
switch(config-ext-nacl)#30 permit ip 192.168.10.16 0.0.0.3 any
switch(config-ext-nacl)#40 deny ip any any
switch(config-ext-nacl)#end

 

show access-listsで作成したACLを確認する。
作成したtestacl1が追加されていることが確認できる。

switch#show access-lists
Extended IP access list testacl1
10 deny udp any any eq bootpc
20 permit ip any any (22 matches)
Extended IP access list testacl
10 permit ip 192.168.10.10 0.0.0.1 any (50 matches)
20 permit ip 192.168.10.12 0.0.0.3 any
30 permit ip 192.168.10.16 0.0.0.3 any
40 deny ip any any

 

次に、作成したACLを3番ポートへ割り当てます。

グローバルコンフィグレーションモードに移動する。
switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)#

 

GigabitEthernet0/3のインターフェスコンフィグレーションモードへ移動し、testacl1(任意のACL名)を割り当てる。

書式:switch(config-if)#ip access-group 任意のACL名 <in>or<out>
※ACLの適用はinに割り当てて下さい。
switch(config)#interface gi0/3
switch(config-if)#ip access-group testacl1 in
switch(config-if)#end

show running-configで割り当てたACLが設定されているか確認する。

testacl0が上書きされ、testacl1がinに設定されている事が確認できる。
switch#show running-config
Building configuration…

Current configuration : 3706 bytes
!
version 12.2
no service pad
service timestamps debug uptime
service timestamps log uptime
service password-encryption
!
中略

!
interface GigabitEthernet0/3
switchport mode access
ip access-group testacl1 in
spanning-tree portfast
!
以下省略

以上で、GigabitEthernet0/3に対して、testacl1を割り当ては完了です。

 

次に、設定後の確認とconfigのコピーをします。

startup-configの確認後、running-configをstartup-configへ書き込む事と書き込み後の確認をする。

show startup-config(実行結果)
GigabitEthernet0/3に対してACLは設定されていない事がわかります。
switch#show startup-config
Using 3706 out of 524288 bytes
!
version 12.2
no service pad
service timestamps debug uptime
service timestamps log uptime
service password-encryption
!

中略

!
interface GigabitEthernet0/3
switchport mode access
spanning-tree portfast
!

以下省略

 

running configをstartup-configに書き込む
switch#copy running-config startup-config
Destination filename [startup-config]?
Building configuration…
[OK]

startup-configの確認
switch#show startup-config
Using 3706 out of 524288 bytes
!
version 12.2
no service pad
service timestamps debug uptime
service timestamps log uptime
service password-encryption
!
中略
!
interface GigabitEthernet0/3
switchport mode access
ip access-group testacl1 in
spanning-tree portfast
!
以下省略



testacl0が上書きされ、testacl1がinに設定されている事が確認できる。


書き込みが成功していることを確認して作業終了です!




お疲れ様でした。
次回は「running-configのバックアップ・リストア」について投稿します☆

この記事が気に入ったら
いいね ! してください

Twitter で