案例:
Switch(config)# access-list 102 deny tcp 171.69.198.0 0.0.0.255 172.20.52.0 0.0.0.255 eq telnet
Switch(config)# access-list 102 permit tcp any any
Switch(config)# end
Switch# show access-lists
Extended IP access list 102
10 deny tcp 171.69.198.0 0.0.0.255 172.20.52.0 0.0.0.255 eq telnet
20 permit tcp any any
c.命名访问控制列表
命名的列表允许使用超过99个标准控制列表和100个扩展控制列表。优于编号的控制列表的特点是可以删除特定的一条语句,而编号访问控制列表只能删除整个访问控制。
Ip access-list [standard|extended] 名称
Permit|deny 标准和扩展有所不同
案例:
Switch(config)# ip access-list extended border-list
Switch(config-ext-nacl)# no permit ip host 10.1.1.3 any
2) 定义VACL映射表
vlan access-map 名称
a) 匹配指定的IP访问控制列表 match ip address 访问列表号
匹配指定的mac访问控制列表 match mac address 访问控制列表
b) 指定对符合条件的流量进行何动作 action drop|forward
案例:
switch(config)#vlan access-map test
switch(config-access-map)#match ip address 101
switch(config-access-map)#action forward
3) 将VACL映射表应用到某个VLAN
vlan filter 映射表名称 vlan-list vlan列表
案例:
vlan filter test vlan-list 10
4) 验证结果
show vlan access-map 名称
Switch#show vlan access-map
Vlan access-map "test" 10
Match clauses:
ip address: 100
Action:
drop
Vlan access-map "test" 20
Match clauses:
Action:
forward
---------------------------------------------------
show vlan filter access-map 名称 | vlan vlan号
Switch#show vlan filter
VLAN Map test is filtering VLANs:
11-13
案例:
switch#configure terminal
switch(config)#mac access-list extended cisco
switch(config-ext-macl)#permit host 0011.abcd.abcd host 0011.1111.1111
switch(config-ext-macl)#exit
switch(config)#access-list 101 deny ip 10.10.1.0 0.0.0.255 host 10.10.2.2
switch(config)#access-list 101 permit ip any any
switch(config)#interface f0/23
switch(config-if)#switchport mode trunk
switch(config-if)#ip access-group 101 in
switch(config-if)#mac access-group cisco in
switch(config-if)#end
switch#show access-lists
switch#show access-group interface f0/23
案例:
CCIE-LAB(v133)
题目要求:
Assume that connected to port f0/15 on SW1 is a host sending Ethernet Type 6000 frames into the network configures an access-list to block only this traffic allowing other frames to enter into the network.Please use “Block_eth6000” as the name of access-list.
配置:
SW1
configure terminal
mac access-list extended Block_eth6000
deny any any etype-6000
permit any any
interface f0/15
switchport mode access
mac access-group Block_eth6000 in