为什么隐式规则会阻止流量通过?

网络工程 思科 思科 安全 数据包追踪器 ACL
2021-08-03 04:52:30

我在不同安全级别的不同 DMZ 之间测试流量转发。

非军事区:

interface GigabitEthernet0/1.351
 vlan 351
 nameif dmz
 security-level 10
 ip address 10.100.20.1 255.255.255.0 

DMZ810:

interface GigabitEthernet1/2.810
 vlan 810
 nameif dmz810
 security-level 50
 ip address 172.29.12.33 255.255.255.248 

使用数据包跟踪器进行测试:

asa-5550-edge# packet-tracer input dmz810 tcp 172.29.12.34 587 10.100.20.50 587 detail

Phase: 1
Type: ROUTE-LOOKUP
Subtype: input
Result: ALLOW
Config:
Additional Information:
in   10.100.20.0     255.255.255.0   dmz

Phase: 2
Type: ACCESS-LIST
Subtype:
Result: DROP
Config:
Implicit Rule
Additional Information:
 Forward Flow based lookup yields rule:
 in  id=0x2bf97148, priority=11, domain=permit, deny=true
        hits=79960, user_data=0x5, cs_id=0x0, use_real_addr, flags=0x0, protocol=0
        src ip/id=0.0.0.0, mask=0.0.0.0, port=0, tag=0
        dst ip/id=0.0.0.0, mask=0.0.0.0, port=0, tag=0, dscp=0x0
        input_ifc=dmz810, output_ifc=any

Result:
input-interface: dmz810
input-status: up
input-line-status: up
output-interface: dmz
output-status: up
output-line-status: up
Action: drop
Drop-reason: (acl-drop) Flow is denied by configured rule

但是接口dmz810比接口dmz更高dmz810 ACL 中的规则没有帮助。

是什么原因?

1个回答

在接口上配置显式ACL时,我已经无数次看到这种情况

默认情况下,如果恰好 存在零个访问控制列表,则 ASA 将自由允许从较高安全级别到较低级别的所有流量。但是,只要您添加任何 适用于接口的显式规则,就会在 ACL 的末尾添加隐式 DENY规则。此外,在执行命令不会显示隐式规则ASDM显示隐式规则,但默认情况下 CLI 不显示。show access-list

虽然理论上简单地使用安全级别并避免在过滤引擎上使用 ACL 的额外复杂性是一个很好的概念,但实际上大多数人都需要对流量进行更精细的控制。

在您的实例中,检查您是否真的需要任何 ACL 来过滤流量,或者您是否可以简单地利用安全级别为您做出流量归档决策。如果您不需要显式 ACL,请删除它们。然后流量应该从较高安全级别的接口流向较低安全级别的接口。如果您需要 ACL,请添加一条规则,允许从 172.29.12.32/29 到 10.100.20.0/24 的流量,反之亦然。下面是如何执行此操作的示例。

;; Creates a global ACL permitting traffic from the dmz subnet to the dmz810 subnet     
access-list DMZ810-ALLOW extended permit ip 172.29.12.32 255.255.255.248 10.100.20.0 255.255.255.0 log

- 或者 -

;; More flexible as this creates a rule permitting traffic from whatever address
;; is assigned to the interfaces without further modification of the ACL (such
;; as if the address assigned to the dmz interface changes)

access-list DMZ810-ALLOW extended permit ip 172.29.12.32 255.255.255.248 interface dmz

;; If you are certain you wish all traffic from dmz810 to dmz to pass, it's probably
;; better to change security levels to be the same.  If that is not desired, you
;; can still permit traffic from whatever subnet is assigned to either of the interfaces
;; by using the interface keyword on both parts of the access list.

access-list ALLOW_DMZ810-to-DMZ extended permit ip interface dmz810 interface dmz

;; keep in mind that if you make these the same security level, or are utilizing zones,
;; you should probably read additional commands below to ensure this works.

请查看以下命令和注释以确保您获得预期的行为。第一个与相同的安全级别有关,第二个与区域之间的流量有关:

  • same-security-traffic permit inter-interface
    • PERMIT不同接口 具有相同安全级别的区域之间的通信 b
  • same-security-traffic permit intra-interface
    • PERMIT连接到同一接口和同一区域内不同接口的对等体之间的通信 b

请注意:如果您 没有 启用这些设置中的一个或两个,默认操作将是拒绝所有流量接口或接口内的流量, 在相同安全级别的所有接口中

我在 ASA 方面帮助过的许多人都误以为流量在默认情况下在相同的安全级别内是允许的。

当然,您必须更改 dmz810 的安全级别,这违背了您的问题的目的。

希望这可以帮助。

b直接来自 ASA5585-x v9.1 的 CLI 的内联帮助的措辞,添加了重点