I'm trying to let my Raspberry Pi ask for a new IP address everytime an ethernet cable is plugged in. So it doesn't only ask for an IP address when the Pi is booting.

  • The question has nothing to do with the Pi as such. You may be better off asking in a general networking forum. – joan Jan 31 '15 at 16:25
  • Although I've seen even electronics suppliers using this misnomer, an ethernet jack isn't really an RJ45, so for the purpose of nit-picking I've edited. P.S. have a look into ifplugd, which is installed and run as an init service by default on raspbian, if you want to do this. As joan points out though, this is a little off topic here and would probably fly better on the Unix & Linux Exchange. – goldilocks Jan 31 '15 at 20:34
  • i'm not sure but try setting auto eth0 allow-hotplug eth0 iface eth0 inet dhcp. I am not sure if it will work but try it out unless you aren't connected to pi via SSH. – thekiwi5000 Jan 31 '15 at 21:16

This worked for me:
Just go to /etc/network/interfaces
Edit interfaces with sudo nano interfaces
auto eth0 allow-hotplug eth0 iface eth0 inet dhcp

DONE! =)

I'll mark this as the answer in two days, because then it can.

  • this look more like a renewal of your IP. did you get a différent IP when on same network ? (if that was your intend) – Archemar Jan 31 '15 at 22:08
  • I also understood the question in the way that a fresh IP address was desired (for some reason). Good that it worked out anyway. – Frepa Feb 1 '15 at 0:05
  • Archemar, that was not the intention. It just needs to ask for an IP, it does not need to have new one. Thanks for all the help guys! – jrust Feb 1 '15 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.