• ubuntu18.04 server配置静态ip


    最新发布的ubuntu18.04 server,启用了新的网络工具netplan,对于命令行配置网络参数跟之前的版本有比较大的差别,现在介绍如下:
    1.其网络配置文件是放在/etc/netplan/50-cloud-init.yaml, 缺省是用dhcp方式,如果要配置静态地址,则需要修改此文件的想关内容,见如下的例子:

    webapp@webapp:~$ 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:
    eth0:                        #网卡名称已经更改为eth0,更改方法见之前的博客
    addresses: [10.0.91.136/24]
    gateway4: 10.0.91.1
    dhcp4: false
    optional: true
    nameservers:
    addresses: [114.114.114.114]
    version: 2

    2.使其生效的方法:
    sudo netplan apply
    如果配置有问题会报错,如果没问题,则会新的配置会立即生效。
    注意:以上设置仅针对ubuntu18.04 Server版,对于18.04 desktop它缺省是使用NetworkManger来进行管理,可使用图形界面进行配置,其网络配置文件是保存在:/etc/NetworkManager/system-connections目录下

  • 相关阅读:
    POJ 3253 Fence Repair
    POJ 2431 Expedition
    NYOJ 269 VF
    NYOJ 456 邮票分你一半
    划分数问题 DP
    HDU 1253 胜利大逃亡
    NYOJ 294 Bot Trust
    NYOJ 36 最长公共子序列
    HDU 1555 How many days?
    01背包 (大数据)
  • 原文地址:https://www.cnblogs.com/wyzhou/p/10404633.html
Copyright © 2020-2023  润新知