大网数据广告活动
服务器运维问答

Broadcasting on 0.0.0.0

· 52CE 我爱测

I have a service saying it is "broadcasting on 0.0.0.0 " using interface eth0 with sendto() . However, when checking the traffic with tcpdump , it seems like it is broadcasting on the lo interface, and not on the network. For ins…

问题原文

原帖链接 · JonasVautherin · CC BY-SA 3.0

I have a service saying it is "broadcasting on 0.0.0.0" using interface eth0 with sendto().

However, when checking the traffic with tcpdump, it seems like it is broadcasting on the lo interface, and not on the network. For instance, I see messages like this on the lo interface, and nothing on the eth0 interface:

22:38:17.814047 IP localhost.14557 > localhost.14540: UDP, length 36

On the same machine as the one running the service, I can see the traffic with netcat by running:

$ netcat -l -u -p 14540

But I don't see this traffic from another machine (actually I am using docker containers).

To verify that the broadcast works between the containers, I run:

$ netcat -l -u -p 54321

on the first container, and:

$ echo "foobar" | netcat -ub 255.255.255.255 54321

I get "foobar" appearing on the terminal of the first container. As far as I understand, this means that I am broadcasting "foobar" over the zero network (0.0.0.0, same as the one claimed by my service above).

Why does my "foobar" broadcast go on the network (interface eth0) and the service broadcast messages stay local (interface lo)?

已采纳解答

原帖链接 · JonasVautherin · CC BY-SA 3.0

As per RFC 1122, section 3.2.1.3 (a):

{ 0, 0 }

This host on this network. MUST NOT be sent, except as a source address as part of an initialization procedure by which the host learns its own IP address.

One MUST NOT broadcast to 0.0.0.0.

So I guess this is undefined behavior, and it should be fixed in the service. The fact that it broadcasts on lo here is specific to this setup, but should not be generalized.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-10-28)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。