Cisco交换机VLAN基本配置

(0 comments)

实验环境中,一台Cisco交换机,一台路由器,两台PC。先将两台PC指向不同的VLAN,然后通过建立交换机到路由器的Trunk,连通分别属于不同VLAN的两台PC。

第一步,在交换机上新建两个VLAN。

> en
# conf t
(config)# vlan 2 name VLAN2
(config)# vlan 3 name VLAN3

然后,将交换机上两个端口分别指向不同的VLAN。

(config)# int e0/1
(config-if)# vlan-membership static 2
(config-if)# exit
(config)# int e0/2
(config-if)# vlan-membership static 3

这时,连接在属于两个不同的VLAN端口上的计算机不能互通了,为了连通两个VLAN,需要通过路由器来实现。

通常情况下,一个端口只能属于一个VLAN,为了让一个端口同时承载多个VLAN信息,必须在该端口启动Trunk。启用Trunk的端口要求一定要是高速以太网接口,先在交换机连接路由器的端口上启用Trunk功能。

(config)# int interface Fast0/26
(config-if)# trunk on

同时在路由器上,配置虚拟端口到不同的VLAN

eRoute1(config)# int f0/0.1
eRoute1(config-subif)# encap isl 2
eRoute1(config-subif)# exit
eRoute1(config)# int f0/0.2
eRoute1(config-subif)# encap isl 3

下面两条命令以不同的显示方式查看VLAN端口的配置。

# show vlan
# show vlan-membership
Currently unrated

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required