I have 2 network interfaces:eth0 for LAN connectionwlan2 for wireless connectionI 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 eth0iface eth0 inet staticaddress 192.168.1.130netmask 255.255.255.0network 192.168.1.0dns-nameservers 8.8.8.8 8.8.4.4up route add default gw 192.168.1.10 eth0down route del default gw 192.168.1.10 eth0auto wlan2iface wlan2 inet staticwpa-ssid dlinkwpa-key-mgmt WPA-PSKwpa-psk wpapassaddress 192.168.1.150netmask 255.255.255.0network 192.168.1.0dns-nameservers 8.8.8.8 8.8.4.4up route add default gw 192.168.1.20 wlan2down route del default gw 192.168.1.20 wlan2NetworkManager.conf[main] plugins=ifupdown,keyfile[ifupdown] managed=true  
How to take down a static network interface when not connected?
debian;networking;networkmanager
When you configure a wired network using /etc/network/interfaces, you tell Network Manager not to touch it. There is some documentation of this in the Debian Wiki NetworkManager article.So, to make it work, your best bet is probably to remove (or comment out) your configuration in /etc/network/interfaces (except for lo) and entirely use Network Manager. You'll probably want to make them system connections, so they can be up before you log in.Alternatively, you could set managed=true as shown in the wiki.