Score:0

ubuntu server 18.04 set dns server name without change after reboot

kr flag

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 
chili555 avatar
cn flag
"I set the network settings manually and manually set up the IP and DNS server" Where? In Network Manager? "but now I can not change the settings (especially DNS)" Where? Please edit your question to clarify these points.
Amir133 avatar
kr flag
@chili555 my question updated ,Thanks
ru flag
This is Ubuntu 18.04 desktop, or Server? Which you used to install is going to detoermine the answer.
Amir133 avatar
kr flag
it's ubuntu 18.04 server not desktop. it dose not have a Gui to modify setting
ru flag
@Amir133 just making sure, because then that means it's a Netplan configuration not a Networkmanager configuration. Answer below has that info.
Score:1
ru flag

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.

Amir133 avatar
kr flag
thanks, perfect, but if I change this file , I need to restart my ubuntu or nothing to do?
ru flag
@Amir133 you won't need to reboot, but you'll need to `sudo netplan apply` to live-change the settings while you're online.
ru flag
@chili555 already done now. (comment nuke inbound)
ru flag
@Amir133 also, in the event this question did NOT solve your issue, please don't mark it as accepted. (Or, if it did, then leave it accepted. :) )
Amir133 avatar
kr flag
it solved my problem. thanks for Answer
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.