I have 2 network interfaces:
- eth0 for LAN connection
- wlan2 for wireless connection
I have set them static in the /etc/network/interfaces file. The problem is that I rarely have both connected at the same time and if the LAN is not connected, wlan2 doesn't work until I take down the eth0 manually with ifconfig.
Why does this happen?
I would like that when one interface is not connected it will be turned off automatically. How can I do that?
Here's the interfaces file:
auto eth0
iface eth0 inet static
address 192.168.1.130
netmask 255.255.255.0
network 192.168.1.0
dns-nameservers 8.8.8.8 8.8.4.4
up route add default gw 192.168.1.10 eth0
down route del default gw 192.168.1.10 eth0
auto wlan2
iface wlan2 inet static
wpa-ssid "dlink"
wpa-key-mgmt WPA-PSK
wpa-psk wpapass
address 192.168.1.150
netmask 255.255.255.0
network 192.168.1.0
dns-nameservers 8.8.8.8 8.8.4.4
up route add default gw 192.168.1.20 wlan2
down route del default gw 192.168.1.20 wlan2
NetworkManager.conf
[main]
plugins=ifupdown,keyfile
[ifupdown]
managed=true