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.

  • It should be possible to create a script for it, but keep in mind that you'll lost all existing network connections. Not nice if you've a SSH connection open, or are playing an online game. Most laptops have a keyboard shortcut (Fn + F11 on mine) or a switch on the front side for disabling wireless. Get in habit to use that shortcut / slide when connecting. Is there a requirement to turn wifi on automatically when disconnected from the wire? Technically, LAN counts for a wireless connection too. Wired connection is the right terminology here. – Lekensteyn Aug 2 '11 at 20:05
  • yes the requirement is, that I'm too lazy. ;-) and also yes: technically you wired connection may be the correct term. – derroman Aug 12 '11 at 10:05

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.

| improve this answer | |
  • Thanks! I think I made things harder, than they have to be. I've tested that by copying a large file while being in docking station (Ethernet) and while being not (Wireless). And I think Ubuntu manages it correctly. Thanks for the hint! – derroman Aug 12 '11 at 10:04
  • You can use ifconfig and have a look at the last line with the RX/TX values, so you don't have to guess where the current traffic is going from the time, spent to transfer a large file. – user unknown Jul 25 '13 at 22:31
  • 1
    It would still be useful to automatically turn wifi off, to reduce power consumption. – THelper Sep 8 '17 at 11:12

I'm also happily using a ThinkPad with a dock, but for me @Azendale's answer was not the case: after removing the laptop from the dock, internet connection would go down and required to reconnect WiFi to make it work.

So i googled up this solution and it works: https://superuser.com/a/367472/200497

As this question appears high in Google search results, i decided to share the link here.

| improve this answer | |

If you are already using tlp for power management, it has a feature to do this.

You have to modify your conf file (/etc/default/tlp)

# Radio devices to enable/disable when docked.

# Radio devices to enable/disable when undocked.
| improve this answer | |

In my Toshiba Portege z935 ultrabook, there is a setting in the BIOS that controls how the LAN and WLAN work together. One setting allows it to disable WLAN when the LAN cable is plugged in.

It may be worth it to peruse your BIOS settings and possibly update your BIOS in case it has been added as a feature. I would update BIOS as a last resort since it can result in making your system inoperable if the flashing of the updated version fails.

| 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.