ubuntu server 18.04 set dns server name without change after reboot
I am new in ubuntu.
When installing Ubuntu, I set the network settings manually and manually set up the IP and DNS server in installation wizard , but now I after installation complete can not change the settings (especially DNS) in installed ubuntu. In other words, I do not know where these settings are stored. I tried different solutions but none of them worked. Can you guide me? Thanks
OS : ubuntu server 18.04
Solution 1:
In Ubuntu 18.04 server and all later versions of Server that you install from the ISO manually yourself, all configurations for networking during installation are stored in Netplan YAML files, in /etc/netplan/
.
Post installation, if you want to configure your networking differently, you will edit the YAML file that was created in /etc/netplan/
with your favorite editor (such as nano
or vim
) as superuser (prepend sudo
to the command to edit). It might even save it as '50-cloud-init.yaml' but that's fine, you can edit that file even if it says 'cloud-init' generates it - it shouldn't regenerate it post install.
Netplan configuration files have this type of YAML structure if you set a static IP and DNS (and didn't use DHCP) - this is a configuration from an 18.04 VM running on my network which has a special DNS server as well as Google DNS for its specialized configuration as an example of a 'complete' NetPlan configuration:
network:
version: 2
renderer: networkd
ethernets:
enp8s0:
dhcp4: false
addresses:
- 10.10.1.0/16
gateway4: 10.10.0.1
nameservers:
addresses:
- 10.10.1.2
- 8.8.8.8
- 8.8.4.4
If you edit the file, you should then run sudo netplan apply
and make sure everything works fine. No reboot necessary. If the configurations don't work, revert whatever change you make, and run sudo netplan apply
again.