![適用於 Raspberry Pi 的 Ubuntu Server 18.04.5 的 Netplan 設定有問題](https://rvso.com/image/928535/%E9%81%A9%E7%94%A8%E6%96%BC%20Raspberry%20Pi%20%E7%9A%84%20Ubuntu%20Server%2018.04.5%20%E7%9A%84%20Netplan%20%E8%A8%AD%E5%AE%9A%E6%9C%89%E5%95%8F%E9%A1%8C.png)
所以我想為機器人專案設定一個帶有 Ubuntu 的 Raspberry Pi。我正在跟進本指南。
就像它說的那樣,我將 /etc/netplan/50-cloud-init.yaml 更改為:
network:
version: 2
renderer: networkd
# Renderer can be 'networkd' or 'NetworkManager'
ethernets:
eth0:
optional: true
dhcp4: false
wifis:
wlan0:
optional: true
dhcp4: true
access-points:
"YOUR-SSID-NAME":
password: "YOUR-PASSWORD"
# uncomment the line below if you're using a Microsoft DHCP Server
#dhcp-identifier: mac
注意:我沒有取消最後一行的註釋,因為我使用的是 macOS 系統,但不確定這是否正確。
問題是:
如果我輸入:
sudo netplan --debug try
sudo netplan --debug generate
它給了我“未知的關鍵字“wlan0”。
我嘗試用谷歌搜尋該錯誤,但我只在網路上發現了不同類型的錯誤。我希望有一個人可以幫助我。
答案1
您的 .yaml 檔案缺乏正確的格式...
它應該看起來像這樣......相同的縮進,間距,並且沒有製表符:
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: true
optional: true
wifis:
wlan0:
dhcp4: true
access-points:
"YOUR-SSID-NAME":
password: "YOUR-PASSWORD"
sudo netplan generate
sudo netplan apply
reboot
您還必須安裝 wpasupplicant...
sudo apt-get update
sudo apt-get install wpasupplicant
reboot
如果您的 .yaml 不斷被覆蓋...
您可能還需要使用以下內容建立 /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg:
network: {config: disabled}