Disable WiFi when Ethernet Cable is Connected

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

Disable WiFi when Ethernet Cable is Connected

Postby warlord » Sat Jan 10, 2015 8:12 pm

I've got a Ralink Technology, Corp. RT5370 Wireless Adapter connected to my Pi and thought it would be nice to get that disabled when I plugged in my wired cable.

The way I approached it was using the netctl-auto method as detailed here: https://wiki.archlinux.org/index.php/ne ... _operation

I spent quite a while learning not to create the special service files myself :doh: and just enable them as they get created for you eg.

$this->bbcode_second_pass_code('', '# systemctl enable netctl-auto@wlan0.service
# systemctl enable netctl-ifplugd@eth0.service')

Then it was a simple case of using hooks in the /etc/netctl/interfaces folder

# vi /etc/netctl/interfaces/eth0
$this->bbcode_second_pass_code('', '#!/bin/sh
ExecUpPost="systemctl stop netctl-auto@wlan0.service"
ExecDownPre="systemctl start netctl-auto@wlan0.service"')

# chmod +x /etc/netctl/interfaces/eth0

So when I plug in my cable it stops the auto wifi service. Unplug it an wifi starts up and connects to any of my available profiles.

I may be teaching my granny to suck eggs. But thought I'd post because I couldn't find anything straight forward to teach me how to do it.
warlord
 
Posts: 6
Joined: Thu Jan 08, 2015 6:54 pm

Return to Raspberry Pi

Who is online

Users browsing this forum: Google [Bot] and 32 guests