您的位置:首页 > 其它

跨交换机vlan内通信配置

2017-09-25 10:27 337 查看
1.跨交换机vlan内通信配置:

 

Vlan技术原理:虚拟局域网是接入层将各个业务服务器分开的数据链路层解决方案(实际就是起到在一个局域网内实现业务隔离的作用)。VLAN主要用于路由器和交换机中,特别的,只有遵循vlan协议的第二层以上交换机才具有此功能。

 

网络拓扑:



实验目的:

1—  在同一台交换机上创建不同vlan,验证不能ping通

2—  在不同交换机上配置Trunk链路并创建相同vlan,验证可ping通

 

实验过程(我在模拟器上做,真实机命令也相同):

在交换机1上(2上同样操作):

Switch>en

Switch#conf t

Enterconfiguration commands, one per line. End with CNTL/Z.

Switch(config)#vlan2                 //创建vlan2

Switch(config-vlan)#exit

Switch(config)#vlan3                 //创建vlan3

Switch(config-vlan)#exit

Switch(config)#interfacefastEthernet 0/1

Switch(config-if)#switchport access vlan 2  //进入交换机口1将所连得PC加入到vlan2里

Switch(config-if)#exit

Switch(config)#interface fastEthernet 0/2 

Switch(config-if)#switchport access vlan 3  //进入交换机口2将所连得PC加入到vlan3里

 

Switch(config-if)#exit

Switch(config)#exit

Switch#

%SYS-5-CONFIG_I:Configured from console by console

 

Switch#showrunning-config

Buildingconfiguration...

 

Currentconfiguration : 1029 bytes

!

version 12.1

no servicetimestamps log datetime msec

no servicetimestamps debug datetime msec

no servicepassword-encryption

!

hostname Switch

!

!

!

spanning-tree modepvst

!

interfaceFastEthernet0/1

switchportaccess vlan 2

!

interfaceFastEthernet0/2

switchportaccess vlan 3

!

interfaceFastEthernet0/3

 

实验做到这里时,将各主机IP配好后,各个主机和其他主机都不能ping通,原因是1和2不在同一网段,主要原因是不在同一vlan;1和3虽然在同一网段但此时两个交换机之间没有做连接

 

配置trunk链路(两个交换机做同样的操作):

Switch#conf t
Enter configuration commands, one per line. End withCNTL/Z.
Switch(config)#interface fastEthernet 0/24
Switch(config-if)#switchport mode trunk
 

验证:PC1去ping:

PC>ping192.168.10.3

 

Pinging192.168.10.3 with 32 bytes of data:

 

Reply from192.168.10.3: bytes=32 time=11ms TTL=128

Reply from192.168.10.3: bytes=32 time=0ms TTL=128

Reply from 192.168.10.3:bytes=32 time=0ms TTL=128

Reply from192.168.10.3: bytes=32 time=0ms TTL=128

 

Ping statisticsfor 192.168.10.3:

Packets: Sent = 4,Received = 4, Lost = 0 (0% loss),

Approximate roundtrip times in milli-seconds:

Minimum = 0ms,Maximum = 11ms, Average = 2ms

 

PC>ping192.168.20.1

 

Pinging192.168.20.1 with 32 bytes of data:

 

Request timed out.

Request timed out.

Request timed out.

Request timed out.

 

Ping statisticsfor 192.168.20.1:

Packets: Sent = 4,Received = 0, Lost = 4 (100% loss),

 实验到此成功。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  交换机 通信