Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • You can tell the dhcp server to only assign a certain ip address to a certain mac in its configuration files. EDIT: you do not want to change any settings on the dhcp server? that would change things Commented May 4, 2023 at 21:15
  • @Cheetaiean I use this in a script that anyone can download. If the users need to modify their router settings only to run my script, that will be too much to ask. So no, I dont know anything about the DHCP servers people will have. I just assumed 99 percent of them will always serve the same IP to the same MAC, because every router I ever owned worked that way. Commented May 4, 2023 at 23:18
  • I'm going to suggest you send raw DHCP packets then. Simply broadcast a DHCPDISCOVER, and then wait for the DHCPOFFER from the server, which will tell you exactly what you need to know. Commented May 4, 2023 at 23:54
  • 1
    XY problem? Why do you need the address before the VM gets it? The hypervisor may provide means to see the current address; or to communicate with the VM itself in a way that doesn't depend on networking. Either way learning the actual IP address after the VM gets it may be possible. Commented May 5, 2023 at 0:55
  • 1
    If you want the VM to announce its IP address without any guest module requirement you can use LLDP, which is built into systemd. See EmitLLDP= Commented May 5, 2023 at 13:32