You are not logged in.

#1 2015-08-06 20:30:49

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 81
Website

[SOLVED] Can't get systemd-networkd + wpa_supplicant to work

Hi,

I've been using wicd for ages, but since it's no longer maintained (and recent versions of wicd-curses are buggy), I wanted to switch to something better and simpler: systemd-networkd + wpa_supplicant (+ systemd-resolved).

By following the wiki (systemd-networkd, wpa_supplicant), as well as some blog tutorials (e.g. here, here, and here), I've managed to connect to my network. The problem is that I can't ping/browse anything besides my assigned IP and localhost.

Steps I took (my wireless device is called wlp1s0):

- create /etc/systemd/network/wireless.network:

[Match]
Name=wl*

[Network]
DHCP=yes

- stop and disable wicd.service
- enable systemd-networkd.service
- remove /etc/resolv.conf and symlink /run/systemd/resolve/resolv.conf to /etc/resolv.conf
- enable systemd-resolved.service
- create /etc/wpa_supplicant/wpa_supplicant-wlp1s0.conf:

ctrl_interface=/run/wpa_supplicant
update_config=1

network={
    ssid="mywifinetwork"
    psk="mypassword"
}

- enable wpa_supplicant@wlp1s0.service
- reboot

Like I said, it seems to connect to my network just fine, as verified with iw dev wlp1s0 link, or checking status inside wpa_cli. However, I can't ping anything besides 192.168.1.100 (or ...101 or whatever) or localhost; ping www.google.com just sits there.

I've also tried using dhcpcd@wlp1s0.service / dhcpcd.service instead of systemd-resolved.service, with no luck.

I've also tried doing everything manually without systemd, i.e. by first running wpa_supplicant in the terminal, then running dhcpcd to get an IP; same problem.

Interestingly, if I first connect using wicd, and then disconnect and stop wicd.service, then I can connect perfectly fine to my network using wpa_supplicant (either the service or in terminal) and ping google and browse like normal.

Any idea what's going on?

Last edited by brianb (2015-08-08 13:03:25)

Offline

#2 2015-08-06 22:33:59

James Barrett
Member
Registered: 2015-08-06
Posts: 7

Re: [SOLVED] Can't get systemd-networkd + wpa_supplicant to work

i dont use the same method as you but could you try


[Match]
Name=wlp2s0

[Network]
DHCP=ipv4


instead of "true" as you have it?

i know it should work with true but worth trying. aslo have you tried with the full device name?

also the dns option may help

[Network]
DHCP=ipv4
DNS=your routers dns

Last edited by James Barrett (2015-08-06 22:38:05)

Offline

#3 2015-08-06 23:00:12

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 81
Website

Re: [SOLVED] Can't get systemd-networkd + wpa_supplicant to work

Thanks for the reply.

DHCP=ipv4 is actually the first thing I tried (because it's what I saw first), then I switched to DHCP=yes to see if it made a difference--but neither one works.

Regarding DNS, I should've mentioned that, when I "connect" and run journalctl -b -f, I keep seeing the following lines every few seconds:

Switching to DNS server XXX for interface wlp1s0
Switching to DNS server YYY for interface wlp1s0
Switching to DNS server XXX for interface wlp1s0
Switching to DNS server YYY for interface wlp1s0
...

Not really sure what that means. Right now, I'm connected just fine with wicd, and when I run journalctl -b -f, I don't see any DNS switching at all.

Offline

#4 2015-08-06 23:05:31

James Barrett
Member
Registered: 2015-08-06
Posts: 7

Re: [SOLVED] Can't get systemd-networkd + wpa_supplicant to work

I use wifi-menu have you not thought about that?

installled

dialog
wpa_supplicant
iw

then run

#wifi-menu -o

select network

give it a easy name such as home-wifi

add password and connect

the to auto start

i just

# netctl enable home-wifi  or if you dnt want it auto its # netctl start home-wifi

then it comes up on boot

also to remove its just

# netctl remove home-wifi or if manual # netctl stop home-wifi

i found this the simplest method for my needs
sorry i cant help you more i have no experience in your method

in fact i tell a lie i did use it a while ago and i remeber i had all the info in there

ip address of router  i.e 192.168.1.1

dns of router i.e. 192.168.1.1

just makes life hard when on a laptop and not using a desktop environment tools, which is why i favoured wifi-menu

Last edited by James Barrett (2015-08-06 23:10:25)

Offline

#5 2015-08-07 11:05:15

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] Can't get systemd-networkd + wpa_supplicant to work

Can you ping a specific external IP?

ping -c3 8.8.8.8

What is the output of:

cat /etc/resolv.conf

Your wpa_supplicant configuration file looks a little different to the example in the ArchWiki.
https://wiki.archlinux.org/index.php/WP … figuration

Offline

#6 2015-08-07 16:21:08

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 81
Website

Re: [SOLVED] Can't get systemd-networkd + wpa_supplicant to work

@James Barrett: Thanks, but to be honest I was kind of sold on the simplicity and intuitiveness of the wpa_supplicant method, without any overhead, and at this point it's a puzzle that I really want to figure out, rather than migrating from wicd to netctl or connman or whatever.

@Head_on_a_Stick:

Head_on_a_Stick wrote:

Can you ping a specific external IP?

Nope:

% ping -c3 8.8.8.8                                                                                                ~
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 10.1.10.9 icmp_seq=1 Destination Host Unreachable
From 10.1.10.9 icmp_seq=2 Destination Host Unreachable
From 10.1.10.9 icmp_seq=3 Destination Host Unreachable

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 1999ms
pipe 2
Head_on_a_Stick wrote:

What is the output of:

cat /etc/resolv.conf

You mean the symlink to /run/systemd/resolve/resolv.conf? It lists the two nameservers corresponding to my router's DNS. It's the exact same contents regardless of whether it's the symlink to /run/systemd/resolve/resolv.conf or a static file (wicd method).

Head_on_a_Stick wrote:

Your wpa_supplicant configuration file looks a little different to the example in the ArchWiki.

I've tried making it exactly like in the wiki--didn't help. I think the important lines are

ctrl_interface=/run/wpa_supplicant
update_config=1

(Changing to ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel didn't do anything different.)

I don't think fast_reauth=1 and ap_scan=1 matter much, but I tried them anyway, to no avail.

Last edited by brianb (2015-08-07 16:54:38)

Offline

#7 2015-08-08 13:00:42

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 81
Website

Re: [SOLVED] Can't get systemd-networkd + wpa_supplicant to work

Solved: I discovered that I had two network files in /etc/systemd/network/--one for wireless (wireless.network), one for wired (wired.network). For some reason, wired.network was configured for a static IP address (this), rather than dynamic (this). I changed it to the latter, and everything is perfect now.

(I think the problem with having a static IP configuration for wired.network is that, even if you're using wireless, resolv.conf ends up including an incorrect DNS server.)

Offline

Board footer

Powered by FluxBB