如何将 ACL 应用于第 3 层交换机上的接口?

网络工程 思科 转变 第 3 层 acl 数据包跟踪器
2022-02-02 10:01:21

我尝试在 L3 交换机接口上接受 ACL。我通过以下方式创建了标准 ACL:

SW-L3(config)#access-list 1 permit host 1.1.1.2
SW-L3(config)#access-list 1 permit host 1.1.1.3

然后我尝试执行这个,但是没有这样的命令:

SW-L3(config)#int fa0/5
SW-L3(config-if)#ip access-group 
                 ^
% Invalid input detected at '^' marker.

(如果重要,我使用数据包跟踪器 7)

那么,我做错了什么?是否可以处理 L3 交换机上的 ACL?

#

我又被 ACL 困住了。我的方案是: 在此处输入图像描述

L3 sh run

interface Vlan1
ip address 192.168.10.1 255.255.255.0
interface Vlan10
mac-address 00d0.bca6.0e03
no ip address
interface Vlan111
mac-address 00d0.bca6.0e01
ip address 1.1.1.1 255.255.255.0
interface Vlan222
mac-address 00d0.bca6.0e02
ip address 2.2.2.1 255.255.255.0
ip classless
ip flow-export version 9
access-list 1 permit host 2.2.2.2

我想只能从“2.2.2.2”访问服务器。我有 ACL:

access-list 1 permit host 2.2.2.2

在 int fa0/5 IN 上。但它不起作用。pkt文件在这里

1个回答

默认情况下,Cicso L3 交换机上的接口是第 2 层,因此您必须将 ACL 应用于 SVI(VLAN 接口)。为了使接口成为第 3 层接口,请使用命令

no switchport

编辑:我不知道哪个接口是 Fa0/5,但我也注意到您没有将 ACL 应用于任何接口。

如果要使用标准 ACL,可以在 VLAN 出站上应用 ACL 1:

Interface VLAN 1
ip access-group 1 out

更好的方法是在入站接口上使用扩展 ACL:

access-list 100 permit ip host 192.168.10.2  host 2.2.2.2
interface VLAN 1
ip access-group 100 in