Ubuntu

Ubuntu 18.04 上的 netplan 配置失敗

  • August 29, 2018

編輯:這是我使用程式碼重命名介面後的精確情況。

這是我的網路計劃配置文件:

network:
 version: 2
 renderer: networkd
 ethernets:
   eno1:
     dhcp4: no
     dhcp6: no
     addresses: [192.168.1.93/24]
     gateway4: 192.168.1.91
     nameservers:
       addresses: [8.8.8.8, 8.8.4.4]

這是ip addr ls的輸出

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
   link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: rename2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
   link/ether 00:1e:67:d6:33:24 brd ff:ff:ff:ff:ff:ff
3: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
  link/ether 00:1e:67:d6:33:25 brd ff:ff:ff:ff:ff:ff

當我執行sudo netplan –debug generate時,我得到以下輸出:

** (generate:1571): DEBUG: 00:08:01.444: Processing input file //etc/netplan/10-systemd-networkd-eth.yaml..
** (generate:1571): DEBUG: 00:08:01.444: starting new processing pass
** (generate:1571): DEBUG: 00:08:01.444: eno1: setting default backend to 1
** (generate:1571): DEBUG: 00:08:01.444: Generating output files..
** (generate:1571): DEBUG: 00:08:01.444: NetworkManager: definition eno1 is not for us (backend 1)

這是systemctl status systemd-networkd的輸出:

systemd-networkd.service - Network Service
  Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
  Active: active (running) since Wed 2018-08-29 23:31:20 IST; 1h 1min ago
    Docs: man:systemd-networkd.service(8)
Main PID: 570 (systemd-network)
  Status: "Processing requests..."
   Tasks: 1 (limit: 4915)
  CGroup: /system.slice/systemd-networkd.service
          └─570 /lib/systemd/systemd-networkd

Aug 29 23:31:19 august2018 systemd[1]: Starting Network Service...
Aug 29 23:31:20 august2018 systemd-networkd[570]: Enumeration completed
Aug 29 23:31:20 august2018 systemd[1]: Started Network Service.
Aug 29 23:35:01 august2018 systemd-networkd[570]: eno1: Gained carrier
Aug 29 23:35:03 august2018 systemd-networkd[570]: eno1: Gained IPv6LL 

您已經ethMac在需要實際介面名稱的地方使用了文字字元串。將此更改為介面名稱,您可以通過執行命令來了解該名稱ip link

引用自:https://serverfault.com/questions/928582