ensp学习第六弹vlan


vlan

vlan基础配置

实验拓扑

vlan 2
vlan 3
或者使用
vlan batch 2 to 3 10
int e 0/0/1 
	port link-type access
	port default vlan 2

vlan间通信

实验拓扑

通过Dot1q终结子接口实现VLAN间互访

对R2 和R3的0/0/1端口配置IP

[R2]int g 0/0/1
		ip add 192.168.2.1 24 
	ip router-static 0.0.0.0 0 192.168.2.254
[R3]int g 0/0/1
		ip add 192.168.3.1 24
	ip router-static 0.0.0.0 0 192.168.3.254

在S1上划分vlan

vlan batch 2 3
int g 0/0/2
	port link-type access
	port default vlan 2
int g 0/0/3
	port link-type access
	port default vlan 3
int g 0/0/1
	port link-type trunk
	port trunk allow-pass vlan 2 3

在R1上创建并配置Dotlq终接子接口

• Dot1q终结子接口:子接口也是一种三层的逻辑接口。跟VLANIF接口一样,在子接口上配置Dot1q终结功能和IP地址后,设备也会添加相应的MAC表项并置位三层转发标志位,进而实现VLAN间的三层互通。Dot1q终结子接口适用于通过一个三层以太网接口下接多个VLAN网络的环境。

dot1q termination vid vlan-id命令用来配置子接口Dot1q终结的VLAN ID。

当GigabitEthernet0/0/1接口收到带有VLAN 2标签的数据之后,会交由2号子接口进行VLAN终结操作并做后续处理。从2号子接口发出的数据也会带上VLAN 2的标签。

[R1]int g 0/0/1.2
		dot1q termination vid 2
		arp broadcast enable
		ip address 192.168.2.254 24
		quit
	int g 0/0/1.3
		dot1q termination vid 3
		arp broadcast enable
		ip address 192.168.3.254 24
		quit

R2 ping R3

通过VLANIF接口实现VLAN间互访

删除上一步的配置内容

[S1]int g 0/0/1
		undo port trunk allow-pass vlan 2 3
		undo link-type
[R1]undo int g 0/0/1.2
	undo int g 0/0/1.3
	

在S1上创建VLANIF接口

int VLANIF 2
	ip add 192.168.2.254 24
int VLANIF 3
	ip add 192.168.3.254 24

R2上ping R3

hybird:混合端口,有access的特性,又有trunk的特性,你可以把他当作access使用,也可以当作trunk去使用

大型的运营商网络会使用这种混合接口去,这种事更优的选择


文章作者: 毛豆不逗比
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 毛豆不逗比 !
  目录
{% include '_third-party/exturl.swig' %} {% include '_third-party/bookmark.swig' %} {% include '_third-party/copy-code.swig' %} + {% include '_custom/custom.swig' %}