从IP地址获取子网掩码和网关 [英] get subnet mask and gateway from IP address

查看:338
本文介绍了从IP地址获取子网掩码和网关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从 IP地址计算子网掩码网关

How can i calculate subnet mask and gateway from an IP address?

假设我的IP地址 180.12.24.68

然后我该如何计算这个IP的子网掩码和网关?

Then how can i calculate this IP's subnet mask and gateway?

推荐答案

你无法计算你的子网掩码<来自IP地址的em>或网关。

You cannot calculate your subnet mask or gateway from just an IP address.

在给定IP地址和网络掩码的情况下,您可以计算潜在网关的范围。但是,范围基本上是((我的LAN段大小) - MyIP)。通常这将是大约253个IP地址,除非您在大型网络上。

You can calculate the range that a potential gateway could be in given an IP address and a netmask. But, the range is basically ((My LAN segment Size) - MyIP). Generally this will be around 253 IP addresses unless you're on a large network.

给定网关和网络掩码,您可以计算一系列可以配置的潜在IP地址自己使用 - 但如果你手动配置,那么你就有机会破坏现有的IP地址。 (这就是DHCP很好的原因)

Given a gateway and a netmask you can calculate a range of potential IP addresses you can configure yourself to use - but if you're manually configuring then you have the chance of clobbering an existing IP address. (This is why DHCP is good)

给定一个网关和一个IP地址,你可以计算出足够的网络掩码,你可以让你的流量被路由 - 但取决于您可能无法与同一LAN网段上的其他计算机通信的子网配置。例如,如果您的网关是10.1.3.254,并且您将网络掩码配置为255.255.255.0。网关(和LAN)实际上可以被屏蔽为255.255.254.0(基本上,在一个连续的段中有2个C类的地址)..所以,你可以上网,但你可能无法与'本地机器'交谈。

Given a gateway and an IP address you can calculate enough of your netmask that you can get your traffic to be routed - but depending on the subnet configuration you may not be able to talk to other machines that are on the same LAN segment. An example of this would be if your gateway is 10.1.3.254 and you configure your netmask as 255.255.255.0. The gateway (and the LAN) could actually be masked as 255.255.254.0 (basically, 2 class Cs worth of addresses in a contiguous segment).. So, you'd be able to get to the internet, but you might not be able to talk with 'local machines'.

总之,这些是可能的结果:

In summation these are the possible outcomes:


  • 掩码+网关=可猜测但非确定的IP地址

  • 掩码+ ip =可猜测但非确定的IP地址范围,您可能会找到
    网关

  • ip + gateway = guessable但可能配置错误
    netmask

这篇关于从IP地址获取子网掩码和网关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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