title: How can I get the default gateway IP with Python?
body: <p>I want to get the IP of the default gateway (internal router IP) using Python. I'm really new to Python so not sure how this works. </p>
  
  <p>I know you can get the IP of your machine with:</p>
  
  <pre><code>import socket
  internal_ip = socket.gethostbyname(socket.gethostname())
  print internal_ip
  </code></pre>
  
  <p>So I'm thinking it must be something similar?</p>