在三层交换机和二层交换机做如何配置使这两台主机ping通

如题所述

第1个回答  推荐于2017-12-16
2种情况可以互通。
第1种,在网络中不划分VLAN时,网络二层互通,不需要通过路由,则将2台电脑的IP地址设置为同一网段的地址,比如PC1 为192.168.1.1/24,PC2 为192.168.1.2/24,就可以互通。
第2种,在二层交换机上划分了VLAN,那么,假设图左边的交换机为S1,接口VLAN ID为10,右边的交换机为S2,接口VLAN ID为20,那么需要将2个二层交换机的上行口配置为TRUNK方式,并在三层交换机上配置2个VLAN的网关地址。同时在2台主机上配置相应网段的IP以及网关地址。
具体配置如下:
二层交换机S1:
S1#vlan database
S1(vlan)#vlan 10
S1(vlan)#exit
S1#conf t
S1(config)#int f0/2
S1(config-if)#switchport mode access
S1(config-if)#switchport acc vlan 10
S1(config)#int f0/1
S1(config-if)#switchport mode trunk

二层交换机S2:
S2#vlan database
S2(vlan)#vlan 20
S2(vlan)#exit
S2#conf t
S2(config)#int f0/2
S2(config-if)#switchport mode access
S2(config-if)#switchport acc vlan 20
S2(config)#int f0/1
S2(config-if)#switchport mode trunk

三层交换机S3:
S3#vlan database
S3(vlan)#vlan 10
S3(vlan)#vlan 20
S3(vlan)#exit
S3#conf t
S3(config)#interface vlan 10
S3(config-if)#ip add 192.168.10.1 255.255.255.0
S3(config-if)#int vl 20
S3(config-if)#ip add 192.168.20.1 255.255.255.0
S3(config-if)#end
S3#sh ip route

Gateway of last resort is not set

C 192.168.10.0/24 is directly connected, Vlan10
C 192.168.20.0/24 is directly connected, Vlan20

配置完成,然后将PC1的地址设置为192.168.10.2,掩码255.255.255.0,网关192.192.168.10.1
PC2的地址设置为192.168.20.2,掩码255.255.255.0,网关192.192.168.20.1
在PC2 Ping PC1,有如下结果:

PC>ping 192.168.10.2

Pinging 192.168.10.2 with 32 bytes of data:

Request timed out.
Reply from 192.168.10.2: bytes=32 time=125ms TTL=127
Reply from 192.168.10.2: bytes=32 time=124ms TTL=127
Reply from 192.168.10.2: bytes=32 time=110ms TTL=127本回答被提问者采纳
第2个回答  2012-04-05
简单,设置下网关就好了!
第3个回答  2012-04-04
哈,有问同样问题,不是成功吗?
相似回答