How to configure DNS for Ubuntu to make it permanent

Copyright statement: This article is an original article of hard work, and all major self-media platforms are updated simultaneously. Welcome to reprint, please indicate the source, thank you.

The virtualization project has recently come to an end. Our virtualization platform is based on the underlying system of Ubuntu customized Linux. Today a service needs to use the DNS service of the external network, so it is necessary to configure the DNS address as a RHEL7-based operator Maintenance engineer, the previous method is not very effective. Configured in /etc/resolv.conf: nameserver 114.114.114.114, it is found to be invalid after the next restart, and it has to be reconfigured.
The Ubuntu version I use is:

root@Geeklp:~# cat /etc/issue
Ubuntu 12.04 LTS \n \l

After checking the information, the permanent configuration file for configuring the dns of the Ubuntu system is: /etc/network/interfaces. For example, to configure the DNS address for the network card vswitch0, add a line below, with the content:
dns-nameservers 114.114.114.114
After the configuration is complete, the configuration file of the entire network card is:

auto vswitch0
iface vswitch0 inet static
  address 10.18.9.23
  netmask 255.255.255.0
  gateway 10.18.9.254
  network 10.18.9.0
  broadcast 10.18.9.255
  dns-nameservers 114.114.114.114

Recommended Posts

How to configure DNS for Ubuntu to make it permanent
How to configure Redis cluster on Ubuntu 14.04
How to configure Redis replication on Ubuntu 16.04
How to install and configure NATS on Ubuntu 16.04
How to install and configure Gogs on Ubuntu 18.04
How to configure TensorFlow use environment in Ubuntu
How to install and configure Cyberpanel on Ubuntu 18.04
How to install and configure ownCloud on Ubuntu 16.04
How to install and configure GitLab on Ubuntu 18.04
How to install and configure Ansible on Ubuntu 18.04
How to install and configure Elasticsearch on Ubuntu 16.04
How to install and configure PostGIS on Ubuntu 14.04
How to install and configure VNC on Ubuntu 18.04
How to install and configure Sphinx on Ubuntu 16.04
How to install and configure OrientDB on Ubuntu 14.04
How to configure /var/log/messages in Ubuntu system log
How to configure Apache content caching on Ubuntu 14.04
How to install and configure AppScale on Ubuntu 12.04
How to install and configure PostGIS on Ubuntu 14.04
How to upgrade to Ubuntu 20.04
How to upgrade to Ubuntu 20.04
How to set up a DNS server on Ubuntu 18.04
How to set up Ghost one-click app for Ubuntu 16.04
How to configure a fixed IP based on Ubuntu 18.04
How to upgrade to Ubuntu 16.04 LTS
How to create LVM for XFS file system under Ubuntu
How to set up vsftpd for anonymous downloads on Ubuntu 16.04
How to install memcache and start it in ubuntu environment
How to set up vsftpd for user directories on Ubuntu 16.04
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to use hanlp in ubuntu
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to install Vagrant on Ubuntu 20.04
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to compile ijkplayer-android under ubuntu
How to install Anaconda3 on Ubuntu 18.04
How to install mysql in Ubuntu 14.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install MemSQL on Ubuntu 14.04
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04
How to install PrestaShop on Ubuntu 16.04
How to upgrade to PHP 7 on Ubuntu 14.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to install Python 3.8 on Ubuntu 18.04
How to install KVM on Ubuntu 18.04