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

Multiple IP addresses on a single NIC receiving UDP from different subnets

· 52CE 我爱测

Sorry if I'm not using the right language for all this, I'm a software developer not a server/network administrator! I've got a Windows machine with a single NIC with multiple IP addresses configured. As an example, the NIC addre…

问题原文

原帖链接 · Joe · CC BY-SA 4.0

Sorry if I'm not using the right language for all this, I'm a software developer not a server/network administrator!

I've got a Windows machine with a single NIC with multiple IP addresses configured. As an example, the NIC address is 172.1.48.3. It has three IP addresses configured in Properties -> Ip 4 Properties -> Advanced, all on different subnets 172.1.48.3, 172.1.88.3 and 172.1.104.3. (Subnet mask is 255.255.255.0 on all these).

I have a program listening on three UDP sockets with each of these IP addresses.

Three things on the network are broadcasting to each subnet: 172.1.48.255, 172.1.88.255 and 172.1.104.255.

I can see in wireshark that UDP is coming in from these addresses, so 172.1.48.255 -> 172.1.48.3, 172.1.88.255 -> 172.1.88.3 etc. However, I'm seeing 'cross contamination' between the sockets. The UDP socket bound to 172.1.48.3 is recieving UDP messages from 172.1.48.3, 172.1.88.3 and 172.1.104.3.

Either I'm not understanding UDP properly, or something with the networking. I think it's some issue with having these three separate IP addresses on one NIC, because it works fine if each IP has it's own machine (and thus NIC).

Anyone know why a 172.1.48.3 socket would be receiving messages broadcast to a different subnet 172.1.104.255?

已采纳解答

原帖链接 · joeqwerty · CC BY-SA 4.0

Because broadcast traffic is by nature... broadcasted. If you look at the Ethernet Frame portion of the UDP traffic in Wireshark you'll see that the destination MAC address (Layer 2) is FF-FF-FF-FF-FF-FF, which includes all hosts connected to the same physical network segment. All hosts connected to the same physical network segment will receive this traffic and look at the Layer 3 address and determine if they should accept and process the traffic or not. Hosts not in the same Layer 3 destination network will accept the traffic and then discard it... but they will accept it.

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

资料来源与适用范围

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

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

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