title: Set eth0 as DHCP in raspberry pi
body: <p>I want to set eth0 of RPI (Raspbian Stretch) to be DHCP, my goal is that when I will connect any device that communicates using TCP/IP protocol, that device will receive an IP address.</p>
  
  <p>I have found many guides that all lead to making eth0 ip address static, which is not my intention.</p>
  
  <p>Currently a device is connected through eth0 , <code>ifconfig</code> says it has some IP but pinging the hostname of the device gets no reply. wlan0 is connected via wifi.</p>
  
  <p>Here is some info :</p>
  
  <pre><code>pi@raspberrypi:~ $ ifconfig
  eth0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
          inet 169.254.31.197  netmask 255.255.0.0  broadcast 169.254.255.255
          inet6 fe80::ad5a:8219:4c27:b59b  prefixlen 64  scopeid 0x20&lt;link&gt;
          ether b8:27:eb:f3:f2:87  txqueuelen 1000  (Ethernet)
          RX packets 81  bytes 26568 (25.9 KiB)
          RX errors 0  dropped 0  overruns 0  frame 0
          TX packets 46  bytes 10544 (10.2 KiB)
          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  
  lo: flags=73&lt;UP,LOOPBACK,RUNNING&gt;  mtu 65536
          inet 127.0.0.1  netmask 255.0.0.0
          inet6 ::1  prefixlen 128  scopeid 0x10&lt;host&gt;
          loop  txqueuelen 1000  (Local Loopback)
          RX packets 31  bytes 3472 (3.3 KiB)
          RX errors 0  dropped 0  overruns 0  frame 0
          TX packets 31  bytes 3472 (3.3 KiB)
          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  
  wlan0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
          inet 192.168.0.71  netmask 255.255.255.0  broadcast 192.168.0.255
          inet6 fd01::60ff:8818:5965:dc58  prefixlen 64  scopeid 0x0&lt;global&gt;
          inet6 fe80::473d:110e:5474:8000  prefixlen 64  scopeid 0x20&lt;link&gt;
          ether b8:27:eb:a6:a7:d2  txqueuelen 1000  (Ethernet)
          RX packets 955  bytes 74427 (72.6 KiB)
          RX errors 0  dropped 0  overruns 0  frame 0
          TX packets 184  bytes 22096 (21.5 KiB)
          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  </code></pre>
  
  <hr>
  
  <pre><code>pi@raspberrypi:~ $ cat /etc/network/interfaces
  # interfaces(5) file used by ifup(8) and ifdown(8)
  
  # Please note that this file is written to be used with dhcpcd
  # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
  
  # Include files from /etc/network/interfaces.d:
  source-directory /etc/network/interfaces.d
  
  </code></pre>
  
  <p>Any advice to how to achieve my goal will be happily received.</p>