码迷,mamicode.com
首页 > Web开发 > 详细

[Linux] Ubuntu 18 LTS netplan 网络配置

时间:2018-07-23 17:18:39      阅读:848      评论:0      收藏:0      [点我收藏+]

标签:pre   生效   been   you   gateway   apt   ace   network   yaml   

Ubuntu 18 LTS netplan 网络配置

今天装完 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

[Linux] Ubuntu 18 LTS netplan 网络配置

标签:pre   生效   been   you   gateway   apt   ace   network   yaml   

原文地址:https://www.cnblogs.com/abeen/p/9355493.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!