正常情况下ACL直接在接口下调用ACL做到访问控制,当然也可以在VLAN下调用ACL。在接口下调用很好明白数据流in和out方向,那在VLAN下有这么区分in和out呢?
VLAN下IN和OUT主要看在ACL在你的VLAN所在网段地址是源地址还是目的地址。如果VLAN所在网段地址作为源对外访问就是IN方向,反之VLNA所在网段地址是数据流的目的地址既是OUT方向。
案例环境1:
禁止VLAN50段和VLAN100段互访,ACL调用在VLAN100下。ACL源地址为VLAN100段地址
acl规则:
ip access-list 50-100deny
rule 5 deny ip source 192.168.100.0 0.0.0.255 destination 192.168.50.0 0.0.0.255
vlan下调用:
int vlanif 100
ip access-group 50-100deny in
此ACL规则源为192.168.100.0段,对VLAN100下属于数据流in方向
案例环境2:
禁止VLAN50段和VLAN100段互访,ACL调用在VLAN100下。ACL源地址为VLAN50段地址
acl规则:
ip access-list 100-50deny
rule 5 deny ip source 192.168.50.0 0.0.0.255 destination 192.168.100.0 0.0.0.255
vlan下调用:
int vlanif 100
ip access-group 100-50 deny out
此ACL规则源为192.168.50.0段,对VLAN100下属于数据流out方向