Linux tutorial: Set a custom default dns address for centos7

888u

Last update at :2024-01-25,Edit by888u

We all know that when configuring CentOS, you need to be able to connect to the Internet to download things, and you need to use the DNS resolution function. Some centos do not have DNS configured by default or the default DNS resolution is too slow. This time the blogger will bring you the latest tutorial on setting up dns in centos. The following operations require basic command knowledge, please do not operate if you do not know how to do it.

1. Configure DNS

1. You must run the following command as administrator root or with administrator privileges

sudo vi /etc/resolv.conf

2. Add the following IP to the file opened by the above file command

nameserver 8.8.8.8 nameserver 114.114.114.114

3. Save and exit, and then use dig to verify whether it is parsed normally

dig www.baidu.com +short

4. If the result appears, it means it is normal.

2. Reload network configuration

1. Execute the following command to restart the network card

service network restart

2. Restart the network card and execute the wget download command. If the download is normal, the dns configuration is correct. If the download cannot be performed, the dns configuration is incorrect

Recommended site searches: virtual host evaluation, host discount code, Chinese domain name, ftp free space domain name transfer, me domain name registration, monthly paid space, Suqian server, host domain name, free ip,

Linux tutorial: Set a custom default dns address for centos7

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码