首页 > 系统服务 > 详细

[operator]Ubuntu server 18 设置静态IP

时间:2019-01-14 19:40:40      阅读:206      评论:0      收藏:0      [点我收藏+]
root@ubuntu-MesosMaster-Marathon:~# cat /etc/netplan/50-cloud-init.yaml 
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-inits network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        ens33:
            addresses: [192.168.115.148/24]
            gateway4: 192.168.115.2
            dhcp4: false
            nameservers:
                    addresses: [192.168.115.2]
    version: 2

看文件格式就知道这个文件严格遵守yaml语法格式,需要 使用root权限,设置好之后可以使用如下命令进行即时生效

root@ubuntu-MesosMaster-Marathon:~# netplan apply                       
root@ubuntu-MesosMaster-Marathon:~# ping baidu.com
PING baidu.com (220.181.57.216) 56(84) bytes of data.
64 bytes from 220.181.57.216 (220.181.57.216): icmp_seq=1 ttl=128 time=25.7 ms

 

[operator]Ubuntu server 18 设置静态IP

原文:https://www.cnblogs.com/baylorqu/p/10268532.html

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