
其中硬件接如下[/b]
路由器 一个接口 fast ethernet 0/0
交换机 12个ethernet接口和一个fast 0/26接口 ethernet 0/1 - 0/12 ,fastethernet 0/26
(和pc1连的是 e0/1 ,和pc2连的是 e0/2,和路由器连的是 fa0/26)
pc机两台
[b]1.路由器的配置
router>en
router#config terminal
router(config)#interface 0/0
router(config-if)#no shutdown
router(config-if)#exit
router(config)#int fast 0/0.1
router(config-if)#ip address 1.1.1.1 255.255.255.0
router(config-if)#exit
router(config)#int fast 0/0.2
router(config-if)#ip address 1.1.2.1 255.255.255.0
router(config-if)#end

pc1的设置
IP 1.1.1.2/24 gateway 1.1.1.1

pc2的设置(图略同上)
IP 1.1.2.2/24 gateway 1.1.2.1
经过上述配置后,我们应该能在pc1,pc2,router上能相互ping通
实验效果图如下所示
pc1电脑

pc2电脑

router上

2.在交换机上划分两个vlan2,vlan3

3.
将pc1对应的端口1划分到vlan2,pc2对应的端口2划分到vlan3

4.现在由于pc1,pc2处在两个不同的vlan上,现在是ping不通了的,现在我们可以试一下

5
下面我们需要在交换机上的fa0/26配置trunk 中继
(解释如下:Now that we have setup our VLANs we need to turn on trunking for our Fast Ethernet port that is connected to eRouter1. Trunking allows a single port to carry multiple VLANs. Trunk links are used to transport multiple VLANs between devices on your network. Trunking is only supported on Fast Ethernet interfaces. Trunking has two different encapsulation methods, ISL and 802.1q)

6.在路由器上新建的两个逻辑子接口上封装协议

现在我们会发现,划分到不同的两个vlan2,vlan3中的两台pc1,pc2又可以拼通了
pc1上

pc2上

根据上述显示的信息,我们看出vlan1,vlan2间的相互通信的实验已经成功了!
最后,我们可以看一下交换机上的vlan和vlan-membership的相关信息







