How to edit resolv.conf?

To edit the /etc/resolv.conf file, you typically need superuser (root) privileges. Here’s how you can do it:

  1. Open a Terminal.

  2. Use a text editor with superuser privileges. For example, you can use nano or vim. Here’s how to do it with nano:

    sudo nano /etc/resolv.conf

    Or with vim:

    sudo vim /etc/resolv.conf
  3. Make your changes. You can add or modify nameserver entries. For example:

    nameserver 8.8.8.8
    nameserver 8.8.4.4
  4. Save and exit:

    • In nano, press CTRL + X, then Y to confirm, and Enter to save.
    • In vim, press Esc, type :wq, and hit Enter.

Note:

Changes to /etc/resolv.conf may be overwritten by network management services (like NetworkManager) on reboot or when the network is restarted. To make persistent changes, consider configuring your network settings through those services.

If you have any further questions, feel free to ask!

0 Comments

no data
Be the first to share your comment!