Re: access-listについて

この質問の投稿一覧へ

なし Re: access-listについて

msg# 1.2.1
depth:
2
前の投稿 - 次の投稿 | 親投稿 - 子投稿.1 | 投稿日時 2016-9-16 11:49
arashi1977  長老 居住地: 広島  投稿数: 1715
コマンドリファレンスでもそのように例示されていますね。
http://www.cisco.com/c/en/us/td/docs/ios-xml/ios/security/a1/sec-a1-cr-book/sec-cr-a2.html#wp3101028446
引用:
Examples
(略)
To specify a large number of individual addresses more easily, you can omit the wildcard if it is all zeros. Thus, the following two configuration commands are identical in effect:
(意訳)
たくさんの個別のアドレスをかんたんに登録できるよう、全部ゼロのワイルドカードマスク(注:hostキーワードを指定した場合と同じ)は省略可能です。なので、以下の2行は同じ結果が得られます。

access-list 2 permit 10.48.0.3
access-list 2 permit 10.48.0.3 0.0.0.0

実際にFa0/0同士で接続した2台のルータを以下のように設定して確認しました。
R1:
interface Loopback0
 ip address 172.19.0.1 255.254.0.0 secondary
 ip address 172.19.0.0 255.254.0.0
!
interface FastEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!

R2:
interface FastEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 ip access-group 1 in
 duplex auto
 speed auto
!
ip route 0.0.0.0 0.0.0.0 192.168.1.1
!
access-list 1 deny   172.19.0.0
access-list 1 permit any
で、172.19.0.0と172.19.0.1から192.168.1.2にpingを打つと、それぞれ以下の結果が得られます。
R1#ping 192.168.1.2 source 172.19.0.0

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
Packet sent with a source address of 172.19.0.0
UUUUU
Success rate is 0 percent (0/5)

R2#show access-lists
Standard IP access list 1
    10 deny   172.19.0.0 (15 matches)
    20 permit any
R1#ping 192.168.1.2 source 172.19.0.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
Packet sent with a source address of 172.19.0.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/20/24 ms

R2#show access-lists
Standard IP access list 1
    10 deny   172.19.0.0 (15 matches)
    20 permit any (5 matches)
なお、アクセスリストの適用を解除するとちゃんと応答が返るようになります。
R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#int fa0/0
R2(config-if)#no ip access 1 in
R2(config-if)#end
R2#
*Mar  1 00:13:12.643: %SYS-5-CONFIG_I: Configured from console by console

R1#ping 192.168.1.2 source 172.19.0.0

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
Packet sent with a source address of 172.19.0.0
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/20/24 ms

投稿ツリー

  >フォーラム検索へ


Copyright (c) 2020 Ping-t All rights reserved.
ログイン
ユーザ名 or E-Mailアドレス:

パスワード:







Contact

LPI-Japan Logo

LPI Logo