30秒學會配置 Ubuntu18.04 網絡


關鍵詞:netplan config network 網絡 配置 ubuntu


1. 重要:Ubuntu 18.04 網絡配置與Ubuntu 16.04網絡配置變動較大



2.修改網絡配置文件 /etc/netplan/01-netcfg.yaml

$ sudo vim /etc/netplan/01-netcfg.yaml

修改模板

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
  # 網卡名
    ens18:
    # 是否使用 dhcp4
     dhcp4: no
     # ip 地址
     addresses: [A.A.A.A/24]
     # 網關
     gateway4: G.G.G.G
     # dns 域名解析服務器地址
     nameservers:
       addresses: [N.N.N.N]


3.應用網絡配置

$ sudo netplan apply

如果應用失敗,可以查看錯誤日誌並調試

$ sudo netplan --debug apply

最後:參考文檔

1.1 How to solve error in network definition expected mapping error / set a static IP adress on Ubuntu 18.04 LTS Desktop and Server via netplan https://www.mehmetakiferen.com/how-to-solve-error-in-network-definition-expected-mapping-error-set-a-static-ip-adress-on-ubuntu-18-04-lts-desktop-and-server.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章