使用 USB/ETH 连接访问我的嵌入式设备的友好名称

发布于 2024-12-20 02:36:33 字数 1121 浏览 3 评论 0原文

我无法配置网络以使用友好名称访问我的设备。这是我的情况:

   LAN
    ^
----¦----  USB/ETH   ------------------
¦  PC   ¦ ---------> ¦ Embedded device¦
---------            ------------------

我想做的是使用友好的 DNS 名称来访问我的设备,例如打开网络浏览器,输入“mydevice”并访问我的设备的网页。我使用 dnsmasq 作为 DNS/DHCP 服务器。

它不起作用,因为配置我的 USB 网络适配器后,我的 PC 始终使用 USB/ETH 作为默认路由,并且无法访问外界(在 Linux 和 Windows 下)。

解决方案 1:从 DHCP 服务器删除默认路由。

这在 Linux 下运行良好,但我的 Windows 7 不想设置 IP 地址并显示非常清晰的错误消息:

没有为您的计算机分配网络地址(由 DHCP 服务器)用于网络地址为 0x001830000000 的网卡。 发生以下错误:0x79。您的计算机将继续尝试 并从网络地址(DHCP)中获取自己的地址 服务器。

解决方案 2:更改 USB/ETH 接口的指标

我从那里得到了这个解决方案:http://support.microsoft.com/kb/894564

这在 Windows 下工作得很好,但是,我想让事情变得“自动”并避免需要进入 Windows 配置!在我的 Linux 主机上,由于现在配置了默认路由,我又回到了第一种情况。

由于该指标是在本地计算的,我想知道是否真的可以从 DHCP 服务器更改该值(可能不行!)?您是否有任何建议让这种奇怪的网络配置在任何情况下都适用于两种操作系统?或者是否有可能在我的嵌入式设备上“伪造”缓慢的连接以强制操作系统设置更高的指标?

感谢您的建议!

编辑 1

我想避免来自电脑的任何操纵......

I have trouble to configure my network to access my device with a friendly name. Here is my situation:

   LAN
    ^
----¦----  USB/ETH   ------------------
¦  PC   ¦ ---------> ¦ Embedded device¦
---------            ------------------

What I'd like to do is using a friendly DNS name to access my device, for example opening a webrowser, typing "mydevice" and acces the web page of my device. I use dnsmasq as DNS/DHCP server.

It didn't work because after configuring my USB network adapter, my PC always use the USB/ETH as default route and the outside world is not reachable (Under Linux and Windows).

Solution 1 : Removing default route from the DHCP server.

This worked fine under Linux but my Windows 7 doesn't want to set the IP address and shows a very clear error message:

Your computer was not assigned an address from the network (by the
DHCP Server) for the Network Card with network address 0x001830000000.
The following error occurred: 0x79. Your computer will continue to try
and obtain an address on its own from the network address (DHCP)
server.

Solution 2: Changing the metric of the USB/ETH interface

I got this solution from there: http://support.microsoft.com/kb/894564

This worked fine under Windows however, I'd like to make things "automagic" and avoid the need to go into Windows configuration! On my Linux host, as the default route is now configured, I'm back to the first situation.

As the metric is computed locally I was wondering if it is really possible to change this value from the DHCP server (probably not!)? Do you have any suggestion to make this weird network configuration to work in any case with both operating systems? Or is it possible to "fake" a slow connection on my embedded device to force the operating system putting a higher metric?

Thanks for your suggestions!

EDIT 1

I'd like to avoid any manipulation from the PC ...

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

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

发布评论

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

评论(1

原来是傀儡 2024-12-27 02:36:33

如果这是我要解决的问题,我会使用不同的 RFC 1918 地址块两个不同的网络:我会使用 192.168.0.0/16 作为 LAN,使用 10.0.0.0/8 作为通过 USB 连接的设备以太网设备。 (是的,1600 万个 IP 远远超过了它的需要,但我更喜欢我自己的网络的 192.168.0.0/16 范围。10.0.0.0/8 从来都感觉不合适。)

ip route add 192.168.0.0/16 dev eth0
ip route add 10.0.0.0/8 dev <name of usb eth device> src 10.0.0.1
ip route add default via <router> dev eth0

您必须配置您的设备以获得相应的地址位于 10.0.0.0/8(而不是 10.0.0.1),并确保您的设备知道如何路由到 10.0.0.0/8 它的界面也是如此。

If this were my problem to solve, I'd use different RFC 1918 address blocks for the two different networks: I'd use e.g 192.168.0.0/16 for the LAN and 10.0.0.0/8 for the device connected over the USB-mounted Ethernet device. (Yes, 16 million IPs are way more than it needs, but I prefer the 192.168.0.0/16 range for my own network. 10.0.0.0/8 never felt right.)

ip route add 192.168.0.0/16 dev eth0
ip route add 10.0.0.0/8 dev <name of usb eth device> src 10.0.0.1
ip route add default via <router> dev eth0

You'll have to configure your device to have the corresponding address in 10.0.0.0/8 -- not 10.0.0.1 -- and make sure your device knows how to route to 10.0.0.0/8 over its interface too.

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