两个不同的子网有相同的网关 [英] Two different subnet having same gateway

查看:416
本文介绍了两个不同的子网有相同的网关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想给我的Windows服务器n linux服务器的静态ip但是当我这样做的时候我的默认网关显示linux中的目标主机无法访问我在linux上ping它告诉我现在该怎么办?



我的Windows服务器设置是

ipv4地址192.168.1.68

ipv4子网255.255.255.0

ipv4默认网关192.168.1.1



和我的linux服务器设置是

eth0链接封装:以太网HWaddr 00:0C:29:6B :E9:8A

inet addr:192.168.178.128 Bcast:192.168.178.255 Mask:255.255.255.0

inet6 addr:fe80 :: 20c:29ff:fe6b:e98a / 64范围:链接

UP广播运行多播MTU:1500公制:1

RX包:44949错误:0丢弃:0超支:0帧:0

TX包:34250错误:0丢弃:0超支:0运营商:0

冲突:0 txqueuelen:1000

RX字节:30998896(29.5 MiB) TX字节: 1860368(1.7 MiB)



lo链接封装:本地环回

inet addr:127.0.0.1掩码:255.0.0.0

inet6 addr ::: 1/128范围:主机

UP LOOPBACK RUNNING MTU:16436公制:1

RX包:231错误:0掉落:0超支:0帧:0

TX包:231错误:0丢弃:0超支:0运营商:0

冲突:0 txqueuelen:0

RX字节:23426(22.8 KiB)TX字节:23426(22.8 KiB)

i want to give static ip of both my windows server n linux server but when i do this then my default gateway shows Destination Host Unreachable in linux when i ping it in linux tell me what can i do now?

my windows server settings are
ipv4 address 192.168.1.68
ipv4 subnet 255.255.255.0
ipv4 default gateway 192.168.1.1

and my linux server settings are
eth0 Link encap:Ethernet HWaddr 00:0C:29:6B:E9:8A
inet addr:192.168.178.128 Bcast:192.168.178.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe6b:e98a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:44949 errors:0 dropped:0 overruns:0 frame:0
TX packets:34250 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:30998896 (29.5 MiB) TX bytes:1860368 (1.7 MiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:231 errors:0 dropped:0 overruns:0 frame:0
TX packets:231 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:23426 (22.8 KiB) TX bytes:23426 (22.8 KiB)

推荐答案

如果这是一个家庭网络,你没有enaugh网络知识,只需选择同一子网中的静态IP,即掩码中的值为1的所有数字,必须相同。

在您的情况下,子网为192.168.1.xxx(掩码255.255 .255.0),所以只需设置地址,这3个数字只会改变最后一个。

IE如果您的Windows机器具有地址192.168.1.68,您可以分配给Linux服务器192.168.1.128。

或者相反:Linux = 192.168.178.128 Windows = 192.168.178.68(使用linux子网192.168.178。 xxx)

我建议使用第一个解决方案,支持更标准的192.168.1.xxx私有地址。

当不同子网的设备必须互相交谈时必须安装一个名为路由器的设备,它有两个网络端口,一个在子网上,另一个在第二个网络上,其范围是在两个网络之间路由数据包。
If this is an home network, and you don't have enaugh network knowledge, simply choose static ip's in the same subnet, that is all numbers which value in the mask is one, must be the same.
In your case the subnet is 192.168.1.xxx (mask 255.255.255.0), so simply set the address with this 3 numbers changing only the last one.
I.E. If you windows machine has address 192.168.1.68 you can assign to Linux server 192.168.1.128.
Or the reverse: Linux=192.168.178.128 Windows=192.168.178.68 (using the linux subnet 192.168.178.xxx)
I sugggest to use the first solution in favour of the more standard 192.168.1.xxx private address.
When devices of different subnets have to talk each other you have to install a device called router, it has two network ports, one on a subnet and the other on the second network, which scope is to route packets between the two networks.


什么是你的机器之间的物理连接?如下所示?

What is your physical connection between machines? Like the one below?
                                    +-------- +
                               +----+ Windows | 192.168.1.68
+----------+    +--------+     |    +---------+
|  Gateway +----+ switch +-----+
+----------+    |        +-----+
 192.168.1.1    +--------+     |   +----------+
                               +---+  Linux   | 192.168.1.128
                                   +----------+



如果ping Linux服务器从windows可以看到它吗?

反过来?

来自windows机器还可以吗?

你确定Linux服务器IP吗?地址实际上是192.168.1.128?

我正在使用解空间来使图形可读。


If you ping the Linux server from windows can you see it?
And the reverse?
From windows machine is all ok?
Are you sure that the Linux server IP address is effectively 192.168.1.128 ?
I'm using solution space to make graph readable.


这篇关于两个不同的子网有相同的网关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆