access-list
- 機種
- Router(K)
- モード
- Global(M)
- デフォルト
- 無効
- IOS
- 10.0
- 試験レベル
- CCNA
- 構文
- 標準アクセスリスト
access-list 番号 { permit | deny } source-address [wild card] [ log ]
拡張アクセスリスト
access-list 番号 { permit | deny } protocol source-address [wild card] [option source-port] destination-address [wild card] [option destination-port] [option]
- 使用例
- 標準アクセスリスト
拡張アクセスリスト
Router(config)#access-list 1 deny host 192.168.2.3 Router(config)#access-list 1 deny 192.168.3.0 0.0.0.0 log Router(config)#access-list 1 permit any
Router(config)#access-list 100 deny ip host 192.168.1.1 host 192.168.5.1 Router(config)#access-list 100 deny tcp 192.168.6.0 0.0.0.255 host 192.168.5.1 eq 23 Router(config)#access-list 100 permit tcp any 172.16.42.254 0.0.0.0 eq 80 Router(config)#access-list 100 permit ip any any
- 解説
パラメータ 意味 番号 標準アクセスリストは、1〜99(1300〜1999)の範囲内で指定する。
拡張アクセスリストは、100〜199(2000〜2699)の範囲内で指定する。
()内はIOS12.0以降で使用可能。protocol プロトコルを指定する。 source-address 送信元のIPアドレスやネットワークアドレスを指定する。
なお、アドレス指定では無くanyとすると全てのネットワークが該当する。destination-address 宛先のIPアドレスやネットワークアドレスを指定する。
なお、アドレス指定では無くanyとすると全てのネットワークが該当する。wild card-mask アドレスに対するワイルドカードマスクを指定する。何も指定しない場合は、デフォルトで0.0.0.0が使用され、hostに置き換え可能である。
つまり「host 192.168.2.3」と「192.168.2.3 0.0.0.0」が同じ意味になる。source-port/
destinaton-portprotocolにtcpやudpを使いポート番号を指定する事でより詳細な制御を行う事が出来る。
各パラメーターに関しては別途記載。option protocolに応じた様々なオプションを設定する。
- source-port/destinaton-portについて
- protocolにtcpやudpを指定した場合、さらにポート番号の指定が可能になります。
ポート番号を指定する事によって、より詳細な通信制御が可能になります。
ポート番号を指定する際、source-portやdestinaton-portに以下のパラメーラを指定します。パラメータ 意味 lt lower than:〜より小さい gt greater than:〜より大きい eq equal:〜と等しい neq not equal:〜と等しくない
tcpプロトコルの中でもtelnet通信のみ制御をかける場合。
Router(config)#access-list 100 deny tcp host 192.168.6.1 host 192.168.5.1 eq 23
なお、ポート番号が「23」であれば「telnet」と言った様にキーワードへ置き換え可能です。
以下に代表的なものを記載します。
ポート番号 | キーワード |
20 | ftp-date |
21 | ftp |
23 | telnet |
25 | smtp |
80 | www |
110 | pop3 |
実機上でヘルプコマンドを使用すると、置き換え可能なポート番号が表示されます。
Router(config)#access-list 100 deny tcp host 192.168.1.1 host 192.168.2.1 eq ? <0-65535> Port number bgp Border Gateway Protocol (179) chargen Character generator (19) cmd Remote commands (rcmd, 514) daytime Daytime (13) discard Discard (9) domain Domain Name Service (53) echo Echo (7) exec Exec (rsh, 512) finger Finger (79) ftp File Transfer Protocol (21) ftp-data FTP data connections (20) gopher Gopher (70) hostname NIC hostname server (101) ident Ident Protocol (113) irc Internet Relay Chat (194) klogin Kerberos login (543) kshell Kerberos shell (544) login Login (rlogin, 513) lpd Printer service (515) nntp Network News Transport Protocol (119) pim-auto-rp PIM Auto-RP (496) pop2 Post Office Protocol v2 (109) pop3 Post Office Protocol v3 (110) smtp Simple Mail Transport Protocol (25) sunrpc Sun Remote Procedure Call (111) syslog Syslog (514) tacacs TAC Access Control System (49) talk Talk (517) telnet Telnet (23) time Time (37) uucp Unix-to-Unix Copy Program (540) whois Nicname (43) www World Wide Web (HTTP, 80)
- optionについて
- protocolに応じて様々なオプションを定義する事が出来ます。
以下は、実機にてtcp,udp,icmpのオプションをヘルプ表示した結果になります。
TCPプロトコルのACLオプション一覧Router(config)#access-list 100 deny tcp host 192.168.1.1 host 192.168.1.2 eq 23 ? ack Match on the ACK bit dscp Match packets with given dscp value established Match established connections fin Match on the FIN bit log Log matches against this entry log-input Log matches against this entry, including input interface precedence Match packets with given precedence value psh Match on the PSH bit rst Match on the RST bit syn Match on the SYN bit time-range Specify a time-range tos Match packets with given TOS value urg Match on the URG bit <cr>
UDPプロトコルのACLオプション一覧
Router(config)#access-list 100 deny udp host 192.168.1.1 host 192.168.1.2 eq 23 ? dscp Match packets with given dscp value log Log matches against this entry log-input Log matches against this entry, including input interface precedence Match packets with given precedence value time-range Specify a time-range tos Match packets with given TOS value <cr>
ICMPプロトコルのACLオプション一覧
Router(config)#access-list 100 deny icmp host 192.168.1.1 host 192.168.1.2 ? <0-255> ICMP message type administratively-prohibited Administratively prohibited alternate-address Alternate address conversion-error Datagram conversion dod-host-prohibited Host prohibited dod-net-prohibited Net prohibited dscp Match packets with given dscp value echo Echo (ping) echo-reply Echo reply fragments Check non-initial fragments general-parameter-problem Parameter problem host-isolated Host isolated host-precedence-unreachable Host unreachable for precedence host-redirect Host redirect host-tos-redirect Host redirect for TOS host-tos-unreachable Host unreachable for TOS host-unknown Host unknown host-unreachable Host unreachable information-reply Information replies information-request Information requests log Log matches against this entry log-input Log matches against this entry, including input interface mask-reply Mask replies mask-request Mask requests mobile-redirect Mobile host redirect net-redirect Network redirect net-tos-redirect Net redirect for TOS net-tos-unreachable Network unreachable for TOS net-unreachable Net unreachable network-unknown Network unknown no-room-for-option Parameter required but no room option-missing Parameter required but not present packet-too-big Fragmentation needed and DF set parameter-problem All parameter problems port-unreachable Port unreachable precedence Match packets with given precedence value precedence-unreachable Precedence cutoff protocol-unreachable Protocol unreachable reassembly-timeout Reassembly timeout redirect All redirects router-advertisement Router discovery advertisements router-solicitation Router discovery solicitations source-quench Source quenches source-route-failed Source route failed time-exceeded All time exceededs time-range Specify a time-range timestamp-reply Timestamp replies timestamp-request Timestamp requests tos Match packets with given TOS value traceroute Traceroute ttl-exceeded TTL exceeded unreachable All unreachables <cr>
- Tips
- タグ
- アクセスリスト
Counter: 81870,
today: 1,
yesterday: 1
最終更新: 2009-08-04 (火) 16:02:28 (JST) (5385d) by staff_mita