要知道ip是来自同一网络还是不同

时间:2014-03-23 06:09:49

标签: networking

源主机的IP地址为10.192.240.10,目的地为10.192.250.10。这两个主机是否驻留在同一网络上? 如果是这样,我们怎样才能找到它。

1 个答案:

答案 0 :(得分:3)

首先要知道的是网络掩码。如果不同的位在网络掩码的零范围内,则它们应该在同一网络上路由。例如,我的家庭网络使用192.168.0.0/255.255.254.0,这意味着192.168.0.0-192.168.1.255由我的家庭路由器路由... 192.168.1.10192.168.0.10在同一网络上。

您还可以尝试从一个到另一个进行traceroute以确定跳数。一跳意味着主机之间没有活动路由,因此很可能是同一网络。

一跳,同一网络(有点......桌面是有线连接,远程是无线连接;但从IP的角度来看,相同):

paulw@desktop:~/PROJ$ traceroute 192.168.1.208
traceroute to 192.168.1.208 (192.168.1.208), 30 hops max, 60 byte packets
 1  remote (192.168.1.208)  218.838 ms  219.288 ms  219.484 ms
paulw@desktop:~/PROJ$ 

许多啤酒花,不同的网络:

paulw@desktop:~/PROJ$ traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  router.asus.com (192.168.1.1)  0.232 ms  0.410 ms  0.485 ms
 2  xx.xxx.xx.x (xx.xxx.xx.x)  161.662 ms  161.701 ms  161.701 ms
 3  xe-10-3-3-32767-sur03.arvada.co.denver.comcast.net (68.86.129.153)  87.925 ms  87.963 ms  88.518 ms
 4  te-0-13-0-2-ar02.denver.co.denver.comcast.net (162.151.8.41)  89.585 ms xe-10-0-2-0-sur02.arvada.co.denver.comcast.net (68.86.128.138)  89.493 ms te-0-13-0-2-ar02.denver.co.denver.comcast.net (162.151.8.41)  89.574 ms
 5  pos-0-7-0-0-ar02.aurora.co.denver.comcast.net (68.86.128.246)  91.431 ms  92.441 ms  97.540 ms
 6  he-3-9-0-0-cr01.denver.co.ibone.comcast.net (68.86.92.21)  92.421 ms  95.757 ms  96.290 ms
 7  xe-1-0-2-0-pe01.910fifteenth.co.ibone.comcast.net (68.86.84.122)  159.017 ms  74.074 ms  74.119 ms
 8  as15169-1-c.910fifteenth.co.ibone.comcast.net (23.30.206.106)  74.667 ms  73.637 ms  73.654 ms
 9  72.14.234.59 (72.14.234.59)  74.204 ms 72.14.234.57 (72.14.234.57)  78.921 ms 72.14.234.59 (72.14.234.59)  77.861 ms
10  216.239.46.146 (216.239.46.146)  89.413 ms 216.239.46.150 (216.239.46.150)  84.180 ms 216.239.46.146 (216.239.46.146)  83.705 ms
11  216.239.46.55 (216.239.46.55)  88.090 ms 72.14.239.50 (72.14.239.50)  27.409 ms  81.115 ms
12  216.239.46.193 (216.239.46.193)  85.238 ms 216.239.46.191 (216.239.46.191)  81.420 ms 216.239.43.217 (216.239.43.217)  81.457 ms
13  * * *
14  google-public-dns-a.google.com (8.8.8.8)  82.888 ms  83.473 ms  85.024 ms
paulw@desktop:~/PROJ$