跨交换机vlan内通信配置

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),

 实验到此成功。

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值