Skip to content

Instantly share code, notes, and snippets.

@f440
Last active June 15, 2018 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save f440/808ce06820eea60f899e74f625052100 to your computer and use it in GitHub Desktop.
Save f440/808ce06820eea60f899e74f625052100 to your computer and use it in GitHub Desktop.
systemd-networkd の設定 (Thinkpad T470s)

ネットワーク設定, ワイヤレス設定, WPA supplicant, systemd-networkd, systemd-resolved

# 以前作ったnetctlの設定を削除
sudo systemctl stop netctl-auto@wlp58s0.service
sudo systemctl disable netctl-auto@wlp58s0.service

sudo -e /etc/systemd/network/wired.network
    
    [Match]
    Name=enp0s31f6 ## Which interface to use
    
    [Network]
    DHCP=ipv4 ## DHCP type, use ‘yes’ for both ipv4 and ipv6
    
    [DHCP]
    RouteMetric=10 ## Priority of this connection, lower number = bigger priority
    
sudo -e /etc/systemd/network/wireless.network
    
    [Match]
    Name=wlp58s0
    
    [Network]
    DHCP=ipv4
    
    [DHCP]
    RouteMetric=20
    
sudo systemctl enable systemd-networkd
sudo systemctl start systemd-networkd
    
sudo mv /etc/resolve.conf /etc/resolve.conf.bak
sudo systemctl enable systemd-resolved
sudo systemctl start systemd-resolved
# ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf するように指示するネット記事が散見されるけど、勝手に /usr/lib/systemd/resolv.conf -> /etc/resolv.conf が作られる
    
sudo -e /etc/wpa_supplicant/wpa_supplicant-wlp58s0.conf

    ctrl_interface=/run/wpa_supplicant
    ctrl_interface_group=wheel
    update_config=1
    
sudo chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlp58s0.conf

wpa_passphrase $SSID $PASSPHRASE | sudo tee -a /etc/wpa_supplicant/wpa_supplicant-wlp58s0.conf

sudo systemctl enable wpa_supplicant@wlp58s0
sudo systemctl start wpa_supplicant@wlp580s0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment