Response to DHCP Request Using MAC Address Only

Tony Pitman 76 Reputation points
2024-01-29T21:06:20.61+00:00

I have an app based on PXEBoot.   I am trying to assign an IP address to an RNDIS device over USB.   Since the device doesn't have an IP address yet and doesn't even show up as a network device until after it is plugged in, I can't bind to anything to listen for DHCP requests.   So I bind my UdpClient to address 0.0.0.0. This allows me to get the DHCP request from the device using its MAC address.   I formulate the DHCP Offset packet and try to send it using the same UdpClient that received it, but nothing seems to be going out.   Currently I am sending on the 0.0.0.0 UdpClient that the request came in on and changing the port to 68 and the TO address to IPAddress.Broadcast, but as I said above it doesn't go out on the RNDIS at all. Probably because that interface doesn't have an IP address at all yet.   I suspect UdpClient doesn't know what interface to send it on. I have WireShark set up to watch all traffic and it is seeing the request, but not the offer I am sending.   Is there a way for me to send the offer using just the MAC address or some kind of broadcast?   I can manually assign the RNDIS a static IP address and then get other DHCP requests on that "ethernet" connection over USB, but I need to be able to plug in more than one of these devices at the same time and give each one their own IP address, so static won't work.   How do I send a DHCP Offer packet to the RNDIS interface when I get the request via UdpClient on 0.0.0.0?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,917 questions
Windows DHCP
Windows DHCP
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.DHCP: Dynamic Host Configuration Protocol (DHCP). A communications protocol that lets network administrators manage centrally and automate the assignment of Internet Protocol (IP) addresses in an organization's network.
1,040 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Hania Lian 17,281 Reputation points Microsoft Vendor
    2024-01-31T06:14:49.4433333+00:00

    Hello, Thank you for posting in Q&A forum. Yes, as the RNDIS device doesn't have an IP address yet, you can't send the DHCP offer directly to its IP. First please kindly check if there's any restriction on the RNDIS device that preventing it from getting an IP address. From Windows aspect, perhaps you can send the DHCP offer to the broadcast address of the network segment. For example, broadcasting the IP to 192.168.1.255 and see if it works. Hope this answer can help you well. Best Regards, Hania Lian

    If the Answer is helpful, please click "Accept Answer" and upvote it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.