首页 > 系统服务 > 详细

Ubuntu 18.04 配置固定IP和DNS

时间:2020-10-16 17:18:10      阅读:38      评论:0      收藏:0      [点我收藏+]

 

1.修改静态IP地址

root@ubuntu:/etc/netplan# pwd
/etc/netplan
root@ubuntu:/etc/netplan# ls
50-cloud-init.yaml

编辑50-cloud-init.yaml

root@ubuntu:/etc/netplan# cat 50-cloud-init.yaml 
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init‘s
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eth0:
            addresses: [172.16.5.140/24]
            gateway4: 172.16.5.254
            dhcp4: true
            optional: true
    version: 2

以上会把IP配置为,172.16.5.140,DNS为172.16.5.254

 

2.修改DNS

sudo vi /etc/systemd/resolved.conf

取消"dns"一行的注释,并添加需要的dns地址即可

 

 

 

Ubuntu 18.04 配置固定IP和DNS

原文:https://www.cnblogs.com/iblk/p/13826742.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!