Friday, 23 August 2013

Changing/Setting DNS settings on boot

Changing/Setting DNS settings on boot

I have a situation where i do not give access to a machine, but there may
be circumstances where the IP settings need to be changed. I have overcome
this by providing a USB stick with a file with both static and DHCP info
(renamed as appropriate) and a script that on reboot, checks the USB stick
for a file and overwrites /etc/network/interfaces
To here, all good.
But, the file /etc/resolv.conf holds the DNS info (as far as I know) and
I'm not sure how this file is structured.
What would be the best way for me to structure a file /etc/resolv.conf
that could be overwritten with the above /etc/network/interfaces but with
the DNS settings?
As an example, I use static IP and my /etc/resolv.conf looks like this:
nameserver 192.168.1.254
I have seen a demo file where this seems to be included in the
/etc/network/interfaces file as follows (this is just from a search. not
my file):
iface eth0 inet static
address 192.168.3.3
netmask 255.255.255.0
gateway 192.168.3.1
dns-search example.com
dns-nameservers 192.168.3.45 192.168.8.10
Could I put all the info in one file? If so, what then goes in the
/etc/resolv.conf file?
To be honest, I'd rather have it all in the one file so it makes the end
users life easier to just modify one file.
If it can be done in one file, what would be an example for DHCP (with
regards to DHCP settings)
Thank you in advance for any help and suggestions!

No comments:

Post a Comment