2020/01/10

How to add DNS address on Ubuntu 18.04

1.[user@docker:/#] sudo nano /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:
        enp0s3:
            dhcp4: true

    version: 2
--------------------------------------------------------------------------------------------
2.Add 2 lines as below
--------------------------------------------------------------------------------------------
network:
    ethernets:
        enp0s3:
            dhcp4: true
            nameservers:
                addresses: [8.8.4.4, 8.8.8.8]
    version: 2
--------------------------------------------------------------------------------------------
3.Save and exit

沒有留言:

張貼留言