
基于MAC地址划分VLAN配置示例
1、组网需求
图1 配置基于MAC地址的VLAN划分组网图
如上图1所示,某个公司的网络中,网络管理者将同一部门的员工划分到同一VLAN。为了提高部门内的信息安全,要求只有本部门员工的PC才可以访问公司网络。
PC1、PC2、PC3为本部门员工的PC,要求这几台PC可以通过Switch访问公司网络,如换成其他PC则不能访问。
可以配置基于MAC地址划分VLAN,将本部门员工PC的MAC地址与VLAN绑定,从而实现该需求。
2、配置思路
采用如下的思路配置基于MAC地址的VLAN划分:
2.1、创建VLAN,确定员工所属的VLAN。
2.2、配置各以太网接口以正确的方式加入VLAN,实现接口允许VLAN报文通过。
2.3、配置PC1、PC2、PC3的MAC地址与VLAN关联,实现根据报文中的源MAC地址确定VLAN。
3、操作步骤
3.1、配置Switch
# 创建VLAN
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] vlan batch 10
# 配置接口加入VLAN。GE1/0/3、GE1/0/4的配置与GE1/0/2类似,不再赘述。
[Switch] interface gigabitethernet 1/0/1
[Switch-GigabitEthernet1/0/1] port link-type hybrid
[Switch-GigabitEthernet1/0/1] port hybrid tagged vlan 10
[Switch-GigabitEthernet1/0/1] quit
[Switch] interface gigabitethernet 1/0/2
[Switch-GigabitEthernet1/0/2] port link-type hybrid
[Switch-GigabitEthernet1/0/2] port hybrid untagged vlan 10
[Switch-GigabitEthernet1/0/2] quit
# PC的MAC地址与VLAN10关联
[Switch] vlan 10
[Switch-vlan10] mac-vlan mac-address 22-22-22
[Switch-vlan10] mac-vlan mac-address 33-33-33
[Switch-vlan10] mac-vlan mac-address 44-44-44
[Switch-vlan10] quit
# 使能接口的基于MAC地址划分VLAN功能,GE1/0/3、GE1/0/4的配置与GE1/0/2类似,不再赘述。
[Switch] interface gigabitethernet 1/0/2
[Switch-GigabitEthernet1/0/2] mac-vlan enable
[Switch-GigabitEthernet1/0/2] quit
4、检查配置结果
PC1、PC2、PC3可以访问公司网络,如换成其他外来人员的PC则不能访问。
5、配置文件
Switch的配置文件
#
sysname Switch
#
vlan batch 10
#
vlan 10
mac-vlan mac-address 0022-0022-0022 priority 0
mac-vlan mac-address 0033-0033-0033 priority 0
mac-vlan mac-address 0044-0044-0044 priority 0
#
interface GigabitEthernet1/0/1
port link-type hybrid
port hybrid tagged vlan 10
#
interface GigabitEthernet1/0/2
port link-type hybrid
port hybrid untagged vlan 10
mac-vlan enable
#
interface GigabitEthernet1/0/3
port link-type hybrid
port hybrid untagged vlan 10
mac-vlan enable
#
interface GigabitEthernet1/0/4
port link-type hybrid
port hybrid untagged vlan 10
mac-vlan enable
#
return



本文地址:http://www.023wg.com/vlan/130.html
版权声明:若无注明,本文皆为“Swiers思唯网络博客”原创,转载请保留文章出处。

