5

It's on a laptop running Ubuntu 14.04, where the WiFi wlan0 is used to connect to Internet.

And eth0 (RJ45) is set statically in /etc/network/interfaces

auto eth0
iface eth0 inet static
    address 192.168.11.168
    netmask 255.255.255.0
    gateway 192.168.11.100

The problem is, there is usually no cable connected to eth0, so at boot the IP address is not set. And when a cable is connected (on a LAN) for a short period of time, the address has to be set

ifdown eth0
ifup eth0

and since the device the laptop connects to does stop and restart, the IP is lost and has to be set again.

That kind of configuration does not seem to fit for a laptop connecting at times to devices, which may reboot etc...

Is there a way to tell the system to keep that IP assigned to eth0, whatever happens, cable disconnections, boot, etc... ?

edit

It seems wicd was the culprit. Once I removed eth0 from its config, the IP address behaved more consistently. It's always ON, on boot, unplugged... I knew the good old interfaces file could be trusted!

  • For this reason (frequent disconnected cables), Network Manager was invented. Any reason why you are not using NM or similar software? Any reason why you actually need this static IP? – Lekensteyn Jan 22 '15 at 18:41
  • @Lekensteyn NM is incompatible with specific requirements. See edit. – e2-e4 Jan 22 '15 at 23:46
1

Try allow-hotplug:

auto eth0
allow-hotplug eth0
iface eth0 inet static
    address 192.168.11.168
    netmask 255.255.255.0
    gateway 192.168.11.100
| improve this answer | |
0

I thought legitimate to answer my own question as, actually, there is nothing wrong with the good old /etc/network/interfaces - ie having interfaces not managed by a high level tool (like network-manager, wicd etc...).

It appears that, in my case, wicd was having some interface properties that made the link ON of OFF depending on the cable is plugged or not. Being not a wicd specialist (and don't intend to be), wicd was simply apt-get purged from the system.

Without neither Network Manager nor wicd the network behaves without bias (due to, I must confess, my incompetence in these high level tools).

While managing everything manually requires a bit more time, the trade-off is a very reliable and un-surprising network. That's valuable when specific network configurations have to be implemented.

| improve this answer | |

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.