LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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: https://www.cyberciti.biz/tips/linux...ns-client.html

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


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

thx
 
Old 03-15-2019, 06:30 PM   #2
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
You should review this: https://help.ubuntu.com/lts/servergu...ration.html.en

Quote:
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: https://help.ubuntu.com/16.04/ubuntu...net-wired.html
 
Old 03-16-2019, 01:16 AM   #3
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
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: https://unix.stackexchange.com/quest...-12-04-lts-gui

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

DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
DHCPOFFER from 10.100.1.254
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 10.100.1.254
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
agillator
Member
 
Registered: Aug 2016
Distribution: Mint 19.1
Posts: 419

Rep: Reputation: Disabled
It is not difficult if you know what dns servers you want to use (up to three).
Code:
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
Code:
nameserver xxx.xxx.xxx.xxx
using the addresses of the nameservers you want to use, of course.
Then, and this is absolutely necessary,
Code:
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
Code:
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.
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:18 PM.

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