LinuxQuestions.org
Help answer threads with 0 replies.
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 04-06-2016, 07:46 AM   #1
mariose
Member
 
Registered: May 2013
Location: South Africa
Distribution: Debian
Posts: 177
Blog Entries: 1

Rep: Reputation: 7
Cool Permanently set DNS after reboot


Hi LQ

I am needing to set my DNS automatically between reboots and I assume I will need to use a Bash script? On occasions I would need to edit the resolv.conf file but when I reboot it reverts back to 127.0.0.1

I am using
Code:
Linux voip-pc 3.19.0-49-generic #55~14.04.1-Ubuntu SMP Fri Jan 22 11:24:31 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Could someone please guide me to where I can find the information as to how to accomplish this?

Thank you

Last edited by mariose; 04-06-2016 at 07:47 AM. Reason: Adding my distro to the fault
 
Old 04-06-2016, 08:50 AM   #2
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
What you mean by setting DNS automatically? resolv.conf is overwritten by DHCP client or some other network management application. You can edit it by hand, but then you have to make sure all network configuration helpers (DHCP client, etc) are either stopped or configured not to touch your resolv.conf.
 
Old 04-06-2016, 02:39 PM   #3
jmgibson1981
Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Ubuntu LTS
Posts: 122

Rep: Reputation: Disabled
Code:
auto br0
iface br0 inet static
        address 192.168.1.240
        netmask 255.255.255.0
        gateway 192.168.1.1
        dns-nameservers 192.168.1.1
        bridge_ports eth0
        bridge_stp on
        bridge_fd 0
add a dns nameservers line as above to your /etc/network/interfaces file.
 
Old 04-06-2016, 02:52 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,260

Rep: Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948
You need to set the DNS in whatever network configuration tool you use (NetworkManager, etc), because that tool will use the DNS information you tell it to overwrite /etc/resolv.conf every time you reboot. Creating a script to then overwrite /etc/resolv.conf again is an ugly hack and is best avoided.
 
Old 04-07-2016, 03:59 AM   #5
mariose
Member
 
Registered: May 2013
Location: South Africa
Distribution: Debian
Posts: 177
Blog Entries: 1

Original Poster
Rep: Reputation: 7
Thank you for the valuable info guys. Ill fiddle a bit when I get a gap. Cheers!
 
  


Reply


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
how to permanently change hostname even after reboot BW-userx Slackware 5 07-12-2015 10:43 AM
Set permissions permanently massy Linux - Security 2 03-09-2014 05:42 AM
How to permanently set shmmax tikit Linux - Server 3 06-11-2010 02:39 AM
Sceernlock switches off monitor permanently thereby forcing me to reboot the machine harry2006 Linux - Desktop 4 10-10-2008 04:49 AM
How to set PATH permanently chandhru Linux - Newbie 3 09-24-2002 01:43 AM


All times are GMT -5. The time now is 07:01 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration