Ubuntu – How to turn off WLAN automatically when LAN is connected


I use my Thinkpad laptop with a docking station. The docking station is connected to my router via LAN. When I walk around the house I use my laptop with WLAN.

Is it possible (and how) to manage these devices with a script or something to work like this:

If a LAN-Connection is up, the OS should turn off Wifi and if LAN-Connection gets lost (undocking) Wifi should turn on automatically.

I use Ubuntu 11.04 64bit with Gnome 2. The system works on an Lenovo ThinkPad R500 with.

WLAN-Device: Intel Corporation PRO/Wireless 5100 AGN [Shiloh]
LAN-Device: Broadcom Corporation NetLink BCM5787M Gigabit Ethernet PCI Express (rev 02)

Any help would be appreciated. Thanks.

Best Answer

I think you might be making this harder than it has to be. I have the same situation with my laptop (except it's a normal ethernet port instead of a dock). When I plug in the wired network, it automatically takes precedence over the wireless and everything goes over the (faster) ethernet cord. The wireless was connected all along, but unused. When I unplug the cable it falls back to using the wireless connection.

So, have you tried to see if this does what you want already? I'm using nothing more than the standard network applet that comes with Ubuntu.

Related Question