You are not logged in.
Hi guys,
I've moved to systemd-networkd to manage my wired interface.
http://dabase.com/blog/Good_riddance_netctl/
Has anyone successfully managed to get their /etc/wpa_supplicant.conf working through systemd-networkd too?
Offline
I thought the designer of networkd specifically said that he envisioned this only for servers and desktops (where the details of the connection don't change), and not for laptops, where things like networkmanager do a better job?
Offline
Just use wpa_supplicant@.service (have it point to the right wpa_supplicant*.conf file). systemd-networkd detects interfaces coming up or down, so whenever the association occurs, it should detect it and set it up apropriately. I was using this method for a few days and it works flawlessly. But then I set up ipv6, and systemd-networkd has a ways to go as far as ipv6.
Offline
Just use wpa_supplicant@.service (have it point to the right wpa_supplicant*.conf file). systemd-networkd detects interfaces coming up or down, so whenever the association occurs, it should detect it and set it up apropriately. I was using this method for a few days and it works flawlessly. But then I set up ipv6, and systemd-networkd has a ways to go as far as ipv6.
I tried wpa_supplicant@wlan0.service, but it was missing the IP address. But once I enabled dhcpcd@wlan0.service, I noticed /usr/lib/dhcpcd/dhcpcd-hooks/10-wpa_supplicant and hence there doesn't seem to be a need for wpa_supplicant@wlan0.service!?
I updated my blog accordingly http://dabase.com/blog/Good_riddance_netctl/ and commented on a couple of dhcpcd bugs https://bugs.archlinux.org/?project=1&c … ing=dhcpcd
Offline
I thought the designer of networkd specifically said that he envisioned this only for servers and desktops (where the details of the connection don't change), and not for laptops, where things like networkmanager do a better job?
There is mention of wireless in https://coreos.com/blog/intro-to-systemd-networkd/ which led me to ask about wireless. I'm not using networkmanager because of bloat blah blah.
Offline
Okay, so I'll walk you through this since there is really not a whole lot of documentation on the subject. This assumes that your NIC is wlan0, your SSID is MyNetwork, and the password is SuperSecretPassphrase.
You need to create a wpa_supplicant-wlan0.conf. So use wpa_passphrase to generate one:
# wpa_passphrase MyNetwork SuperSecretPassphrase > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
Enable it so that it runs on boot:
# systemctl enable wpa_supplicant@wlan0.conf
Now make a file at /etc/systemd/network/00-wireless-dhcp.network (it can really be named whatever you want):
[Match]
Name=wlan0
[Network]
DHCP=yes
Now ensure that systemd-networkd.service is enabled.
# systemctl enable systemd-networkd.service
Reboot, and it should be working.
Edit: cleanup
Edit2: Okay, that is not working for me either...
Edit3: Okay nevermind, I just made a typo and named my file 00-wireless-dhcp.ntwork
Edit4: I forgot to mention that you also need to ensure that /etc/resolv.conf is a symlink to /run/systemd/network/resolv.conf. As a hack (since I don't use systemd-networkd regularly) I have the following:
$ cat /etc/systemd/system/systemd-networkd.service.d/resolv.conf
[Service]
ExecStartPost=/usr/bin/ln -sf /run/systemd/network/resolv.conf /etc/resolv.conf
ExecStopPost=/usr/bin/rm /etc/resolv.conf
ExecStopPost=/usr/bin/touch /etc/resolv.conf
Last edited by WonderWoofy (2014-03-18 03:55:59)
Offline
Thanks WonderWoofy. This is AWESOME!
I've also since updated http://dabase.com/blog/Good_riddance_netctl/
Some little comments:
`sudo systemctl enable wpa_supplicant@wlan0.service` not as you have it `# systemctl enable wpa_supplicant@wlan0.conf`
When my machine comes up on wired, both wireless and wired interfaces come up. eth0 since seems to get used judging by the routing table.
If I then unplug eth0, I hoped it would just use wlan0, but it doesn't, I just get
sudo ip route get 8.8.8.8
RTNETLINK answers: Network is unreachable
Workaround for me is to simply use the hardware wifi switch, off and on, and I'm back online.
I really think this is the way forward. I wonder where https://wiki.archlinux.org/ this information should live.
Offline
'#' is a representation of the root user's shell. So yes, you can achieve the same thing by using 'sudo' but however you elevate yourself to root is fine.
(In bash and sh the normal user's shell is represented by a '$', while in ksh and zsh the normal user is '%')
If it is trying to configure the wired interface, then you must have something else trying to use it. The first section of the systemd.network file (the [Match] section) should make it so that it only acts on the interface in question. In this case it is the Name=wlan0.
If you think you might want to use predictable network interface naming, the wireless devices will all start with a 'w' and the wired/ethernet with an 'e'. So for any potential wireless device you could also use globbing and simply put 'Name=w*'.
Offline
If you think you might want to use predictable network interface naming, the wireless devices will all start with a 'w' and the wired/ethernet with an 'e'. So for any potential wireless device you could also use globbing and simply put 'Name=w*'.
Better use "wl*". wwan interfaces start with ww.
http://www.freedesktop.org/wiki/Softwar … faceNames/
http://cgit.freedesktop.org/systemd/sys … t_id.c#n20
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
'#' is a representation of the root user's shell. So yes, you can achieve the same thing by using 'sudo' but however you elevate yourself to root is fine.
(In bash and sh the normal user's shell is represented by a '$', while in ksh and zsh the normal user is '%')
IMHO, it's not only the 'sudo', it's also wpa_supplicant@wlan0.service vs. wpa_supplicant@wlan0.conf in your systemctl command line ;-)
Offline
IMHO, it's not only the 'sudo', it's also wpa_supplicant@wlan0.service vs. wpa_supplicant@wlan0.conf in your systemctl command line ;-)
This is the ExecStart line from wpa_supplicant@.service:
ExecStart=/usr/bin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-%I.conf -i%I
So you can't use wpa_supplicant@wlan0.conf unless you name the file /etc/wpa_supplicant/wpa_supplicant-wlan0.conf.conf.
Last edited by WonderWoofy (2014-03-18 14:28:24)
Offline
Okay, so I'll walk you through this since there is really not a whole lot of documentation on the subject. This assumes that your NIC is wlan0, your SSID is MyNetwork, and the password is SuperSecretPassphrase.
You need to create a wpa_supplicant-wlan0.conf. So use wpa_passphrase to generate one:
# wpa_passphrase MyNetwork SuperSecretPassphrase > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
Enable it so that it runs on boot:
# systemctl enable wpa_supplicant@wlan0.conf
Now make a file at /etc/systemd/network/00-wireless-dhcp.network (it can really be named whatever you want):
[Match] Name=wlan0 [Network] DHCP=yes
Now ensure that systemd-networkd.service is enabled.
# systemctl enable systemd-networkd.service
Reboot, and it should be working.
Edit: cleanup
Edit2: Okay, that is not working for me either...
Edit3: Okay nevermind, I just made a typo and named my file 00-wireless-dhcp.ntwork
Edit4: I forgot to mention that you also need to ensure that /etc/resolv.conf is a symlink to /run/systemd/network/resolv.conf. As a hack (since I don't use systemd-networkd regularly) I have the following:
$ cat /etc/systemd/system/systemd-networkd.service.d/resolv.conf [Service] ExecStartPost=/usr/bin/ln -sf /run/systemd/network/resolv.conf /etc/resolv.conf ExecStopPost=/usr/bin/rm /etc/resolv.conf ExecStopPost=/usr/bin/touch /etc/resolv.conf
This needs to go to the wiki!
Offline
WonderWoofy wrote:Stuuuuuufff
This needs to go to the wiki!
I have to head off to work in a minute here. But you're welcome to submit this information to the wiki if you please. Otherwise I'll do it later when I get a minute.
Offline
Hi guys,
I've moved to systemd-networkd to manage my wired interface.
http://dabase.com/blog/Good_riddance_netctl/
Has anyone successfully managed to get their /etc/wpa_supplicant.conf working through systemd-networkd too?
I'd be interested in hearing how this goes for you. I was using systemd-networkd for a couple of days and it worked great, but it suddenly stopped working. I was using it at work, then I put it to sleep and when I woke it at home it was unable to get a connection. Journalctl says something along the lines of "couldn't save link data /run/systemd/network/links/{1, 2, 3} no such file or directory. Am curious to know if that happens to you.
Offline
Please note that you need to run systemd-resolved to allow symlinks for /etc/resolve.conf to work. It is of course mentioned on wiki page for systemd-networkd.
sorry if this is considered bumping an old thread.
Mr Green
Offline
This thread needs to go to the wiki.
Offline
This thread needs to go to the wiki.
You should put it in the wiki then. I'm just not entirely sure where to put it. Maybe you could just link back to this thread from the bottom of the wpa_supplicant and systemd-networkd pages?
Offline
Maybe you could just link back to this thread from the bottom of the wpa_supplicant and systemd-networkd pages?
This.
Offline
I've been using systemd-networkd with wpa_supplicant for 2 months now on my laptop and it works great. Btw, I followed the tutorial from this blog.
$ networkctl list
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 enp9s0 ether off unmanaged
3 wlp5s0 wlan routable configured
$ networkctl status wlp5s0
● 3: wlp5s0
Type: wlan
State: routable (configured)
Path: pci-0000:05:00.0
Driver: wl0
Vendor: Broadcom Corporation
Model: BCM4313 802.11bgn Wireless Network Adapter
HW Address: XX:XX:XX:XX:XX:XX
MTU: 1500
Address: 192.168.1.4
XXXX::XXXX:XXXX:XXXX:XXXX
DNS: 192.168.1.1
Offline