ACL访问控制列表

ACL(Access Control List)访问控制列表

可以定义不同的规则,从而可以实现对网络访问行为的控制、限制网络流量、提高网络性能、防止网络攻击等。

ACL分类

  • 基本ACL  2000-2999  用于源IP地址等
  • 高级ACL  3000-3999  用于源IP、目的IP、源端口、目的端口等
  • 二层ACL  4000-4999  源MAC地址、目的MAC地址、以太帧协议等类等非IP流量

ACL规则

每个ACL可以包含多个规则,路由器根据规则来对数据流量进行过滤。
如果不匹配,则匹配下一条。一旦找到一条匹配的规则,则执行规则中定义的动作,并不再继续与后续规则进行匹配。如果找不到匹配的规则,则设备不对报文进行任何处理。

RULE-ID用于决定规则的优先级,处理规则之间的重复或者矛盾。

基本ACL配置 

拓扑如下:

其中,在AR2 Gi0/0/0进入方向配置允许192.168.100.0/24 来telnet AR2
AR2=202.100.1.253/24 172.16.100.254/24

AR2配置如下:
#
sysname AR2
#
acl number 2003
rule 5 permit source 192.168.100.0 0.0.0.255
rule 10 deny
#
interface GigabitEthernet0/0/0
ip address 202.100.1.253 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 172.16.100.254 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
ip route-static 0.0.0.0 0.0.0.0 202.100.1.254
ip route-static 172.16.10.0 255.255.255.0 172.16.100.253
ip route-static 172.16.20.0 255.255.255.0 172.16.100.253
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
acl 2003 inbound
authentication-mode password
set authentication password cipher %$%$;N*pUUb~c8H_%u:1;9$#,)BsXD&qIqcx_4ZPK>N@
]8y()Bv,%$%$
#
return

高级ACL配置

还是刚刚的拓扑:

拒绝Client1 访问 Server2 的FTP(21端口)。其他允许。
A1配置如下:

#
sysname AR1
#
acl number 3001
rule 5 deny tcp source 192.168.10.0 0 destination 172.16.20.253 0 destination-port eq ftp
acl name ad-acl 3999
rule 5 deny tcp source 192.168.10.253 0 destination 172.16.20.253 0 destination-port eq ftp
#
interface GigabitEthernet0/0/0
ip address 202.100.1.254 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
ip address 192.168.100.254 255.255.255.0
traffic-filter outbound acl name ad-acl
#
ip route-static 0.0.0.0 0.0.0.0 202.100.1.253
ip route-static 192.168.10.0 255.255.255.0 192.168.100.253
#
return

ACL NAT应用

拓扑如下:

192.168.10.0转换到地址池10.10.10.1-10
192.168.20.0转换到地址池10.10.10.11-20
在交换机上使用telnet -a 来分别进行对10、20网段的测试。

AR3配置如下:
#
sysname AR3
#
acl number 2000
rule 5 permit source 192.168.10.0 0.0.0.255
acl number 2001
rule 5 permit source 192.168.20.0 0.0.0.255
#
nat address-group 1 10.10.10.1 10.10.10.10
nat address-group 2 10.10.10.11 10.10.10.20
#
interface GigabitEthernet0/0/0
ip address 10.10.10.254 255.255.255.0
nat outbound 2000 address-group 1
nat outbound 2001 address-group 2
#
interface GigabitEthernet0/0/2
ip address 192.168.100.254 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 10.10.10.253
ip route-static 192.168.10.0 255.255.255.0 192.168.100.253
ip route-static 192.168.20.0 255.255.255.0 192.168.100.253
#
return

发表评论

您的电子邮箱地址不会被公开。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据