2021-05-12 14:32:11
Ubuntu 18 LTS netplan 網路設定
2020-06-16 16:47:06
今天裝完 Ubuntu 18 LTS,設定網路時發現Ubuntu 18LTS ifupdown has been replaced by netplan(5) on this system。
隨手記錄一下netplan設定。
- vim /etc/network/interfaces 修改網路設定時發現Ubuntu 18LTS ifupdown has been replaced by netplan(5) on this system。
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
- 直接設定netplan吧
vim /etc/netplan/50-cloud-init.yaml
設定如下:
network:
ethernets:
enp4s0:
addresses: [192.168.0.20/24] //IP址
gateway4: 192.168.0.1 // 閘道器
nameservers:
addresses: [114.114.114.114, 192.168.0.1] //DNS
dhcp4: no
optional: no
version: 2
- 啟用生效
sudo netplan apply
相關文章