title: Python dhcp client
body: <p>I'm trying to learn how to directly (no libraries) send DHCP request from python on multi-homed machine (multiple interfaces). 
  I've looked at pydhcplib, but still do not get it.</p>
  
  <p>This code send DHCP packet on specific interface (eth3 in my case - no IP assigned), but it sends with eth0 IP address. How to change my src IP to 0.0.0.0?
  dhcp-message is truncated in this example</p>
  
  <pre><code>LOCAL_PORT=68
  SERVER_PORT=67
  LOCAL_IP="0.0.0.0"
  BCAST_IP="255.255.255.255"
  LISTEN_DEV="eth3"
  MSG_SIZE=2048
  Conn=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  Conn.settimeout(5)
  Conn.setsockopt(socket.SOL_SOCKET,IN.SO_BINDTODEVICE,LISTEN_DEV+'\0')
  Conn.setsockopt(socket.SOL_SOCKET,socket.SO_BROADCAST,1)
  Conn.bind((LOCAL_IP, LOCAL_PORT))
  # Create DHCP-Discovery
  msg="010106003f7d1664......"
  Conn.sendto(msg.decode("hex"),(BCAST_IP,SERVER_PORT))
  received = Conn.recv(MSG_SIZE)
  Conn.close()
  </code></pre>