How to add static IP in Ubuntu 18.04.4 LTS

Static IP setup in Ubuntu 18.04.4 LTS

root@u1844lts:/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:
        enps2f0:
            addresses: [172.19.89.30/24]
            gateway4: 0.0.0.0
            nameservers:
              addresses: [8.8.8.8,8.8.4.4]
            dhcp4: no
    version: 2

#This command for you tries before you apply the settings.
You have 120 seconds for regret
$sudo netplan try
if no issues, you can use below command to apply.
$sudo netplan apply

FB 留言

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *