DynagenでCCIEを目指す
Reflexive Access List
最終更新:
it_certification
-
view
1. 目的
- reflexive ACLの使い方を確認します。
2. 構成
2.1. 設定概要
- OSPFによってルーティングします。
2.2. 構成図

2.3. netファイル
model = 3660 [localhost] [[3660]] image = C:\Program Files\Dynamips\images\c3660-ik9o3s-mz.124-6.T.bin ram = 128 [[ROUTER R1]] f0/0 = R2 f0/0 [[ROUTER R2]] f0/1 = R3 f0/1 [[ROUTER R3]]
2.4. 初期設定
- R1
! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R1 ! boot-start-marker boot-end-marker ! ! no aaa new-model ! resource policy ! memory-size iomem 5 ! ! ip cef no ip domain lookup ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 ip address 1.1.1.1 255.255.255.255 ! interface FastEthernet0/0 ip address 192.168.12.1 255.255.255.0 duplex auto speed auto ! interface FastEthernet0/1 no ip address shutdown duplex auto speed auto ! router ospf 1 log-adjacency-changes passive-interface default no passive-interface FastEthernet0/0 network 1.1.1.1 0.0.0.0 area 0 network 192.168.12.1 0.0.0.0 area 0 ! ip http server no ip http secure-server ! ! ! no cdp run ! ! ! control-plane ! ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
- R2
! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R2 ! boot-start-marker boot-end-marker ! ! no aaa new-model ! resource policy ! memory-size iomem 5 ! ! ip cef no ip domain lookup ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface FastEthernet0/0 ip address 192.168.12.2 255.255.255.0 duplex auto speed auto ! interface FastEthernet0/1 ip address 192.168.23.2 255.255.255.0 duplex auto speed auto ! router ospf 1 log-adjacency-changes passive-interface default no passive-interface FastEthernet0/0 no passive-interface FastEthernet0/1 network 2.2.2.2 0.0.0.0 area 0 network 192.168.12.2 0.0.0.0 area 0 network 192.168.23.2 0.0.0.0 area 0 ! ip http server no ip http secure-server ! ! ! no cdp run ! ! ! control-plane ! ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
- R3
! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R3 ! boot-start-marker boot-end-marker ! ! no aaa new-model ! resource policy ! memory-size iomem 5 ! ! ip cef no ip domain lookup ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 ip address 3.3.3.3 255.255.255.255 ! interface FastEthernet0/0 no ip address shutdown duplex auto speed auto ! interface FastEthernet0/1 ip address 192.168.23.3 255.255.255.0 duplex auto speed auto ! router ospf 1 log-adjacency-changes passive-interface default no passive-interface FastEthernet0/1 network 3.3.3.3 0.0.0.0 area 0 network 192.168.23.3 0.0.0.0 area 0 ! ip http server no ip http secure-server ! ! ! no cdp run ! ! ! control-plane ! ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
3. [検証] Reflexive ACL
3.1. 概要
Reflexiveは内部から外部へパケットを監査し、一時的にその反対方向のパケットを許可するACLです。established指定はTCPのみが適用対象ですが、Reflexive ACLはICMPやUDPに対しても適用する事ができます。
3.2. 設定方法
監査するパケットを定義します。ACLの設定の後に、「reflect <reflect name>」というキーワードを指定します。
Router(config)#ip access-list extended <acl name> Router(config-ext-nacl)#permit <protocol> <src> <dest> reflect <reflect name> [timeout <timeout>] Router(config-ext-nacl)#exit Router(config)# Router(config)# Router(config)#interface FastEthernet 0/0 Router(config-if)#ip access-group <acl name> out
戻りパケットの許可する設定を定義します。「evaluate <reflect name>」と指定したACLによって戻りのパケットを一時的に許可する事ができます。なお、戻りのパケットを許可する必要があるので、監査をin/out方向に設定した場合は、戻り方向はout/in方向に設定して下さい。
Router(config)#ip access-list extended <acl name> Router(config-ext-nacl)#evaluate <reflect name> Router(config-ext-nacl)#exit Router(config)# Router(config)# Router(config)#interface FastEthernet 0/0 Router(config-if)#ip access-group <acl name> in
3.3. 設定投入
pingを片方向にのみ許可する設定を投入します。
R2(config)#ip access-list extended INACL R2(config-ext-nacl)#permit icmp any any reflect ICMP timeout 10 R2(config-ext-nacl)#permit ospf any any R2(config-ext-nacl)#exit R2(config)# R2(config)# R2(config)#ip access-list extended OUTACL R2(config-ext-nacl)#evaluate ICMP R2(config-ext-nacl)#exit R2(config)# R2(config)# R2(config)# R2(config)#interface FastEthernet 0/0 R2(config-if)#ip acce R2(config-if)#ip access-group INACL in R2(config-if)#ip access-group OUTACL out
3.4. 設定確認
R1からR3へのpingは成功するものの、R3からR1へのpingが失敗する事を確認します。
R1#ping 192.168.23.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 72/123/216 ms R1# R3#ping 192.168.12.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds: U.U.U Success rate is 0 percent (0/5) R3#
4. [補足] counterの確認
4.1. counterの確認
「show ip access-lists」コマンドで、ACLが適用されたパケット数を確認する事ができます。
R2#show ip access-lists Reflexive IP access list ICMP Extended IP access list INACL 10 permit icmp any any reflect ICMP (22 matches) 20 permit ospf any any (11 matches) Extended IP access list OUTACL 10 evaluate ICMP R2#
カウンタを消去したい場合は、「clear access-list counters」で消去できます。
R2#clear access-list counters R2#show ip acces R2#show ip access-lists Reflexive IP access list ICMP Extended IP access list INACL 10 permit icmp any any reflect ICMP 20 permit ospf any any (1 match) Extended IP access list OUTACL 10 evaluate ICMP R2#
4.2. 一時的に許可されたACLの確認
以下の要領で一時的に許可されたACLを確認する事ができます。
Router#show ip access-lists <reflect name>
一時的なACLを作成するために、R1からR3へpingを送信します。
R1#ping 192.168.23.3 source 1.1.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds: Packet sent with a source address of 1.1.1.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 68/112/196 ms R1# R1# R1#ping 192.168.23.3 source 192.168.12.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds: Packet sent with a source address of 192.168.12.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 76/128/244 ms R1#
R2で一時的に許可されたACLを確認します。
R2#show ip access-lists ICMP Reflexive IP access list ICMP permit icmp host 192.168.23.3 host 192.168.12.1 (19 matches) (time left 8) permit icmp host 192.168.23.3 host 1.1.1.1 (19 matches) (time left 2) R2#
添付ファイル