1

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.

goldilocks
  • 58,849
  • 17
  • 112
  • 227
jrust
  • 78
  • 1
  • 2
  • 10
  • 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

1 Answers1

0

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.

jrust
  • 78
  • 1
  • 2
  • 10
  • 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 01 '15 at 00: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 01 '15 at 09:18