Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
07-01-2014, 09:18 PM
|
#1
|
Senior Member
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,338
Rep:
|
How do I stop stuff from overwriting /etc/resolv.conf?
It seems lot of distros are resorting to overcomplicating networking and changing everything and doing it differently each time, and also overwriting config files like /etc/resolv.conf, which is needed to set DNS.
Is there a way to stop this from happening? I want to be able to set network info by simply editing a file, as I usually don't install a GUI on servers.
|
|
|
07-01-2014, 09:41 PM
|
#2
|
LQ Guru
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,907
|
resolv.conf
Define "stuff" please.
Generally things that overwrite or replace the resolv.conf file are part of the networking. (Network Manager is famous for this.)
The answer is to configure the search domain and nameservers in the file that application uses to dynamicly create resolv.conf. Ok, that or simplify the networking and do away with those applications: but know what you are doing.
Something like network manager is very nice if you use WIFI on a laptop that travels a lot. It pulls down the right settings for the connection you are using NOW. IF you have something that does not travel, network manager can be a pain. There are ways to manage it that make things better, and I do recommend finding one before ripping out and replacing your networking software. (Google may help here.)
I am a Network/System Admin with 20+ years of experience and do things like this for fun, but not to my primary production machines. Look at your situation and the information available online that might help your problem, and think well before deciding on your approach. You have not provided enough information about your own knowledge, or system situation, to allow for better advice than that.
Good luck, and please return here to let us know what you decide and how it goes.
PS. One way to avoid this is to load your own system using something like Debian, or even Gentoo, to include ONLY the packages you want or need. No specific distribution can fit your use better than one you design yourself. Derivatives like Fedora and Ubuntu make a lot of assumptions about usage, and load a default setup that will fit "well enough" for most users. IF you are not "most users" then know that you are free to choose a different road.
Last edited by wpeckham; 07-01-2014 at 09:47 PM.
Reason: Incomplete answer.
|
|
|
07-01-2014, 09:51 PM
|
#3
|
Senior Member
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,338
Original Poster
Rep:
|
I don't know what "stuff" is as it seems to differ between distros. I know networkmanager is one bad one, I always uninstall that. Basically in the config files it will usually even say to not edit it directly because it will get overwritten. But then if I google "how to change nnn" it will tell me to edit that exact file.
Gateway is another oddball one that seems to differ a lot. Usually it's in /etc/sysconfig/network but in some distros (Debian based) that sysconfig folder does not actually exist.
Is there a way to configure this stuff using ifconfig? It would be nice if I could just stick all the commands in /etc/rc.local and that way it would be consistent across all machines no matter what the distro is.
Funny you mention making a custom distro as it's actually something I want to look into at some point. Been reading up Linux From Scratch and other stuff so I can get a better understanding of the back end of Linux. It seems lot of distros are obscuring a lot of that stuff.
Even editing ~/.bashrc has become crazy in some distros, they shove so much crap in there.
|
|
|
07-01-2014, 09:58 PM
|
#4
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
Hi,
the resolvconf package tries to address this. It tries to keep track of everything that wants to write to /etc/resolv.conf and then keep that file in the state the you have told it to. As discussed above this is a non-trivial problem so it may take a little reading to understand what it is doing and how to configure it to your liking. See the README for details (/usr/share/doc/resolvconf/README.gz on Debian based systems).
Evo2.
|
|
|
07-01-2014, 10:26 PM
|
#5
|
Member
Registered: May 2009
Location: Fort Langley BC
Distribution: Kubuntu,Free BSD,OSX,Windows
Posts: 342
Rep:
|
|
|
|
07-01-2014, 10:29 PM
|
#6
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
Hi,
Quote:
Originally Posted by ceyx
|
Can you elaborate?
Evo2.
|
|
|
07-01-2014, 10:32 PM
|
#7
|
Member
Registered: May 2009
Location: Fort Langley BC
Distribution: Kubuntu,Free BSD,OSX,Windows
Posts: 342
Rep:
|
The relevant part of the link you want is something like this :
Quote:
NetworkManager will attempt to write DNS information from DHCP into /etc/resolv.conf, overwriting the existing contents. To prevent this, you can set the immutable bit on the file (as root):
# chattr +i /etc/resolv.conf
To modify the file in the future, first remove the immutable bit:
# chattr -i /etc/resolv.conf
|
|
|
|
07-01-2014, 10:40 PM
|
#8
|
Member
Registered: May 2009
Location: Fort Langley BC
Distribution: Kubuntu,Free BSD,OSX,Windows
Posts: 342
Rep:
|
Also
One could add the line below to the 'interfaces' file
Quote:
sudo nano /etc/network/interfaces
dns-nameservers 192.168.0.XXX
|
or add this to resolv.conf:
Quote:
sudo nano /etc/resolv.conf ( on ubu 12 had to put it into "base" in /etc/resolvconf/resolv.conf.d/ )
nameserver 192.168.0.xxx
domain whatever.com
search whatever.com
|
One of the above 3 should work for you...
|
|
|
07-01-2014, 10:57 PM
|
#9
|
Member
Registered: May 2009
Location: Fort Langley BC
Distribution: Kubuntu,Free BSD,OSX,Windows
Posts: 342
Rep:
|
evo2 :
I just checked the link above - I suppose the Arch folks have been busy updating their pages; the info posted above has moved to :
https://wiki.archlinux.org/index.php...e_DNS_settings
Good luck !
|
|
|
All times are GMT -5. The time now is 08:38 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|