如何像新机器一样重新加入无线网络?

发布于 2024-12-18 12:58:03 字数 274 浏览 4 评论 0原文

对于分类项目,我尝试从单个无线网络生成大量动态 IP 地址。然而,我能够生成这些地址的唯一方法是将一台物理上的新机器连接到网络,因为无线网络会记住每台机器(因此,每当一台机器重新加入网络时,IP 地址保持不变)。

为了简洁起见,我一直在寻找一种自动化该过程的方法;从技术上讲,我需要做的就是找到一种方法来模拟成为“新”机器。这样,生成由单个无线网络分配的 IP 地址列表就会容易得多。

我在找到如何执行此操作时遇到了很大的麻烦,而且我很可能误解了无线网络如何分配 IP 地址等。

谢谢!

For a classification project I'm trying to generate a large list of dynamic IP addresses from a single wireless network. However, the only way I've been able to generate these addresses is by connecting a physically new machine to the network, as the wireless network remembers each machine (and so, whenever one machine rejoins the network the IP address remains the same).

For the sake of brevity, I've been looking for a way of automating the process; technically, all I need to do is find a way to simulate being a "new" machine. This way, it would be far easier to generate a list of IP addresses assigned by a single wireless network.

I've had a great deal of trouble finding out how to do this, and it is very possible I may misunderstand how a wireless network assigns IP addresses, etc.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

海之角 2024-12-25 12:58:03

(继续上面的评论...)

事实证明,根本不需要花哨的机器学习。只需连接一次即可获取所需的所有信息。当您连接到 IP 网络并被分配地址时,您会同时获得地址子网掩码(如果您不熟悉这些术语,请查阅) 。鉴于这些,按位算术的简单片段将显示另一个地址是否属于同一网络的一部分:

if ((my_address & subnet_mask) == (unknown_address & subnet_mask)) { ...

其中 unknown_address 是您正在测试的地址。 (可以通过应用布尔简化规则来稍微简化此表达式,但这种形式可以明显看出正在发生的情况。)

例如,如果您被分配:

address: 192.168.11.22
subnet: 255.255.255.0

则任何其他地址如果以 < 开头,则属于同一网络的一部分代码>192.168.11。。同样,建立网络的人也非常谨慎地做出了这些选择。

这非常让我想起所谓的晴雨表问题,其中可能的答案之一是“将晴雨表交易给大楼管理员以换取所需的信息”。

(continuing from the comments above...)

As it turns out, there's no fancy machine learning necessary at all. You can get all the information you need by connecting just once. When you connect to an IP network and are assigned an address, you get both an address and a subnet mask (look it up if you're not familiar with the terms). Given these, a straightforward snippet of bitwise arithmetic will show you whether another address is part of the same network or not:

if ((my_address & subnet_mask) == (unknown_address & subnet_mask)) { ...

where unknown_address is the address you're testing. (This expression can be simplified a bit by applying boolean simplification rules, but this is a form where it's obvious what is happening.)

For example, if you are assigned:

address: 192.168.11.22
subnet: 255.255.255.0

then any other address is part of the same network if it starts with 192.168.11.. Again, the person who set up the network has very deliberately made these choices.

This very much reminds me of the so-called Barometer question, where one of the possible answers is "trading the barometer to the building's superintendent in return for the information wanted".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文