不知道如果IP在LAN或INET上 [英] At a loss figuring out if an IP is on LAN or INET

查看:96
本文介绍了不知道如果IP在LAN或INET上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个与内部和外部计算机通信的应用程序

我的路由器。所以我需要通过远程主机的IP地址确定是否需要

来发送我的局域网IP或我的互联网IP。有人建议你拿着IP

和我的子网掩码,但我想出了这个:


我的IP:192.168.0.14

面膜:255.255.255.0


结果:192.168.0.0


我应该比较前两个八位字节吗?或者是否存在

会导致错误结果的情况?

解决方案

特里,


AFAIK有三个供内部使用的范围


10.xxx

150.xxx

192.168.xx


如果我没有完全错误,那么前两个应该就够了。


Cor


" Terry Olsen" <到****** @ hotmail.com> schreef in bericht

news:ug ************** @ TK2MSFTNGP05.phx.gbl ...

我正在写作一个应用程序,它与我的路由器内外的计算机进行通信。所以我需要通过远程主机的IP地址确定
我是否需要向他们发送我的LAN IP或我的Internet IP。有人建议使用IP和我的子网掩码,但我想出了这个:

我的IP:192.168.0.14
面具:255.255.255.0

结果:1​​92.168.0.0

我应该比较前两个八位字节吗?或者是否存在这样会导致错误结果的情况?



Terry,


很抱歉,当我发送它时,我意识到它不是150,所以我在谷歌搜索了它的价格。


10.xxx

172.16.xx - 172.31.xx

192.168.xx


Cor


< blockquote>纠正你。


针对最后两个八位字节的测试应该足以确定

可路由与非可路由....也就是内部/外部。


现在,如果内部网络被配置为具有ROUTABLE的IP方案

IP(可以这样做 - 为什么?我不会'不知道......那会让它变得有点敏感。


-

Grumpy Aero Guy


" Cor Ligthert [MVP]" <无************ @ planet.nl>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP03.phx.gbl ...

特里,

AFAIK有三个范围供内部使用

10.xxx
150.xxx
192.168.xx

如果我没有完全错误,那么前两个应该足够了。

Terry Olsen <到****** @ hotmail.com> schreef in bericht
新闻:ug ************** @ TK2MSFTNGP05.phx.gbl ...

我正在写一个通讯的应用程序我的路由器外部和计算机都有。所以我需要通过远程主机的IP地址确定
我是否需要向他们发送我的LAN IP或我的Internet IP。有人建议使用IP和我的子网掩码,但我想出了这个:

我的IP:192.168.0.14
面具:255.255.255.0

结果:1​​92.168.0.0

我应该比较前两个八位字节吗?或者是否存在这样会导致错误结果的情况?




I''m writing an app that communicates with computers both inside and outside
my router. So I need to determine by the remote host''s IP address if I need
to send them my LAN IP or my Internet IP. Someone suggested AND''ing the IP
and my Subnet Mask but I come up with this:

My IP: 192.168.0.14
Mask: 255.255.255.0

Result: 192.168.0.0

Should I just compare the first two octets? Or are there situations where
this would provide incorrect results?

解决方案

Terry,

AFAIK are there three ranges reserved for internal use

10.x.x.x
150.x.x.x
192.168.x.x

If I am not completely wrong than the first two should therefore be enough.

Cor

"Terry Olsen" <to******@hotmail.com> schreef in bericht
news:ug**************@TK2MSFTNGP05.phx.gbl...

I''m writing an app that communicates with computers both inside and
outside my router. So I need to determine by the remote host''s IP address
if I need to send them my LAN IP or my Internet IP. Someone suggested
AND''ing the IP and my Subnet Mask but I come up with this:

My IP: 192.168.0.14
Mask: 255.255.255.0

Result: 192.168.0.0

Should I just compare the first two octets? Or are there situations where
this would provide incorrect results?



Terry,

Sorry when I had sent it I realized me that it was not the 150 so I searched
for it in Google.

10.x.x.x
172.16.x.x - 172.31.x.x
192.168.x.x

Cor


corrrect you are.

Testing against the forst two octets should be sufficient to determine
routable vs. non routable.... aka internal/external.

NOW, if an internal network is configured to have an IP scheme with ROUTABLE
IPs ( which CAN be done --- WHY? I wouldn''t know)... that would make it a
bit touchy.

--
Grumpy Aero Guy

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...

Terry,

AFAIK are there three ranges reserved for internal use

10.x.x.x
150.x.x.x
192.168.x.x

If I am not completely wrong than the first two should therefore be
enough.

Cor

"Terry Olsen" <to******@hotmail.com> schreef in bericht
news:ug**************@TK2MSFTNGP05.phx.gbl...

I''m writing an app that communicates with computers both inside and
outside my router. So I need to determine by the remote host''s IP address
if I need to send them my LAN IP or my Internet IP. Someone suggested
AND''ing the IP and my Subnet Mask but I come up with this:

My IP: 192.168.0.14
Mask: 255.255.255.0

Result: 192.168.0.0

Should I just compare the first two octets? Or are there situations where
this would provide incorrect results?




这篇关于不知道如果IP在LAN或INET上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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