You are not logged in.

#1 2015-03-21 15:03:29

maggie
Member
Registered: 2011-02-12
Posts: 255

[netctl] wired+wifi on same laptop - favor wired go wifi if needed

I am finding the instructions on the wiki complex to have netctl connect if a wired cable is plugged in and then automatically go wireless if it is unplugged and then, if I plug in the wired connection, shut down the wireless.

https://wiki.archlinux.org/index.php/Ne … s_failover

Is there a more simple way to do this? It does not have to use netctl.

Offline

#2 2015-03-21 15:31:48

nagaseiori
Member
Registered: 2012-09-22
Posts: 72

Re: [netctl] wired+wifi on same laptop - favor wired go wifi if needed

You could use NetworkManager.

Offline

#3 2015-03-21 15:52:35

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,795
Website

Re: [netctl] wired+wifi on same laptop - favor wired go wifi if needed

I use dhcpcd.service to connect -- it switches automatically to the cable connection.

For the wireless side, you need to set up /etc/wpa_supplicant/wpa_supplicant.conf correctly (backup the original file):

# echo "ctrl_interface=DIR=/run/wpa_supplicant" > /etc/wpa_supplicant/wpa_supplicant.conf
# wpa_passphrase <SSID> <password> >> /etc/wpa_supplicant/wpa_supplicant.conf

Repeat the second step for all needed wireless access points (replace <SSID> with the name of the access point & <password> with the, er, password).

Then disable all other networking related services (check which are enabled using `ls -l /etc/systemd/system/multi-user.target.wants`) and enable dhcpcd:

# systemctl enable dhcpcd.service

This is also the fastest-starting networking service I have ever used with `systemd-analyze` reporting times in tens of milliseconds.


Jin, Jîyan, Azadî

Offline

#4 2015-03-21 17:08:33

maggie
Member
Registered: 2011-02-12
Posts: 255

Re: [netctl] wired+wifi on same laptop - favor wired go wifi if needed

Thank you for the dhcpcd advice. I have it setup as you instructed but if I unplug the wired connection, the wireless does not come up. Maybe I missed something?
#1) enabled dhcpcd.service
#2) setup /etc/wpa_supplicant/wpa_supplicant.conf
#3) rebooted with wired connection and it works
#4) unplugged the wired connection and the wireless doesn't come up

Offline

#5 2015-03-21 17:15:27

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,795
Website

Re: [netctl] wired+wifi on same laptop - favor wired go wifi if needed

Is wpa_supplicant actually running?

pstree|grep wpa

If it is, stop the .service:

# systemctl stop dhcpcd.service

Then see if you can connect to your wireless using:

# wpa_supplicant -B -i <name of interface> -c /etc/wpa_supplicant/wpa_supplicant.conf
# dhcpcd <name of interface>

Post any error messages and the content of /etc/wpa_supplicant/wpa_supplicant.conf if this doesn't connect.


Jin, Jîyan, Azadî

Offline

#6 2015-03-21 21:35:18

rsmarples
Member
Registered: 2009-05-12
Posts: 287

Re: [netctl] wired+wifi on same laptop - favor wired go wifi if needed

Head_on_a_Stick wrote:

This is also the fastest-starting networking service I have ever used with `systemd-analyze` reporting times in tens of milliseconds.

I aim to please smile
But if it's that fast it's probably just forking to the background as all interfaces don't have a carrier yet.
Also, the others probably use something extra like nm-wait-online to force a wait until something has a network connection - dhcpcd-online does the same thing, but it's part of the dhcpcd-ui project and AFAIK not in Arch proper.
But that's really just a band-aid - apps should monitor IP additions and removals if they need a specific IP to bind to.

EDIT: This is of course speculation as I neither use systemd nor Arch.

Last edited by rsmarples (2015-03-21 21:38:05)

Offline

#7 2015-03-21 21:37:27

rsmarples
Member
Registered: 2009-05-12
Posts: 287

Re: [netctl] wired+wifi on same laptop - favor wired go wifi if needed

maggie wrote:

Thank you for the dhcpcd advice. I have it setup as you instructed but if I unplug the wired connection, the wireless does not come up. Maybe I missed something?

dhcpcd never brings up the wireless - that's the job of wpa_supplicant.
dhcpcd will start wpa_supplicant if it's not already running AND wpa_supplicant.conf is configured correctly.

When it's all working, you'll find that both wired and wireless connections are active and the kernel will prefer wired based on what dhcpcd has told it.
When wired is removes, wireless then takes over almost seamlessly.

I can't really help with why the wireless isn't working for you though.

Offline

Board footer

Powered by FluxBB