扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
1:创建一个vlan map
Step 1 configure terminal
Step 2 vlan access-map name [number] 创建一个VLAN地图,并起名字和定义一个号码
Step 3 action {drop | forward} (Optional) 设置访问VLAN地图的行为,默认为转送
Step 4 match {ip | mac} address {name |number} [name | number]
用IP或者MAC匹配包来配对一个或多个标准或者扩展访问列表
Step 5 end
注:使用 no vlan access-map name 全局命令删除一个vlan map.
例1:
此例指出如何创建一个ACL和VLAN地图来禁止数据包。在第一个地图里面,所有的数据包匹配IP1 ACL(TCP数据包)的都会被丢弃。你先创建IP1ACL,只允许所有TCP数据包。因为VLAN地图中有一个IP数据包的匹配语句,它的默认行为是丢弃所有不符合条件的数据包。
Switch(config)# ip access-listextended ip1
Switch(config-ext-nacl)# permit tcp any any
Switch(config-ext-nacl)# exit
Switch(config)# vlan access-map map_1 10
Switch(config-access-map)# match ip address ip1
Switch(config-access-map)# action drop
Example 2
This example shows how to create a VLAN map to permit a packet. ACL ip2 permits UDP packets and any packets that match the ip2 ACL are forwarded.
Switch(config)# ip access-list extended ip2
Switch(config-ext-nacl)# permit udp any any
Switch(config-ext-nacl)# exit
Switch(config)# vlan access-map map_1 20
Switch(config-access-map)# match ip address ip2
Switch(config-access-map)# action forward
Example 3
In this example, the VLANmap has a default action of drop for MAC packets and a default action of forward for IP packets. Used with MAC extended accesslists good-hosts and good-protocols, the map will have the following results:
? Forward MAC packets from hosts 0000.0c00.0111 and 0000.0c00.0211
? Forward MAC packets with decnet-iv or vines-ip protocols
? Drop all other non-IP packets
? Forward all IP packets
Switch(config)# mac access-listextended good-hosts
Switch(config-ext-macl)# permit host 000.0c00.0111 any
Switch(config-ext-macl)# permit host 000.0c00.0211 any
Switch(config-ext-nacl)# exit
Switch(config)# mac access-list extended good-protocols
Switch(config-ext-macl)# permit any any decnet-ip
Switch(config-ext-macl)# permit any any vines-ip
Switch(config-ext-nacl)# exit
Switch(config)# vlan access-map drop-mac-default 10
Switch(config-access-map)# match mac address good-hosts
Switch(config-access-map)# action forward
Switch(config-access-map)# exit
Switch(config)# vlan access-map drop-mac-default 20
Switch(config-access-map)# match mac address good-protocols
Switch(config-access-map)# action forward
2:将vlan map 指定到一个vlan 上
Step 1 configure terminal
Step 2 vlan filter mapname vlan-list list Apply the VLAN map to one or more VLAN IDs.
The list can be a single VLAN ID (22), a consecutive list (10-22), or a string of VLAN IDs (12, 22, 30)。 Spaces around the comma and hyphen are optional.
To remove the VLAN map, use the no vlan filter mapname vlan-list list global configuration command.
Example 1
If you do not want HTTP traffic switched from Host X to Host Y, you can configure a VLAN map on
Switch A to drop all HTTP traffic from Host X (IP address 10.1.1.32) to Host Y (IP address 10.1.1.34)at Switch A and not bridge it to Switch B.
1、define the IP access list http that permits (matches) any TCP traffic on the HTTP port.
Switch(config)# ip access-list extended http
Switch(config-ext-nacl)# permit tcp host 10.1.1.32 host 10.1.1.34 eq www
Switch(config-ext-nacl)# exit
2、create VLAN access map map2 so that traffic that matches the http access list is dropped and all other IP traffic is forwarded.
Switch(config)# vlan access-map map2 10
Switch(config-access-map)# match ip address http
Switch(config-access-map)# a
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。