Skip to content
TrySitePrice

How to change DNS ip address in RHEL (Red Hat Enterprise Linux)

Best/Tutorial

You can change the DNS IP address in Red Hat Enterprise Linux by editing the network configuration file. Here's how:

  1. Open the network configuration file: sudo nano /etc/sysconfig/network-scripts/ifcfg-<interface> where <interface> is the name of your network interface (e.g. eth0).
  2. Modify the DNS line to the desired IP address, e.g.: DNS1=8.8.8.8
  3. Save the file and exit the editor.
  4. Restart the network service to apply the changes: sudo systemctl restart network
  5. Verify the changes by checking the DNS resolution: nslookup google.com
rnNote: The exact file path and instructions may vary depending on the version of Red Hat Enterprise Linux you are using.