need to stop /etc/resolv.conf from changing
I'm running Arch linux on a beaglebone black as an embedded iOT device. Spontaneously, a process changes /etc/resolv.conf to have nameserver point at 127.0.0.1. I do not want that to happen again under any circumstances.
I've tried to set up a cron job that will overwrite that file with a correct backup pointing at the valid nameserver, but arch linux cron isn't in the format I am familiar with and I can't get that to work. Code:
root@beaglebone:~# more /etc/crontab Any ideas on welding this file down so it can't be modified? Any ideas on getting cron to work? All creative solutions appreciated! --di11rod |
I think the first thing you should do is figure out what process is doing this and fix the process.
Crontab is just a band-aid. |
You can "weld it down" by setting the immutable flag, but this is dirty solution. Do what lazydog said.
|
Given that it is arch, the arch wiki is the place to start - maybe Resolv.conf might be the go.
|
Maybe a router is offering dhcp and dns?
But the wiki page offered above has it. |
Are you using dhcp to setup your IP address?
I've used arch in the past, but on a desktop. I setup my arch box to use a static IP address and I added my nameservers to /etc/resolv.conf. With the static IP method the /etc/resolv.conf file always is the same. In fact, in all my linux installations, I always use a static IP address and my nameservers in /etc/resolv.conf file doesn't change. If you try or had tried the static IP method and it still changes your /etc/resolv.conf file, then use the immutable flag as Emerson suggested chattr +i /etc/resolv.conf |
Come on, immutable flag is ugly. See man dhcpcd for instance, nohook option stops it touching resolv.conf.
|
Quote:
|
I'm not sure the nohook is the best option because you will want dhcpd updating resolv.conf on laptops and other devices.
OP: If you are using an ip address in your dhcp range then you need to exclude that ip address from the range and make it static on the server. Doing this will stop dhcp from overwriting your resolv.conf. |
You are confusing dhcpd with dhcpcd ?
|
All times are GMT -5. The time now is 08:38 PM. |