Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-15-2019, 06:21 PM   #1
LQ Newbie
Registered: May 2017
Distribution: Lubuntu 16.04
Posts: 14

Rep: Reputation: Disabled
Configure DNS manually

Hi Guys,

How do we configure DNS manually on Ubuntu? I thought to edit /etc/resolv.conf but the file says not to configure/edit it (in old days we used to edit it but now this file is auto-generated).

I also came across some fake info like "Changes should be made in /etc/sysconfig/network"

link to fake info, which is in comments:

No such folder like sysconfig. So how do we configure DNS manually?

I already configured IP address by ip command, I added routing too. Now I need to configure DNS service.

Old 03-15-2019, 06:30 PM   #2
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS 6-7; SuSE 8-12
Posts: 599

Rep: Reputation: 174Reputation: 174
You should review this:

To configure your system to use static address assignment, create a netplan configuration in the file /etc/netplan/99_config.yaml.
There is also an example on the page...

Or, perhaps this page:
Old 03-16-2019, 01:16 AM   #3
Senior Member
Registered: Apr 2010
Posts: 1,642

Rep: Reputation: 277Reputation: 277Reputation: 277
Just my 2 cents, it would depend if your network config is DHCP or Static.

If it is DHCP then it will be Auto Generated.

Check out this link:

From above link to check for DHCP:
Other method is cat /var/log/syslog and check for some thing like below

DHCPDISCOVER on eth0 to port 67 interval 6
DHCPREQUEST on eth0 to port 67
or try this: journalctl | grep DHCP

Last edited by JJJCR; 03-16-2019 at 01:26 AM. Reason: edit
Old 03-16-2019, 01:41 AM   #4
Registered: Aug 2016
Distribution: Mint 19.1
Posts: 251

Rep: Reputation: Disabled
It is not difficult if you know what dns servers you want to use (up to three).
sudo cp /etc/resolv.conf /etc/resolv.conf.bak
sudo rm /etc/resolv.conf
With whatever text editor you like, create a new /etc/resolv.conf with up to three lines of
using the addresses of the nameservers you want to use, of course.
Then, and this is absolutely necessary,
sudo chattr -e /etc/resolv.conf
sudo chattr +i /etc/resolv.conf
This locks the file so it cannot be changed, even by the system. Now you should be using the dns servers you wish. If it doesn't seem to take, reboot and it should.
Note: to do ANYTHING with resolv.conf now you must first
sudo chattr -i /etc/resolv.conf
To return to the system resolv.conf simply change the attribute as above and move the backup file back.
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
help needed to setup a DNS server can anyone say how to configure a DNS server subha Linux - Networking 4 04-27-2012 11:50 PM
How to manually add SATA driver manually when kernel boot? aixilin Linux - Kernel 6 08-15-2008 10:36 AM
how to configure master dns in windows2003 server and its slave dns in rhel5 suneellinux Linux - Newbie 1 04-11-2008 05:13 PM
Win2k3 DNS + PFsense DNS Forwarder = No internal DNS resolution Panopticon Linux - Networking 1 11-19-2007 09:59 PM
How to configure DNS for a local LAN (at least I think I want DNS) FlyingPenguin128 Linux - Networking 8 12-11-2005 04:15 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:59 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration