i have configured both eth0 and wlan with static ip according to this post:

Setting up WiFi and Ethernet

It works fine. But if I reboot The pi; Eth0 gets the assined ip even without the cable plugged in. Similar thing happen when I reboot with the Ethernet cable plugged in; Now I get a functional ip but if I unplug it, ifconfig still show the static ip.

What is wrong?

/etc/network/interfaces

auto lo
iface lo inet loopback

allow-hotplugin eth0
iface eth0 inet static
address 192.168.1.150
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

auto wlan0
iface wlan0 inet static
address 192.168.1.151
network 192.168.1.0
broadcast 192.168.1.255
netmask 255.255.255.0
wpa-ssid MYWIFI
wpa-psk *** 

iface default inet dhcp

/etc/default/ifplugd

INTERFACES="eth0"
HOTPLUG_INTERFACES="eth0"
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"
  • 2
    The IP address is statically defined on the adapter. When you plug the cable in you then get functional networking. So irrespective of network availability the static IP address will always be shown. – albal Aug 4 '15 at 8:41
  • Maybe a dynamic IP is what you're looking for? Then you would only get it, when the cable is plugged in. – Swiss Dev Aug 4 '15 at 18:56

Nothing is wrong.

You have asked for a static IP address and that's what you have got.

If you don't want a static IP address then use dynamic, that way an IP address will be assigned when the ethernet cable is plugged in.

  • it makes sense but I got 4 pi's. The former three are clones of the first one [master]. on the master when i unplug the cable the ip vanish from ifconfig but not the interface itself. I cant figure out why I like it that way because it makes more sense on my head. I have been fiddling around with ifplugd with no success. I am gonna edit my question to include the interfaces file I have been using. Do you know any ifconfig flag to show only RUNNING interfaces? a quick google only showed me some creepy grep stuff. – CESCO Aug 4 '15 at 17:11

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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