netctl

出自 Arch Linux 中文维基

netctl 是一個基於命令行與配置文件的網絡管理器和一個Arch項目。

安裝[編輯 | 編輯原始碼]

安裝 netctl 軟件包.

netctl 用於自動連接的的 #特殊 systemd 單元 需要一些額外的依賴項目。有關更多信息,請參閱該部分。

其他可選依賴如下表所示。

功能 依賴
WPA wpa_supplicant
DHCP dhcpcd or dhclient
wifi-menu dialog
PPPoE ppp
警吿: 不要啟用並發、導致衝突的網絡服務。在啟用 netctl 服務或配置文件前,先使用 systemctl --type=service 命令來確保沒有其他網絡服務正在運行。

配置[編輯 | 編輯原始碼]

netctl 通過配置文件來管理網絡連接和設置自動/手動/按需啟動等不同操作模式。

netctl 配置文件存放於 /etc/netctl/ 文件夾中,而示例配置存放在 /etc/netctl/examples/ 裡。

要使用示例配置文件,只需把它從 /etc/netctl/examples/ 下複製到 /etc/netctl/ 下,然後按照自己的需要進行配置。請參考下文中的 #示例配置。創建配置文件所需的第一個參數是網絡接口(Interface), 詳情請參考網絡配置#網絡接口

提示:
  • 對於無線設置,您可以以 root 權限運行 wifi-menu as 命令來在 /etc/netctl/ 下創建配置文件。您需要 dialog 軟件包才能使用 wifi-menu 命令
  • 在您的配置文件中使用 SkipNoCarrier=yes 指令,可以在無論網線是否連接的情況下都啟用靜態 IP 配置文件。

參考 netctl.profile(5) 來獲得配置文件選項的完整列表。for a complete list of profile options.

用法[編輯 | 編輯原始碼]

參考 netctl(1) 來獲得 netctl 指令的完整列表。

啟動配置文件[編輯 | 編輯原始碼]

創建配置文件後,您就可以嘗試建立連接了。以下命令中的 profile 僅為配置文件名稱,而非完整路徑:

# netctl start profile

如果以上命令運行出錯,請以 root 權限運行 journalctl -xn 或運行 netctl status profile 來獲得更詳細的錯誤説明。

啟用配置文件[編輯 | 編輯原始碼]

您可以用以下命令來讓配置文件隨系統啟動:

# netctl enable profile

這會創建一個隨計算機一起啟動的 systemd 服務。但對配置文件的修改不會自動反映到服務文件中,所以在您修改配置文件之後,請重新啟用它:

# netctl reenable profile

啟用配置文件後,它將在下次啟動時啟動。顯然,只有插好網線或者設備位於要使用的無線接入點範圍內才能成功。

如果您需要頻繁切換多個配置文件(例如,攜帶筆記本電腦旅行),請使用 #特殊 systemd 單元,而不是啟用配置文件。

特殊 systemd 單元[編輯 | 編輯原始碼]

netctl 為自動切換有線和無線連接配置文件提供了一個特殊的 systemd 服務。有關特殊 systemd 單元的完整列表,請參見 netctl.special(7)

有線網絡[編輯 | 編輯原始碼]

安裝 ifplugd 軟件包然後 啟動或啟用 netctl-ifplugd@interface.service systemd 單元。DHCP 配置文件會在網線插入或拔出時自動啟動/停止。

  • netctl-ifplugd@interface.service 服務將首選使用 DHCP 的配置文件。
  • 要自動啟動靜態IP配置文件,需要在其中設置 ExcludeAuto=no 選項。
  • 要想調高靜態 IP 配置文件的優先級,您可以設置 Priority=2,這高於 DHCP 配置文件的默認優先級 Priority=1

無線網絡[編輯 | 編輯原始碼]

啟動或啟用 netctl-auto@interface.service systemd 單元。 netctl 會在您從一個無線網絡移動到另一個無線網絡的時候自動切換配置文件(也就是無線漫遊)。

  • 配置文件必須設置 Security=wpa-configsection 或者 Security=wpa 才能使用 netctl-auto。不能用 Security=wpa-config
  • 如果你希望某些無線網絡配置文件netctl-auto@interface.service 自動啟動,您必須在配置裡明確指定 ExcludeAuto=yes 選項。
  • 您可以在 WPAConfigSection 裡設置 priority= 屬性(參考 /etc/netctl/examples/wireless-wpa-configsection) 當多個無線接入點可用時,該選項的值越大表示對應的配置文件優先級越高。

記得用您設備的實際接口名稱來替換上面的 interface 。比如 netctl-auto@wlp4s0.service。有關詳細信息,請參考 netctl.profile(5)

注意: * 如果任何配置文件包含錯誤,例如一個空的或錯誤引用的 Key= 變量,該單元將無法加載並報錯 "Failed to read or parse configuration '/run/network/wpa_supplicant_wlan0.conf',即使該配置文件未被使用。
  • 如果您曾經用 netctl#啟用配置文件,請運行 netctl disable profile 來防止該配置文件在系統啟動時被啟動兩次。

可以通過 netctl-auto 命令手動控制 netctl-auto 管理的接口,而不必停止 netctl-auto.service服務。有關可用操作的完整列表,請參見 netctl-auto(1)

技巧和竅門[編輯 | 編輯原始碼]

示例配置[編輯 | 編輯原始碼]

有線網絡[編輯 | 編輯原始碼]

對於使用 DHCP 的網絡連接,您只需把 /etc/netctl/examples/ethernet-dhcp 複製到 /etc/netctl 下,然後配置其中的 Interface 項即可。

例如:

/etc/netctl/my_dhcp_profile
Interface=enp1s0
Connection=ethernet
IP=dhcp

要設置靜態 IP,請把 /etc/netctl/examples/ethernet-static 複製到 /etc/netctl 下然後自行修改 InterfaceAddressGatewayDNS 選項。

例如:

/etc/netctl/my_static_profile
Interface=enp1s0
Connection=ethernet
IP=static
Address=('10.1.10.2/24')
Gateway='10.1.10.1'
DNS=('10.1.10.1')

注意其中的子網大小 /24。這是用無類別域間路由(英語:Classless Inter-Domain Routing,簡稱CIDR)表示法表示的,相當於子網掩碼 255.255.255.0

要在一個接口上設置多個 IP,可以這樣設置

Address=('10.1.10.2/24' '192.168.1.2/24')

要添加多個 DNS 伺服器地址:

DNS=('1.1.1.1' '1.0.0.1')

無線網絡 (WPA-PSK)[編輯 | 編輯原始碼]

以下內容適用於使用預共享密鑰(WPA-PSK)的標準無線連接。

/etc/netctl/wireless-wpa
Description='A simple WPA encrypted wireless connection using 256-bit PSK'
Interface=wlp2s2
Connection=wireless
Security=wpa
IP=dhcp
ESSID=your_essid
Key=\"64cf3ced850ecef39197bb7b7b301fc39437a6aa6c6a599d0534b16af578e04a
注意:
  • 確保對 Key 變量使用 特殊引用規則,如 netctl.profile(5) § SPECIAL QUOTING RULES 中所述。
  • 如果密碼短語失敗,請嘗試刪除 Key 變量中的 \"
  • 雖然是 Key 看起來是加密的,但是僅憑您在配置文件配置中輸入的密鑰就已經足以連接到 WPA-PSK 網絡。因此,這只能隱藏明文的密碼短語,而不會阻止對該文件具有讀訪問權限的任何人連接到網絡。

混淆無線密碼[編輯 | 編輯原始碼]

您還可以按照以下步驟來混淆無線密碼短語 (wifi-menu 在使用 -o 標誌時自動執行此操作 ) :

希望將其無線網絡的密碼以明文形式存儲的用户可以選擇存儲相應的 256 位預共享密鑰,該密鑰使用標準算法從密碼和 SSID 計算得出。

使用 wpa_passphrase 命令來計算 256 位 PSK:

$ wpa_passphrase your_essid
network={
  ssid="your_essid"
  #psk="passphrase"
  psk=64cf3ced850ecef39197bb7b7b301fc39437a6aa6c6a599d0534b16af578e04a
}

然後用預共享密鑰 (PSK) 來替換 Key 變量中的明文密碼短語。 The pre-shared key (psk) now needs to replace the plain text passphrase of the Key variable in the profile.

使用實驗性 GUI[編輯 | 編輯原始碼]

如果您想要一個圖形用户界面來管理 netctl 和您的連接,並且您不擔心使用高度實驗性的非官方軟件包,那麼有一些選項可用。netctl-guiAUR 提供了一個基於 Qt 的圖形界面、DBus 守護程序和 KDE 小部件。netmenuAUR 使用 dmenu 作為其圖形界面,gnome-shell-extension-netctl-auto-gnome-gitAUR 是 gnomeshell 擴展。

還有一個應用程式能顯示托盤圖標,和在配置文件更改時顯示桌面通知 : netctl-trayAUR

鏈路聚合[編輯 | 編輯原始碼]

本文內容或本節內容已經過期。

原因: 由於 ifenslave 已被移出內核,以下內容現已過時,需要更新,故暫不翻譯 (在Talk:Netctl討論)

From kernel documentation:

The Linux bonding driver provides a method for aggregating multiple network interfaces into a single logical "bonded" interface. The behavior of the bonded interfaces depends on the mode. Generally speaking, modes provide either hot standby or load balancing services. Additionally, link integrity monitoring may be performed.

負載均衡[編輯 | 編輯原始碼]

To use bonding with netctl, additional package from official repositories is required: ifenslave[損壞的連結:package not found].

Copy /etc/netctl/examples/bonding to /etc/netctl/bond0 and edit it, for example:

/etc/netctl/bond0
Description='Bond Interface'
Interface='bond0'
Connection=bond
BindsToInterfaces=('eth0' 'eth1')
IP=dhcp
IP6=stateless

Now you can disable your old configuration and set bond0 to be started automatically. Switch to the new profile, for example:

# netctl switch-to bond0
注意: This uses the round-robin policy, which is the default for the bonding driver. See official documentation for details.

Setting the MODE in the netctl configuration is not always successful and it may be necessary to pass options directly to the bonding module on load as noted here. This may be needed to use LACP / mode 4.

提示:To check the status and bonding mode:
$ cat /proc/net/bonding/bond0

有線到無線網絡故障切換[編輯 | 編輯原始碼]

This example describes how to use bonding to fallback to wireless when the wired Ethernet goes down. This is most useful when both the wired and wireless interface will be connected to the same network. Your wireless router/access point must be configured in bridge mode.

You will need additional packages from the official repositories: ifenslave[損壞的連結:package not found] and wpa_supplicant.

First, load the module at boot:

/etc/modules-load.d/bonding.conf
bonding

Then, configure the options of the bonding driver to use active-backup and configure the primary parameter to the device you want to be the active one (normally the wired interface). Also, be sure to use the same device name as returned when running ip link:

/etc/modprobe.d/bonding.conf
options bonding mode=active-backup miimon=100 primary=eth0 max_bonds=0

The miimon option is needed, for the link failure detection. The max_bonds option avoids the Interface bond0 already exists error. More information can be obtained on the kernel documentation.

Next, configure a netctl profile to enslave the two hardware interfaces. Use the name of all the devices you want to enslave. If you have more than two wired or wireless interfaces, you can enslave all of them on a bond interface. But, for most cases you will have only two devices, a wired and a wireless one:

/etc/netctl/failover
Description='A wired connection with failover to wireless'
Interface='bond0'
Connection=bond
BindsToInterfaces=('eth0' 'wlan0')
IP='dhcp'

Disable any other profiles (specially a wired or wireless) you had enabled before and then enable the failover profile on startup:

# netctl enable failover

Now you need to configure wpa_supplicant to connect to any known network you wish. You should create a file for each interface and enable it on systemd. Create the following file with this content:

/etc/wpa_supplicant/wpa_supplicant-wlan0.conf
ctrl_interface=/run/wpa_supplicant
update_config=1

And append to the end of this file any network you want to connect to:

network={
    ssid="SSID"
    psk=PSK
}

To generate the obfuscated PSK you can run wpa_passphrase as on the wpa_supplicant#Connecting with wpa_passphrase page.

Now, enable the wpa_supplicant@ template service on the network interface, for example wpa_supplicant@wlan0.

You can try now to reboot your machine and see if your configuration worked.

注意: If you get this error on boot bonding:
wlan0 is up - this may be due to an out of date ifenslave

Then this is happening because the wpa_supplicant is being run before the failover netctl profile. This happens because systemd runs everything in parallel, unless told otherwise. ifenslave need all the interfaces to be down before bonding them to the bond0 interface. And, since the wpa_supplicant need to put the interface up to be able to scan for networks, this might cause the interface to not be enslaved and your bonding to only have the wired interface.

If this is your case, then you will need to setup a custom dependency on the wpa_supplicant@wlan0 service in relation with the netctl@failover profile. More specifically, the wpa_supplicant must be started after the netctl profile. To accomplish this, create a custom dependency file based on the instructions provided here: systemd#Handling dependencies

/etc/systemd/system/wpa_supplicant@wlan0.service.d/customdependency.conf
[Unit]
After=netctl@failover.service

After that you can try to reboot your system again and see if it works. You can check the status of your bonding by checking journalctl for the netctl@failover.service unit.

And by checking:

# ip link

You should see something like this:

1: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
2: wlan0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP mode DORMANT group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
3: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default 
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff

Now, you can test your failover setup, by initiating a big download. Unplug your wired interface. Your download should keep going over the wireless interface. Then, plug your wired interface again and it should keep working. You can debug by checking journalctl for the netctl@failover.service and wpa_supplicant@wlan0.service units.

使用任意接口[編輯 | 編輯原始碼]

在某些情況下,可能需要允許配置文件使用系統上的任何接口。一個常見的用例是在具有不同硬件的許多機器上使用通用的磁盤映像(如果它們沒有顯示輸出,這特別有用)。如果您使用內核的命名方案,並且您的機器只有一個以太網接口,那麼 eth0 可能是是正確的接口。如果您使用 udev 的 可預測的網絡接口名稱 ,則名稱將根據特定硬件本身 ( 例如 enp1s0) 分配,而不是簡單地根據檢測到硬件的順序 (例如 eth0、 eth1) 分配。這意味着 netctl 配置文件可能僅在一台機器上工作,而不能在另一台機器上工作,因為它們各有不同的接口名稱。

一個簡單粗暴的解決方案是使用 /etc/netctl/interfaces/ 目錄。首先設置一個接口別名 (本例中為 en-any) ,然後在目錄下創建一個同名文件 (確保它具有可執行權限)。

/etc/netctl/interfaces/en-any
#!/bin/sh
for interface in /sys/class/net/en*; do
        break;
done
Interface=$(basename "$interface")
echo "en-any: using interface $Interface";

然後創建一個使用該接口的配置文件。特別注意 Interface 指令,請把它設置為剛剛創建的接口別名。其餘部分僅作為示例提供。

/etc/netctl/wired
Description='Wired'
Interface=en-any
Connection=ethernet
IP=static
Address=('192.168.1.15/24')
Gateway='192.168.1.1'
DNS=('192.168.1.1')

wired 配置文件啟動時,使用上述兩個文件的任何機器都會自動啟動並配置系統上找到的第一個以太網接口,而不管 udev 分配給它什麼名稱。請注意,這不是配置接口的最可靠的方法。如果您使用多個接口,netctl 可能會嘗試為它們分配相同的接口,這可能會導致連接中斷。如果您不介意更複雜的解決方案,netctl-auto 可能更可靠。

使用鈎子[編輯 | 編輯原始碼]

netctl 支持 /etc/netctl/hooks/ 中的鈎子和 /etc/netctl/interfaces/ 中的每個接口鈎子,您可以在鈎子中設置任何配置文件支持的選項。其中包括最重要的 ExecUpPostExecDownPre

在讀取配置文件前,netctl 會先運行 hooks 目錄下的所有可執行的腳本,然後才讀取配置文件來建立連接。最後它會運行 interfaces 目錄下與接口同名的可執行腳本(接口鈎子)。因此,配置文件中的選項可以被接口鈎子覆蓋,而 /etc/netctl/hooks/ 下的鈎子選項又可以被配置文件所覆蓋。


只有在使用 netctl-auto 時,變量 $INTERFACE$ACTION 才能在鈎子或接口鈎子中使用。

示例[編輯 | 編輯原始碼]

連接建立時執行命令[編輯 | 編輯原始碼]
/etc/netctl/hooks/myservices
#!/bin/sh
ExecUpPost="systemctl start crashplan.service; systemctl start dropbox@<username>.service"
ExecDownPre="systemctl stop crashplan.service; systemctl stop dropbox@<username>.service"
設置默認 DHCP 客户端[編輯 | 編輯原始碼]

要設置或更改用於所有配置文件的 DHCP 客户端,請執行以下操作:

/etc/netctl/hooks/dhcp
#!/bin/sh
DHCPClient='dhclient'

不要忘記給文件添加可執行權限

或者也可以對某個特定的網絡接口設置單獨的 DHCP 客户端,只需要創建一個接口鈎子(/etc/netctl/interfaces/<interface> 腳本)並設置如下參數就可以了:

DHCPClient='dhclient'

最簡易的 WPAConfigSection 配置[編輯 | 編輯原始碼]

netctl.profile(5) § OPTIONS FOR ‘WIRELESS’ CONNECTIONS 中所述,WPAConfigSection 變量是傳遞給 wpa_supplicant 的配置項數組。因此,一個最簡單的 WPAConfigSection 將包含:

Description='A wireless connection using a custom network block configuration'
Interface=wlan0
Connection=wireless
Security=wpa-configsection
IP=dhcp
WPAConfigSection=(
    'ssid="University"'
    'psk="very secret passphrase"'
)
注意: 如果要連接到具有非 ASCII 字符(unicode、表情符號等)的 SSID,可以將 SSID 指定為十六進制而不是字符串,例如 ssid=F09F90BA 表示「🐺」。 當不確定十六進制編碼時,可以運行 wifi-menu 命令來查看(確保刪除 \ 和 x 字符)。

/etc/resolv.conf[編輯 | 編輯原始碼]

如果您在配置文件中使用 DNS* 選項,netctl 將調用 resolvconf 來覆蓋 resolv.conf

故障排除[編輯 | 編輯原始碼]

Job for netctl@wlan(...).service failed[編輯 | 編輯原始碼]

警吿: 本節假設在啟動 netctl 配置文件或服務之前沒有其他網絡服務正在運行。有關詳細信息,請參閱 #安裝

有些人在使用 netctl 連接網絡時會遇到問題,例如:

# netctl start wlan0-ssid
Job for netctl@wlan0\x2ssid.service failed. See 'systemctl status netctl@wlan0\x2ssid.service' and 'journalctl -xn' for details.

當以 root 身份運行 journalctl -xn 查看日誌時,可能會看到以下錯誤:

1. 如果您的網絡接口(在本例中為 wlan0)已啟動:

network[2322]: The interface of network profile 'wlan0-ssid' is already up

禁用網絡接口可能能夠解決這個問題:

# ip link set wlan0 down

然後再重試:

# netctl start wlan0-ssid

2. 如果錯誤仍然存在,請在添加 ForceConnect 選項後重試:

/etc/netctl/wlan0-ssid
...
ForceConnect=yes

保存並嘗試再次啟動配置文件 :

# netctl start wlan0-ssid

dhcpcd: ipv4_addroute: File exists[編輯 | 編輯原始碼]

在某些系統上,把 dhcpcd 與 netctl 結合使用會導致喚醒計算機時出現超時問題,特別是在你切換了網絡的時候。netctl 將報吿稱已成功連接,但你仍然會遇到連接超時等問題。這種情況是因為舊的默認路由仍然存在,並且沒有被更新。避免這種問題的一個方法是改用 dhclient 作默認 dhcp 客户端。 有關此問題的更多信息,請 參閱此處.

DHCP 超時問題[編輯 | 編輯原始碼]

如果您在通過 DHCP 請求租約時遇到超時問題,則可以將超時值設置得比 netctl 默認的 30 秒長。比如可以在 /etc/netctl/hooks//etc/netctl/interfaces/ 中創建一個可執行文件,並向其中添加 TimeoutDHCP=40 選項。

調試 dhcpcd[編輯 | 編輯原始碼]

如果 dhcpcd 無法獲得一個地址,請將 -d 選項添加到 /usr/lib/netctl/dhcp,然後以 root 用户身份運行 journalctl -xe 來查看調試日誌。通過查看調試日誌,您可能能發現客户端因為 IP 地址已被使用而拒絕了伺服器提供的 IP 地址等錯誤原因。

連接超時問題[編輯 | 編輯原始碼]

如果您遇到與 DHCP 無關的超時問題 ( 例如在使用靜態 IP 的連接上 ) ,並且在啟動配置文件時遇到類似下列錯誤:

# journalctl _SYSTEMD_UNIT=netctl@profile.service
Starting network profile 'profile'...
No connection found on interface 'eth0' (timeout)
Failed to bring the network up for profile 'profile'

那麼,您應該修改 TimeoutCarrier=TimeoutUp= 選項來調高檢測網線插好和網卡就緒的超時時間。

/etc/netctl/profile
...
TimeoutUp=300
TimeoutCarrier=300

別忘了用以下命令重新啟用配置文件:

# netctl reenable profile

喚醒時 netctl-auto 故障[編輯 | 編輯原始碼]

有時,當系統從掛起、休眠或混合休眠恢復時,netctl-auto 無法重新連接。一個簡單的解決方案是重新啟動 netctl-auto 服務。這可以通過類似 netctl-auto-resumeAUR 這樣的附加服務實現自動化:

/etc/systemd/system/netctl-auto-resume@.service
[Unit]
Description=restart netctl-auto on resume.
Requisite=netctl-auto@%i.service
After=sleep.target

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl restart netctl-auto@%i.service

[Install]
WantedBy=sleep.target

要為您的無線網卡 啟用 此服務,請以 root 權限啟用 netctl-auto-resume@wlan0.service 服務,並將其中的 wlan0 更改為所需的網絡接口。

如果服務單元啟動時,對應的網卡尚未恢復運行,則此操作將失敗。您可以通過在 After 選項中添加要依賴的 Systemd 目標 來修復 :

/etc/systemd/system/netctl-auto-resume@.service
...
After=sleep.target sys-subsystem-net-devices-%i.device
...

netctl-auto 無法自動解鎖無線網卡[編輯 | 編輯原始碼]

許多筆記本電腦有一個硬件按鈕 ( 或開關 ) 來屏蔽無線網卡,但是該卡也可以被內核屏蔽。這可以由 rfkill 處理。

如果您希望 netctl-auto 自動解禁您的無線卡並連接到特定網絡,請參考 netctl.profile(5) 為您的無線網絡連接設置 RFKill=++auto++ 選項。

在使用多個網卡時提示 RTNETLINK answers: File exists[編輯 | 編輯原始碼]

這是一個非常具有誤導性的報錯,這實際上意味着您已經在之前的某個 netctl 控制文件配置了一個默認路由。當 netctl 在啟動第 n 個網卡並且嘗試設置它的本地路由時,因為已經在啟動第 n-1 個網卡時設置過默認路由了,所以該操作會失敗。

把它刪掉後就一切正常了,除了因為沒有默認路由而無法正常上網以外。而即使用 ExecUpPost 也無法解決這個問題,因為他也會為每個網卡執行一遍。

一種可能的解決方案是創建一個新服務。並將下面的「FIRST_INTERFACE」和「SECOND_INTERFACE」替換為接口名稱,將「192.168.xxx.yyy」替換為你的默認網關。

/etc/systemd/system/defaultrouter.service
[Unit]
Description="Configure default gateway"
Requires=netctl@FIRST_INTERFACE.service netctl@SECOND_INTERFACE.service
After=netctl@FIRST_INTERFACE.service netctl@SECOND_INTERFACE.service

[Service]
Type=oneshot
ExecStart=/usr/bin/ip route add default via 192.168.xxx.yyy

[Install]
WantedBy=network-online.target

使用 eduroam 和其他 MSCHAPv2 連接時遇到問題[編輯 | 編輯原始碼]

參見 wpa_supplicant#Problems with eduroam and other MSCHAPv2 connections

在配置文件中使用 .include 指令導致日誌警吿[編輯 | 編輯原始碼]

仍然使用 systemd 舊的 .include 指令的配置文件將生成日誌警吿,例如:

systemd[1]: /etc/systemd/system/netctl@<profile>.service:1: .include directives are deprecated, and support for them will be removed in a future version of systemd. Please use drop-in files instead.

詳見 FS#59494

執行

netctl reenable profile

能配置文件更新為新的 drop-in unit file 格式。

鈎子無效[編輯 | 編輯原始碼]

如果在 /etc/netctl/hooks/ 中有多個鈎子,那麼像 ExecUpPostExecDownPre 這樣的變量會被重複覆蓋,導致只能執行其中一個文件的。要解決此問題,請如下定義變量:

/etc/netctl/hooks/test
ExecUpPost="some command ; "$ExecUpPost
ExecDownPre="some command ; "$ExecDownPre

這樣可以在其他命令前面附加要執行的命令,防止被重複覆蓋。

參閱[編輯 | 編輯原始碼]