How to change DNS ip address in RHEL

ZephyrXT 发布于 阅读:54

https://www.cyberciti.biz/faq/change-dns-ip-address-rhel-redhat-linux/


Procedure to change DNS ip address in RHEL
Edit the /etc/resolv.conf file with an editor, such as nano or vim in RHEL: sudo vim /etc/resolv.conf
Set the name servers (DNS IP) that you want to use on RHEL : nameserver 192.168.2.254
Save and close the file in RHEL
Test new settings
How to see the current DNS settings in RHEL
Type the following cat command:
cat /etc/resolv.conf

See current DNS name server IP address on RHEL

RHEL change DNS ip address
Type the following vim command:
$ sudo vim /etc/resolv.conf

OR
# vim /etc/resolv.conf

Edit/update nameserver entry as follows (you can set maximum 3 nameserver IP address):

## Change DNS settings on RHEL (Red Hat Enterprise Linux) ##
nameserver 192.168.2.254
nameserver 192.168.2.18
Test it using the ping command or host command/dig command:
ping -c 4 www.nixcraft.com
host www.nixcraft.com
dig www.cyberciti.biz