主机名如何在子网中广播

发布于 2024-08-17 20:10:45 字数 173 浏览 19 评论 0原文

我正在使用 Microchip 的 TCP/IP 堆栈,尽管我可以使用 DHCP 分配的 IP 来访问我的设备,但我的设备的主机名并未被广播。

所以问题是,网络设备使用什么协议来广播其主机名,以便当我看到网络中的设备列表时我可以通过名称来识别它?

是 NetBIOS 名称服务还是其他什么?提前致谢。

I'm working with Microchip's TCP/IP stack and the host name of my device is not being broadcasted, although I can access it using its DHCP assigned IP.

So the question is, what is the protocol that a network device uses to broadcast its host name, so that when I see a list of devices in a network I can identify it by name?

Is it the NetBIOS name service or something else? Thanks in advance.

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

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

发布评论

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

评论(3

長街聽風 2024-08-24 20:10:45

为网络上的主机指定主机名的最与网络无关的方法是通过 DNS,您的设备本身无法控制,但一切都不会丢失。

在大多数环境中,DHCP 和 DNS 服务器是捆绑在一起的(Windows 网络中的 AD、Linux 上的 DNSMasq 等),因此您最好的选择是依赖这种行为。当您使用 DHCP 请求 IP 时,DHCP 协议允许您指定要使用的主机名,如果网络设置为允许 DNS 服务器创建和维护 DNS 条目,则您在通常会使用 DHCP 请求。

DHCP 参数称为“主机名”。此参数的网络协议文档位于 RFC 2132 中,并且此处解释

The most network-agnostic way to specify a hostname for a host on the network is through DNS, which your device itself cannot control, but all is not lost.

In most environments, the DHCP and DNS servers are tied (AD in Windows networks, DNSMasq on linux, etc...) so your best option is to rely on this behaviour. When you request an IP using DHCP, the DHCP protocol allows you to specify the hostname you'd like to use and if the network is set up to allow DNS entries to be created and maintained by the DNS server, the hostname you send during your DHCP request will typically be used.

The DHCP parameter is called 'Hostname'. The Network protocol documentation for this parameter is located in RFC 2132, and explained here.

听你说爱我 2024-08-24 20:10:45

WINS(基于 NetBIOS)支持此功能。

ZeroConf/Bonjour 提供“服务广告”协议,但我猜这不是您所追求的。

在基于 IP 的“正常”网络中,名称解析将通过 DNS 层:DNS 服务器传播其数据库(当然,如果也有指示的话),但该层没有“广播”的概念。

There is WINS (based on NetBIOS) that supports this functionality.

There is ZeroConf/Bonjour that offer a "service advertisement" protocol but I am guessing that's not what you are after here.

In "normal" IP based networks, name resolution would go through a DNS layer: the DNS servers propagate their databases (if instructed too of course) but there is no concept of "broadcasting" at this layer.

暖树树初阳… 2024-08-24 20:10:45

我想您现在已经解决了这个问题,但我修改了 Microchip 堆栈中的 dchp.c 文件,并将以下内容添加到 _DHCPSend() 的选项部分。

// host name
i = strlen(AppConfig.NetBIOSName);
UDPPut(12);     //host name code
UDPPut(i);      //length
UDPPutString(AppConfig.NetBIOSName);

这对我有用。

I guess you've solved this by now but I modified the dchp.c file in the Microchip stack and added the following to the options part of _DHCPSend().

// host name
i = strlen(AppConfig.NetBIOSName);
UDPPut(12);     //host name code
UDPPut(i);      //length
UDPPutString(AppConfig.NetBIOSName);

This worked for me.

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