ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

例1:アクセス制御リストの標準構成

次のようにトポロジは次のとおりです。

標準アクセスリストを設定することで、ホストPC1のPC3のホストへのアクセスを禁止します。

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

次のように(1)SWです。

SW#configure terminal    //进入全局模式
Enter configuration commands, one per line.  End with CNTL/Z.
SW(config)#no ip routing    //关闭路由功能
SW(config)#int f1/0   //进入接口模式
SW(config-if)#speed 100   //设置速率为100M
SW(config-if)#duplex full   //设置全双工
SW(config-if)#exit   //退出
SW(config)#
*Mar  1 00:12:46.291: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up
SW(config)#

以下のように設定(2)R1は次のようになります。

R1#conf t   //进入全局模式
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int f0/0   //进入接口模式
R1(config-if)#ip add 192.168.10.1 255.255.255.0   //配置IP地址与子网掩码
R1(config-if)#no shut   //开启接口
*Mar  1 00:12:48.579: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:12:49.579: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#int f0/1   //进入接口模式
R1(config-if)#ip add 192.168.20.1 255.255.255.0   //配置IP地址与子网掩码
R1(config-if)#no shut   //开启接口
R1(config-if)#
*Mar  1 00:13:15.063: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:13:16.063: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#exit    //退出

(3)は、それぞれPC1に、PC2、PC3は、IPアドレスを設定します

PC1> 
PC1> ip 192.168.10.2 192.168.10.1   //配置IP和网关
Checking for duplicate address...
PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.1

PC1> 
PC2> 
PC2> ip 192.168.10.3 192.168.10.1   //配置IP和网关
Checking for duplicate address...
PC1 : 192.168.10.3 255.255.255.0 gateway 192.168.10.1

PC2>

PC3> 
PC3> ip 192.168.20.2 192.168.20.1   //配置IP和网关
Checking for duplicate address...
PC1 : 192.168.20.2 255.255.255.0 gateway 192.168.20.1

PC3> 

(4)それぞれPC1、PC2はpingPC3行く、通信することができます。

PC1> ping 192.168.20.2
192.168.20.2 icmp_seq=1 timeout
84 bytes from 192.168.20.2 icmp_seq=2 ttl=63 time=12.961 ms
84 bytes from 192.168.20.2 icmp_seq=3 ttl=63 time=17.258 ms
84 bytes from 192.168.20.2 icmp_seq=4 ttl=63 time=12.084 ms
84 bytes from 192.168.20.2 icmp_seq=5 ttl=63 time=18.257 ms

PC1> 
PC2> ping 192.168.20.2
84 bytes from 192.168.20.2 icmp_seq=1 ttl=63 time=19.947 ms
84 bytes from 192.168.20.2 icmp_seq=2 ttl=63 time=11.270 ms
84 bytes from 192.168.20.2 icmp_seq=3 ttl=63 time=14.618 ms
84 bytes from 192.168.20.2 icmp_seq=4 ttl=63 time=20.939 ms
84 bytes from 192.168.20.2 icmp_seq=5 ttl=63 time=12.970 ms

PC2> 

(5)アクセスPC3のPC1を拒否するために、R1の標準的なアクセス制御リストの上に配置されました

R1(config)#access-list 1 deny host 192.168.10.2   //配置标准访问控制列表拒绝PC1的IP地址
R1(config)#access-list 1 permit any   //允许所有IP访问
R1(config)#do show access-list   //查看访问控制列表信息
Standard IP access list 1
    10 deny   192.168.10.2
    20 permit any
R1(config)#int f0/0   //进入接口模式
R1(config-if)#ip access-group 1 in   //将ACL应用到接口(入口)
R1(config-if)#exit   //退出
R1(config)#

(6)は、それぞれ、再度PC1と、PC2はpingPC3、アクセス制御リストの提供は、PC1がPC3と通信できません行きます。

PC1> ping 192.168.20.2
*192.168.10.1 icmp_seq=1 ttl=255 time=9.120 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=2 ttl=255 time=5.016 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=3 ttl=255 time=11.325 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=4 ttl=255 time=2.000 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=5 ttl=255 time=5.111 ms (ICMP type:3, code:13, Communication administratively prohibited)

PC1> 
PC2> ping 192.168.20.2           
192.168.20.2 icmp_seq=1 timeout
192.168.20.2 icmp_seq=2 timeout
84 bytes from 192.168.20.2 icmp_seq=3 ttl=63 time=16.961 ms
84 bytes from 192.168.20.2 icmp_seq=4 ttl=63 time=21.994 ms
84 bytes from 192.168.20.2 icmp_seq=5 ttl=63 time=17.097 ms

PC2> 

例2:アクセス・コントロール・リストの展開を構成します

次のようにトポロジは次のとおりです。

LinuxのWebサービスwin10-1アクセスを許可する、アクセス制御リストを拡張することにより、win10-1アクセス192.168.2.0/24のネットワークセグメントを許可する、win10-1 Linuxのアクセス、他のサービスを禁止します。

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

(1)Linuxシステムに、FTPやHTTPサービスをインストールします。

[root@localhost ~]#yum install vsftpd httpd -y

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

(2)の構成のLinuxシステムens33カードコンフィギュレーション・ファイルを、静的IPアドレスを設定します。

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33 
[root@localhost ~]# service network restart 
Restarting network (via systemctl):                        [  确定  ]
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.100  netmask 255.255.255.0  broadcast 192.168.100.255
        inet6 fe80::3a2f:c8ce:9161:cf9d  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:09:24:8e  txqueuelen 1000  (Ethernet)
        RX packets 10882  bytes 12892735 (12.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1708  bytes 131835 (128.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

2オープンサービスは、ファイアウォールと強化されたセキュリティ機能をオフにしながら、(3)、ファイルサービスのftpサイトを追加し、サイトhttpファイル内のサイトを追加し、ポートは、サービスが正常に開かれているかどうかをスキャンします。

[root@localhost ~]# vim /var/www/html/index.html
[root@localhost ~]# cat /var/www/html/index.html
<h1> this is test web </h1>
[root@localhost ~]# 
[root@localhost ~]# echo "this is ftp" > /var/ftp/ftp_test.txt
[root@localhost ~]# ls /var/ftp/
ftp_test.txt  pub
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl start vsftpd
[root@localhost ~]# systemctl stop firewalld.service 
[root@localhost ~]# setenforce 0
[root@localhost ~]# 
[root@localhost ~]# netstat -ntap | egrep '(21|80)'
tcp6       0      0 :::80                   :::*                    LISTEN      51680/httpd         
tcp6       0      0 :::21                   :::*                    LISTEN      51844/vsftpd        

[root@localhost ~]#

(4)それぞれのLinuxシステムは、VMnet2カード、win10-1ホストバインディングVMnet1カード、win10-2ホストバインディングVMnet3でカードを結合します。

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

(5)それぞれwin10-2ホスト構成およびホストIPアドレス、サブネットマスク、およびゲートウェイをwin10-1します。

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

(6)win10-1ホストwin10-2ホストファイアウォールを閉じています。

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

(7)R1の基本構成。

R1#conf t   //切换全局模式
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int f0/0     //进入接口模式
R1(config-if)#ip add 192.168.1.1 255.255.255.0   //配置IP地址与子网掩码
R1(config-if)#no shut   //开启接口
R1(config-if)#
*Mar  1 00:17:49.615: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:17:50.615: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#int f0/1     //进入接口模式
R1(config-if)#ip add 192.168.100.1 255.255.255.0   //配置IP地址与子网掩码
R1(config-if)#no shut   //开启接口
R1(config-if)#
*Mar  1 00:18:27.591: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:18:28.591: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#int f1/0     //进入接口模式
R1(config-if)#ip add 192.168.2.1 255.255.255.0   //配置IP地址与子网掩码
R1(config-if)#no shut   //开启接口
R1(config-if)#
*Mar  1 00:19:31.295: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up
*Mar  1 00:19:32.295: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
R1(config-if)#exit
R1(config)#do show 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

C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet1/0
C    192.168.100.0/24 is directly connected, FastEthernet0/1
R1(config)#

(8)ホストはwin10-1それぞれ他の二つのping IPホストに通信することができる時。

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

(9)win10-1ホストとFTPサービスでは、HTTPサービスにアクセスするためのLinuxシステムが成功することができます。

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

(10)FTPサービスでは、HTTPサービスにアクセスするためのwin10-2ホストLinuxシステムでも成功することができます。

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

(11)R1上のアクセス制御リストを展開するように構成される。

R1(config)#
R1(config)#access-list 100 permit tcp host 192.168.1.2 host 192.168.100.100 eq www     //允许win10-1访问Linux系统的http服务
R1(config)#access-list 100 deny ip host 192.168.1.2 host 192.168.100.100   //拒绝win10-1访问Linux系统的所有服务
R1(config)#access-list 100 permit ip host 192.168.1.2 192.168.2.0 0.0.0.255   //允许win10-1主机访问192.168.2.0网段所有服务
R1(config)#do show access-lists   //查看ACL控制列表
Extended IP access list 100
    10 permit tcp host 192.168.1.2 host 192.168.100.100 eq www
    20 deny ip host 192.168.1.2 host 192.168.100.100
    30 permit ip host 192.168.1.2 192.168.2.0 0.0.0.255
R1(config)#int f0/0   //进入接口模式
R1(config-if)#ip access-group 100 in   //将ACL应用到接口(入口)
R1(config-if)#exit   //退出
R1(config)#

(12)我々は最初のブラウザのキャッシュwin10-1ホストをクリアし、アクセスできるLinuxシステムのHTTPサービスwin10-1アクセスをホストします。しかし、彼は訪問していない、FTPを訪問して行きます。我々はACLであるため、唯一のアクセスHTTPサービスを可能にします。

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

(13)ACLは、すべてのサービスwin10-1ホスト192.168.2.0のネットワークセグメントへのアクセスを許可されているので、我々は次にwin10-1互いに二つのホストにpingを実行するホストのみ、ホストwin10-2と通信することができます。

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

三つの例:名前付きアクセス制御リストの設定

次のようにトポロジは次のとおりです。

名前によるアクセス制御リストは、PC2 PC1 VLAN10ホストがホストにアクセスできることができ、他のホストへのアクセスは、ホストが他のすべてのセグメントのPC1ホストにアクセスできるように、VLAN10のPC1ホストを拒否します。

ACLアクセス制御リストの設定例(標準、拡大、名前のコントロールリスト)の

(1)構成をSWに。

sw#conf t   //切换全局模式
Enter configuration commands, one per line.  End with CNTL/Z.
sw(config)#no ip routing   //关闭路由功能
sw(config)#vlan 10,20   //创建vlan
sw(config-vlan)#exit   //退出
sw(config)#int range f1/1 -2   //进入接口f1/1、f1/2
sw(config-if-range)#sw mo acc   //接口模式设为access模式
sw(config-if-range)#sw acc vlan 10   //将接口添加到vlan10
sw(config-if-range)#exit   //退出
sw(config)#int f1/3   //进入接口f1/3
sw(config-if)#sw mo acc   //接口模式设为access模式
sw(config-if)#sw acc vlan 20   //将接口添加到vlan20
sw(config-if)#exit   //退出
sw(config)#do show vlan-sw b   //查看vlan表

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/0, Fa1/4, Fa1/5, Fa1/6
                                                Fa1/7, Fa1/8, Fa1/9, Fa1/10
                                                Fa1/11, Fa1/12, Fa1/13, Fa1/14
                                                Fa1/15
10   VLAN0010                         active    Fa1/1, Fa1/2
20   VLAN0020                         active    Fa1/3
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 
sw(config)#int f1/0   //进入接口f1/0
sw(config-if)#sw mo t   //设置接口模式为trunk模式
*Mar  1 00:03:20.511: %DTP-5-TRUNKPORTON: Port Fa1/0 has become dot1q trunk
sw(config-if)#sw t en dot1   //设置数据封装类型为dot1q
sw(config-if)#exit   //退出

SW-3の(2)基本構成。

sw-3#conf t   //进入全局模式
Enter configuration commands, one per line.  End with CNTL/Z.
sw-3(config)#int f1/1   //进入接口
sw-3(config-if)#no switchport    //接口转为二层接口
*Mar  1 00:05:39.675: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to up
sw-3(config-if)#ip add 192.168.100.1 255.255.255.0   //配置IP地址和子网掩码
sw-3(config-if)#no shut   //开启接口
sw-3(config-if)#exit   //退出
sw-3(config)#vlan 10,20   //创建vlan
sw-3(config-vlan)#exit   //退出
sw-3(config)#int vlan 10   //进入vlan10
sw-3(config-if)#ip add 192.168.10.1 255.255.255.0   //配置IP地址和子网掩码
sw-3(config-if)#no shut   //开启vlan
sw-3(config-if)#exit   //退出
sw-3(config)#int vlan 20   //进入vlan20
sw-3(config-if)#ip add 192.168.20.1 255.255.255.0   //配置IP地址和子网掩码
sw-3(config-if)#no shut   //开启vlan
sw-3(config-if)#exit   //退出
sw-3(config)#int f1/0   //进入接口
sw-3(config-if)#sw mo t   //设置接口模式为trunk模式
*Mar  1 00:08:40.075: %DTP-5-TRUNKPORTON: Port Fa1/0 has become dot1q trunk
*Mar  1 00:08:40.575: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
*Mar  1 00:08:40.583: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
sw-3(config-if)#sw t en dot1   //设置数据封装类型为dot1q
sw-3(config-if)#exit   //退出
sw-3(config)#do show 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

C    192.168.10.0/24 is directly connected, Vlan10
C    192.168.20.0/24 is directly connected, Vlan20
C    192.168.100.0/24 is directly connected, FastEthernet1/1
sw-3(config)#

(3)それぞれPC1、PC2、PC3、PC4のホストIPアドレスに。

PC1> 
PC1> ip 192.168.100.100 192.168.100.1
Checking for duplicate address...
PC1 : 192.168.100.100 255.255.255.0 gateway 192.168.100.1

PC1> 
PC2> 
PC2> ip 192.168.10.10 192.168.10.1
Checking for duplicate address...
PC1 : 192.168.10.10 255.255.255.0 gateway 192.168.10.1

PC2> 
PC3> 
PC3> ip 192.168.10.20 192.168.10.1
Checking for duplicate address...
PC1 : 192.168.10.20 255.255.255.0 gateway 192.168.10.1

PC3> 
PC4> 
PC4> ip 192.168.20.20 192.168.20.1
Checking for duplicate address...
PC1 : 192.168.20.20 255.255.255.0 gateway 192.168.20.1

PC4> 

(4)通信することができるすべての他のホストとホストPC2にpingを実行します。

PC2> ping 192.168.100.100
192.168.100.100 icmp_seq=1 timeout
84 bytes from 192.168.100.100 icmp_seq=2 ttl=63 time=11.281 ms
84 bytes from 192.168.100.100 icmp_seq=3 ttl=63 time=15.939 ms
84 bytes from 192.168.100.100 icmp_seq=4 ttl=63 time=13.957 ms
84 bytes from 192.168.100.100 icmp_seq=5 ttl=63 time=14.960 ms

PC2> ping 192.168.10.20  
84 bytes from 192.168.10.20 icmp_seq=1 ttl=64 time=0.000 ms
84 bytes from 192.168.10.20 icmp_seq=2 ttl=64 time=0.000 ms
84 bytes from 192.168.10.20 icmp_seq=3 ttl=64 time=0.000 ms
84 bytes from 192.168.10.20 icmp_seq=4 ttl=64 time=0.642 ms
84 bytes from 192.168.10.20 icmp_seq=5 ttl=64 time=0.000 ms

PC2> ping 192.168.20.20
192.168.20.20 icmp_seq=1 timeout
84 bytes from 192.168.20.20 icmp_seq=2 ttl=63 time=17.046 ms
84 bytes from 192.168.20.20 icmp_seq=3 ttl=63 time=12.324 ms
84 bytes from 192.168.20.20 icmp_seq=4 ttl=63 time=17.953 ms
84 bytes from 192.168.20.20 icmp_seq=5 ttl=63 time=15.786 ms

PC2> 

(5)SW-3という名前のアクセス制御リストに配置されています。

sw-3(config)#
sw-3(config)#ip access-list standard test0   //添加命名访问控制列表test0
sw-3(config-std-nacl)#permit host 192.168.10.10   //允许PC2主机IP通过
sw-3(config-std-nacl)#deny 192.168.10.0 0.0.0.255   //拒绝192.168.10.0网段所有IP通过
sw-3(config-std-nacl)#permit any   //允许所有
sw-3(config-std-nacl)#exit   //退出
sw-3(config)#do show access-lists   //查看ACL列表
Standard IP access list test0
    10 permit 192.168.10.10
    20 deny   192.168.10.0, wildcard bits 0.0.0.255
    30 permit any
sw-3(config)#int f1/1   //进入接口
sw-3(config-if)#ip access-group test0 out   //将ACL应用到接口(出口)
sw-3(config-if)#exit   //退出
sw-3(config)#

(6)PC2のPC3、各ホストにPC4、IPアドレスは、pingホストPC1有します。PC3ホストは、ホスト192.168.10.0 IPネットワーク缶のみSW-3としてPC1、PC2と通信できません。

PC2> ping 192.168.100.100
192.168.100.100 icmp_seq=1 timeout
192.168.100.100 icmp_seq=2 timeout
84 bytes from 192.168.100.100 icmp_seq=3 ttl=63 time=20.944 ms
84 bytes from 192.168.100.100 icmp_seq=4 ttl=63 time=19.954 ms
84 bytes from 192.168.100.100 icmp_seq=5 ttl=63 time=11.286 ms

PC2> 
PC3> ping 192.168.100.100
*192.168.10.1 icmp_seq=1 ttl=255 time=9.073 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=2 ttl=255 time=9.978 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=3 ttl=255 time=11.641 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=4 ttl=255 time=1.995 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=5 ttl=255 time=1.713 ms (ICMP type:3, code:13, Communication administratively prohibited)

PC3> 
PC4> ping 192.168.100.100
84 bytes from 192.168.100.100 icmp_seq=1 ttl=63 time=20.944 ms
84 bytes from 192.168.100.100 icmp_seq=2 ttl=63 time=17.947 ms
84 bytes from 192.168.100.100 icmp_seq=3 ttl=63 time=19.947 ms
84 bytes from 192.168.100.100 icmp_seq=4 ttl=63 time=20.075 ms
84 bytes from 192.168.100.100 icmp_seq=5 ttl=63 time=19.639 ms

PC4> 

(7)私たちは、PC3は、PCのルールへのアクセスを許可された結果は、TEST0で通信することができ、ホストPC1にpingを実行し、その後、PC3をIPアドレスを追加し、アクセス制御リストの名前。

sw-3(config)#
sw-3(config)#ip access-list standard test0    //进入ACL的子模式
sw-3(config-std-nacl)#12 permit host 192.168.10.20   //添加允许规则
sw-3(config-std-nacl)#exit   //退出
sw-3(config)#do show access-lists   //查看ACL列表
Standard IP access list test0
    10 permit 192.168.10.10 (5 matches)
    12 permit 192.168.10.20
    20 deny   192.168.10.0, wildcard bits 0.0.0.255 (10 matches)
    30 permit any (5 matches)
sw-3(config)#
PC3> ping 192.168.100.100
192.168.100.100 icmp_seq=1 timeout
192.168.100.100 icmp_seq=2 timeout
84 bytes from 192.168.100.100 icmp_seq=3 ttl=63 time=17.954 ms
84 bytes from 192.168.100.100 icmp_seq=4 ttl=63 time=15.538 ms
84 bytes from 192.168.100.100 icmp_seq=5 ttl=63 time=15.956 ms

PC3> 

(8)前のステップで、次いでPC3は、結果が通信できない、ホストPC1にpingを実行するために、ルールを削除することを可能にする追加します。

sw-3(config)#
sw-3(config)#ip access-list standard test0   //进入ACL列表子模式
sw-3(config-std-nacl)#no 12   //删除编号为12的规则
sw-3(config-std-nacl)#exit   //退出
sw-3(config)#do show access-lists   //查看ACL列表
Standard IP access list test0
    10 permit 192.168.10.10 (5 matches)
    20 deny   192.168.10.0, wildcard bits 0.0.0.255 (10 matches)
    30 permit any (5 matches)
sw-3(config)#
PC3> ping 192.168.100.100
*192.168.10.1 icmp_seq=1 ttl=255 time=9.578 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=2 ttl=255 time=3.993 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=3 ttl=255 time=1.692 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=4 ttl=255 time=2.686 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=5 ttl=255 time=14.020 ms (ICMP type:3, code:13, Communication administratively prohibited)

PC3> 

おすすめ

転載: blog.51cto.com/14449541/2444011