0
I would like to configure /etc/network/interfaces so that it connects to wifi when the cable is not connected, is it possible?
Following is the content of /etc/network/interfaces (Ubuntu 15.04):
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 140.136.38.16
netmask 255.255.0.0
network 140.136.1.0
broadcast 140.136.1.255
#gateway 140.136.38.254
dns-nameservers 140.136.73.154 140.136.13.4
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid WIFI
wpa-psk WIFIWIFI
With the above configuration and cable not connected I still need to do # ifconfig eth0 down
to have access the internet.
A similar question was asked and answered here: http://askubuntu.com/questions/112968/automatically-disable-wifi-wireless-when-wired
– TheStarvingGeek – 2016-05-11T19:43:27.197Well, that answer uses
/etc/NetworkManager/dispatcher.d/99-disable-wireless-when-wired
(which seems to be a pretty exotic thing), I'm asking about/etc/network/interfaces
. – KcFnMi – 2016-05-11T20:19:29.283You could do this with bonding - as long as it's not a problem that your wifi adapter would still connect even when your wired connection is online (it just wouldn't be used for any traffic). See http://serverfault.com/questions/657783/how-do-i-bond-eth0-to-failover-to-wlan0-after-wan-connection-loss
– Carcer – 2016-05-11T20:51:02.360Ah, sorry, I realise an issue with your network config! Answering... – Carcer – 2016-05-11T20:56:20.097