1. Description
1. For business needs, you need to modify the dns address of the service.
2. Change it to Ali’s
2. Operation
Query the network card that needs to modify dns
ifconfig
Note 1: Pay attention to ens192, which is the name of the network card
View network card configuration file information
cd /etc/sysconfig/network-scripts
ll
backup
cp /etc/sysconfig/network-scripts/ifcfg-ens192 /etc/sysconfig/network-scripts/ifcfg-ens192.bak
edit
vi /etc/sysconfig/network-scripts/ifcfg-ens192
Edit content and save
PEERDNS=no
DNS1=223.6.6.6
1. PEERDNS=no, that is, the dns configuration is not obtained from the DHCP service
. 2. 233.6.6.6 is Ali’s
. 3. Search for others by yourself
restart service
systemctl restart network
view dns
cat /etc/resolv.conf
Description of the situation where the configuration is restored to the default after restarting
1. If it is a virtual machine, there is no problem with this configuration.
2. If it is a cloud host, the above configuration may be reset to the default configuration; even if PEERDNS is changed to 0, it is useless.
3. The final configuration result: It is still used By default, the cloud server configuration
is at the leader's place