zoukankan      html  css  js  c++  java
  • [operator]Ubuntu server 18 设置静态IP

    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-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:
            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
  • 相关阅读:
    2019/3/20统计单词数
    2019/3/20日历问题
    2019/3/20计算器1
    2019/3/17素数因子
    2019/3/17日历问题2
    2019/2/14多项式输出
    2019/2/13打印华氏温度与摄氏温度对照表
    2019/2/12孪生素数
    2019/2/12开灯问题
    2019/2/11 6084问题
  • 原文地址:https://www.cnblogs.com/baylorqu/p/10268532.html
Copyright © 2011-2022 走看看