二层交换配置完ping失败_在三层交换机和二层交换机做怎么配置使这两台主机ping通...

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

取消

评论

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值