VLAN(Virtual Local Area Network)的中文名为"虚拟局域网"。VLAN是一种将局域网设备从逻辑上划分成一个个网段,从而实现虚拟工作组的新兴数据交换技术。本文是小编带来如何实现同一路由器不同vlan之间的通信,大家可以参考了解下!
第一步,看拓扑图。
先把pc上的ip都配好。开始设置
switch0:
>en
>conf t
>vlan 2
>exit
>int fa 0/1
>switchport access vlan 2
>exit
>int fa 0/2
>switchport access vlan 2
>exit
>int fa 0/3
>switchport mode trunk
>end
switch1:
>en
>conf t
>vlan 3
>exit
>int fa 0/1
>switchport access vlan 3
>exit
>int fa 0/2
>switchport access vlan 3
>exit
>int fa 0/3
>switchport mode trunk
>end
Router0:
>enable
>configure terminal
>interface fastEthernet 0/0
>no ip adderss //清除ip
>no shutsown
>exit
>interface fastEthernet 0/0.1 //子接口设置
>encapsulation dot1Q 2 //封装协议 连到vlan 2
>ip address 192.168.0.1 255.255.255.0
>exit
>interface fastEthernet 0/1
>no ip adderss //清除ip
>no shutsown
>exit
>interface fastEthernet 0/1.1 //子接口设置
>encapsulation dot1Q 3 //封装协议 连到vlan 3
>ip address 192.168.1.1 255.255.255.0
>end
pc0 CMD:
ping PC1
ping PC 3