发布时间 : 星期六 文章学会VLAN的基础配置更新完毕开始阅读
--------------------------------------------------------------------------------
U: Up; D: Down; TG: Tagged; UT: Untagged; MP: Vlan-mapping; ST: Vlan-stacking; #: ProtocolTransparent-vlan; *: Management-vlan;
-------------------------------------------------------------------------------- VID Type Ports
--------------------------------------------------------------------------------
1 common UT:Eth0/0/1(U) Eth0/0/3(U) Eth0/0/4(D) Eth0/0/5(D)
Eth0/0/6(D) Eth0/0/7(D) Eth0/0/8(D) Eth0/0/9(D)
Eth0/0/10(D) Eth0/0/11(D) Eth0/0/12(D) Eth0/0/13(D)
Eth0/0/14(D) Eth0/0/15(D) Eth0/0/16(D) Eth0/0/17(D)
Eth0/0/18(D) Eth0/0/19(D) Eth0/0/20(D) Eth0/0/21(D)
Eth0/0/22(D) GE0/0/1(D) GE0/0/2(D) 2 common UT:Eth0/0/2(U) TG:Eth0/0/3(U)
VID Status Property MAC-LRN Statistics Description --------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001 2 enable default enable disable VLAN 0002
3、接口与VLAN关联的配置
1 当交换机需要与网络层的设备通信时,可以在交换机上创建基于VLAN的◇
逻辑接口,即VLANIF接口。VLANIF接口属于逻辑接口,逻辑接口是指物理上不存在且需要通过配置建立的接口。
VLANIF接口是网络层接口,创建VLANIF接口前要先创建了对应的VLAN,才可以配置IP地址。借助VLANIF接口,交换机就能与其它网络层的设备互相通信。
2接口与VLAN的配置如下: ◇
LSW1:
[LSW1]int Vlanif 1 [LSW1-Vlanif1]ip add 192.168.1.1 24 [LSW1-Vlanif1]int vlanif 2 [LSW1-Vlanif2]ip add 192.168.2.1 24 [LSW1-Vlanif2]q
//进入vlan1的逻辑接口 //配IP地址
//进入vlan2的逻辑接口 //配IP地址
LSW2:
[LSW2]int Vlanif 1 //进入vlan1的逻辑接口 [LSW2-Vlanif1]ip add 192.168.1.254 24 //配IP地址 [LSW2-Vlanif1]int vlanif 2 //进入vlan2的逻辑接口 [LSW2-Vlanif2]ip add 192.168.2.254 24 //配IP地址 [LSW2-Vlanif2]q
#在LSW1二层交换机上拼LSW2的地址是可以拼通的,如下所示,它们之间链路是trunk
[LSW1]ping 192.168.1.254
PING 192.168.1.254: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.254: bytes=56 Sequence=1 ttl=255 time=60 ms Reply from 192.168.1.254: bytes=56 Sequence=2 ttl=255 time=50 ms Reply from 192.168.1.254: bytes=56 Sequence=3 ttl=255 time=40 ms Reply from 192.168.1.254: bytes=56 Sequence=4 ttl=255 time=30 ms Reply from 192.168.1.254: bytes=56 Sequence=5 ttl=255 time=40 ms
--- 192.168.1.254 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss
round-trip min/avg/max = 30/44/60 ms
[LSW1]ping 192.168.2.254
PING 192.168.2.254: 56 data bytes, press CTRL_C to break
Reply from 192.168.2.254: bytes=56 Sequence=1 ttl=255 time=70 ms Reply from 192.168.2.254: bytes=56 Sequence=2 ttl=255 time=50 ms Reply from 192.168.2.254: bytes=56 Sequence=3 ttl=255 time=40 ms Reply from 192.168.2.254: bytes=56 Sequence=4 ttl=255 time=40 ms Reply from 192.168.2.254: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 192.168.2.254 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss
round-trip min/avg/max = 20/44/70 ms
四、实验目的
1、链路类型
VLAN内的链路可以分为:
? 接入链路(Access Link):连接用户主机和交换机的链路为接入链路。PC机和交换机之间的链路都是接入链路。接入链路上通过的帧为不带Tag的以太网帧。
? 干道链路(Trunk Link):连接交换机和交换机的链路称为干道链路。交换机之间的链路都是干道链路。干道链路上通过的帧一般为带Tag的VLAN帧。
2、Access类型的端口只能属于1个VLAN,一般用于连接计算机的端口;Trunk类型的端口可以属于多个VLAN,可以接收和发送多个VLAN的报文,一般用于交换机之间连接的端口
3、某个端口从trunk改为hybrid或access模式改不了,提示如下的错误: Error: Please renew the default configurations. #解决命令如下: 进端口下
port trunk allow-pass vlan 1 undo port link-type 然后再设置就可以了