How do I send a DHCP request to find DHCP server IP address? Is this possible?
<p>Is it possible to write a small script that will send out a DHCP broadcast request and find the DHCP server address?</p>

<p>I need this for a project, but my research led me to believe that you cannot do this on Windows? I would need a small script for OSX, Linux and Windows. </p>

<p>I think you're asking an <a href="http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem">XY Problem</a>: You want to know how to find the DHCP IP address on windows, via python?</p>

<p>There is a solution on SuperUser for <a href="http://superuser.com/questions/314145/how-to-find-my-dhcp-server-ip-address-via-a-command-prompt-in-windows/314147">obtaining DHCP server ip from the command line</a>. You can wrap <code>ipconfig /all</code> with <code>subprocess</code> and then parse the output:</p>

<pre><code>import subprocess  # Runs a command on the cmd line

res = subprocess.check_output("ipconfig /all")
</code></pre>

python dhcp