HCIE_R&S_交换技术_VLAN_实验

摘要

  本文取自HCIE R&S实验,引用[HCIE_R_S :: 第9章 :: 第1节 VLAN]。

根据MAC地址划分VLAN

实验原理

  将MAC地址与VLAN之间建立一个函数映射关系。

网络拓扑

配置代码

#S1

sys
sys S1

vlan 10
mac-vlan mac-addr 5489-982B-3468
mac-vlan mac-addr 5489-987A-19BC
mac-vlan mac-addr 5489-98C9-3DD3

int e0/0/1
port link-type hybrid
port hybrid untagged vlan 10
mac-vlan en

int e0/0/2
port link-type hybrid
port hybrid untagged vlan 10
mac-vlan en

int e0/0/3
port link-type hybrid
port hybrid untagged vlan 10
mac-vlan en

int g0/0/1
port link-type hybrid
port hybrid tagged vlan 10

#S2

sys
sys S2

vlan batch 10

int e0/0/1
port link-type acc
port default vlan 10

int g0/0/1
port link-type hybrid
port hybrid tagged vlan 10

基于子网划分VLAN

实验原理

  建立网段(ip_addr, mask)-> vlan之间的映射。

实验拓扑

配置代码

#S1

sys
sys S1

vlan 100
ip-subnet-vlan 1 ip 192.168.1.0 24 priority 2

vlan 200
ip-subnet-vlan 1 ip 192.168.2.0 24 priority 3

vlan 300
ip-subnet-vlan 1 ip 192.168.3.0 24 priority 4

int g0/0/1
port link-type hybrid
port hybrid untagged vlan 100 200 300
ip-subnet-vlan en

int g0/0/2
port link-type trunk
port trunk allow-pass vlan 100 200 300


#R1

sys
sys R1

vlan batch 100 200 300

int g0/0/1.100
ip addr 192.168.1.254 24
dot1q termination vid 100

int g0/0/1.200
ip addr 192.168.2.254 24
dot1q termination vid 200

int g0/0/1.300
ip addr 192.168.3.254 24
dot1q termination vid 300

基于协议划分VLAN

实验原理

  建立数据帧负载协议与VLAN之间的映射,使得特定协议的数据在某个特定的VLAN中传播。

实验拓扑

 

配置代码

#S1

sys
sys S1

vlan 10
protocol-vlan ipv4

vlan 20
protocol-vlan ipv6

  #PC1 IPv6
int g0/0/2
protocol-vlan vlan 10 all priority 5
port link-type hybird
port hybrid untagged vlan 10

  #PC2 IPv4
int g0/0/3
protocol-vlan vlan 20 all priority 6
port link-type hybrid
port hybrid untagged vlan 20

int g0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20

#Swicth

sys
sys Swicth

vlan batch 10 20

int g0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20

int g0/0/2
port link-type trunk
port trunk allow-pass vlan 10

int g0/0/3
port link-type trunk
port trunk allow-pass vlan 20

基于策略划分VLAN

实验原理

  根据MAC地址、IP地址、端口的组合划分VLAN。

实验拓扑

  

配置代码

#S1

sys
sys S1

	#创建VLAN2并且绑定MAC地址、IP地址、接口
vlan 2
policy-vlan mac-addr PC1_MAC_ADDR ip PC1_IP_ADDR g0/0/1 priority 7
	#创建VLAN3并且绑定MAC地址、IP地址、接口
vlan 3
policy-vlan mac-addr PC3_MAC_ADDR ip PC3_IP_ADDR g0/0/2 priority 5


int g0/0/1
port link-type hybrid
port hybrid untagged vlan 2

int g0/0/2
port link-type hybrid
port hybrid untagged vlan 3

int g0/0/3
port link-type trunk
port trunk allow-pass vlan 2 3

#S2

sys
sys S2
	#创建VLAN2并且绑定MAC地址、IP地址、接口
vlan 2
policy-vlan mac-addr PC2_MAC_ADDR ip PC2_IP_ADDR g0/0/1 priority 7
	#创建VLAN3并且绑定MAC地址、IP地址、接口
vlan 3
policy-vlan mac-addr PC4_MAC_ADDR ip PC4_IP_ADDR g0/0/2 priority 5

int g0/0/1
port link-type hybrid
port hybrid untagged vlan 2

int g0/0/2
port link-type hybrid
port hybrid untagged vlan 3

int g0/0/3
port link-type trunk
port trunk allow-pass vlan 2 3

猜你喜欢

转载自www.cnblogs.com/ycc1997/p/12112814.html