问题原文
原帖链接 · TheDiveO · CC BY-SA 3.0
On a Linux system with systemd and networkd I need to operate a WLAN access point on one WLAN interface, while operating further (hotplug) WLAN interfaces in normal station ("client") mode.
As it turns out, wpa_supplicant.service goes live on all my WLAN interfaces, which would be fine, if only all these WLAN interfaces would operate in station/client mode. However, while wpa_supplicant.service serves a WLAN interface, it's not possible (anymore?) that hostapd.service operates that WLAN interface in AP access point mode.
So I want to disable wpa_supplicant.service for a specific interface only, say wls35u2. My idea was to have a [email omitted] unit that I can selectively disable, but to leave wpa_supplicant.service enabled. However, this does not seem to work or I'm doing something wrong in the [email omitted].
So, how can I disable the WPA supplicant service on a specific interface only without globally disabling it?
社区高分解答
原帖链接 · rweisse · CC BY-SA 3.0
I had the same problem. @Nproject found a nice solution. But you don't have to modify each of this procedures. Simply go to the end of the file Nproject mentioned (/lib/dhcpcd/dhcpcd-hooks/10-wpa_supplicant) and modify the following if clause:
ORIGINAL
if [ "$ifwireless" = "1" ] && \
type wpa_supplicant >/dev/null 2>&1 && \
type wpa_cli >/dev/null 2>&1
then
case "$reason" in
PREINIT) wpa_supplicant_start;;
RECONFIGURE) wpa_supplicant_reconfigure;;
DEPARTED) wpa_supplicant_stop;;
esac
fi
Add [ "$interface" != "TheInterfaceWPASupplicantShouldBeDisabledOn" ] in this way:
MODIFIED
if [ "$ifwireless" = "1" ] && [ "$interface" != "TheInterfaceWPASupplicantShouldBeDisabledOn" ] && \
type wpa_supplicant >/dev/null 2>&1 && \
type wpa_cli >/dev/null 2>&1
then
case "$reason" in
PREINIT) wpa_supplicant_start;;
RECONFIGURE) wpa_supplicant_reconfigure;;
DEPARTED) wpa_supplicant_stop;;
esac
fi
Additionally this will prevent the Network Manager (GUI) in your taskbar to show up this interface.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
