目录
—————————————————————————————————————————————————————————
定义一个三层ACL:
- 第一步:写ACL
-
- ①写三层ACL:
- access-list 101 per tcp host 192.168.100.1 host 192.168.200.1 eq 23 //出去的telnet
- access-list 101 per tcp host 192.168.200.1 eq 23 host 192.168.100.1 //对应返回的telnet
-
- ②写一个二层ACL:
- mac access-list extended name-mac //给扩展的ACL起个名字
- permit any any 0x0806 0x0 //任意源mac地址访问任意目的mac地址的arp执行的是放行( 0x806 二层帧的类型位,说明后面是ARP头部。0x0800后面是ip头部。0x0为反掩码)
- permit host 0001.0001.0001 host 0002.0002.0002 0x806 0x0
- permit host 0001.0001.0001 host 0002.0002.0002//放行所有的二层流量(arp、bpdu、vtp、ppoe、dtp..........)
- 注:0x0为0x0806的反掩码
- 第二步 :配置VACL,调用ACL
-
- vlan access-map aaa 10 //给vlan acl 起个名aaa,相当于一个大家庭,10是id,相当于家庭的某一个成员,意味着这个aaa下面可以调用多个AcL,用后面的id区分即可)
- match ip address 101 //调用三层ACL——101
- match mac address name-mac //调用name-mac二层acL
- action forward //执行动作放行
- exit
- 第三步:写一个空的access-map匹配所有剩余流量
-
- vlan access-map aaa 9999
- action drop //执行其他的丢弃
- exit
- 第四步:调用access-map,实现二次嵌套
-
- vlan filter aaa vlan-list 100 //在vlan 100里面应用vlan access-map
注:如果定义了三层ACL和二层ACL,一定要注意二层的操作,因为没有二层,三层也不管用。
(放行二层流量,arp是三层基础,一般要放行)
- 配置步骤:
-
- ******** 配置VLAN ********
-
-
- ******** 配置ACL ********
- Switch(config)# access-list 101 permit ip 192.168.10.0 0.0.0.255 192.168.30.0 0.0.0.255
- Switch(config)# access-list 101 permit ip 192.168.30.0 0.0.0.255 192.168.10.0 0.0.0.255
- (不同之处:因为VACL对数据流没有inbound和outbound之分,所以要把允许通过某vlan的IP数据流都permit才行。VLAN10允许与VLAN30通讯,而数据流又是双向的,所以要在ACL中增加VLAN30的网段)
- Switch(config)# access-list 102 permit ip 192.168.20.0 0.0.0.255 192.168.30.0 0.0.0.255
- Switch(config)# access-list 102 permit ip 192.168.30.0 0.0.0.255 192.168.20.0 0.0.0.255
-
- ******** 配置VACL ********
-
- 第一步:配置vlan access map
- Switch(config)# vlan access-map test1 //定义一个vlan access map,取名为test1
- Switch(config-vlan-access)# match ip address 101 // 设置匹配规则为acl 101
- Switch(config-vlan-access)# action forward // 匹配后,设置数据流转发(forward)
- Switch(config)# vlan access-map test2 //定义一个vlan access map,取名为test2
- Switch(config-vlan-access)# match ip address 102 // 设置匹配规则为acl 102
- Switch(config-vlan-access)# action forward // 匹配后,设置数据流转发(forward)
-
- 第二步:应用VACL
- Switch(config)# vlan filter test1 vlan-list 10 //将上面配置的test1应用到vlan10中
- Switch(config)# vlan filter test2 vlan-list 20 //将上面配置的test1应用到vlan20中
-
- ******** 完毕 ********
————————————————————————————————————————————————————————
- access-list 100 permit icmp host 192.168.100.1 host 192.168.100.2 echo//出去
- access-list 100 permit icmp host 192.168.100.2 host 192.168.100.1 echo-reply//回来
——————————————————————————————————————————————————————————
(34条消息) EtherType :以太网类型字段及值_eydwyz的专栏-CSDN博客_ethertype
——————————————————————————————————————————————————————————
三层ACL应用在二层端口(access接口或trunk接口)上;能控制VLAN内部访问也能控制VLAN间访问(相同vlan和不同vlan都能),
仅能在IN方向应用
(50条消息) VACLs与PACLs详解_weixin_33682719的博客-CSDN博客
- mac access-list extended sense
- permit host 0000.0000.0001 host 0000.0000.0002
-
- access-list 100 permit ip 10.1.1.0 0.0.0.255 any eq www
- access-list 100 deny ip any any
-
- interface f1/12
- switchport trunk encapsulation dot1q
- switchport mode trunk
- ip access-group 100 in
- mac access-group sense in