0

Hi All,

Can anybody guide me for the little issue.
I need to add few nameservers in /etc/resolv.conf
and after every time reboot, that entry should be edited in /etc/resolv.conf

is there any way?

Thanks in advance.

2
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by Ashish Barot
0

I believe you can add your additional DNS servers into the /etc/conf.d/dhcpd.conf as an option line, like so

option domain-name-servers xx.xx.xx.xx

of course location of the dhcpd.conf will vary depending on the distro you use ;)

ooh, just noticed you said for normal users...you need to be root to make those changes, I don't think there is a way a non-admin can make those changes since it is a system setting and I've seen bad DNS entries really jack a system up

0

Dear icaruslnx,

if i have root a/c, then can you pl. tell me how can i set it automatically?

0

I don't have any DHCP client linux machines to try this on (mostly static servers) and it depends on what distro you're using. From the docs I find on this it looks like you can edit the dhcpd.conf to add in extra DNS servers when DHCP does it's thing.

In the file using whichever editor you choose (I'm a VI guy but gedit or some other graphical notepad type app might be easier to use). add a line at the end with the nameserver you want to add like this replacing the 127.0.0.1 with the name server of your choice, additional servers can be added seperated with a comma ","

prepend domain-name-servers 127.0.0.1;

If something is messed up and this causes DHCP to fail, remove the line and restart the network.

0

Dear icaruslnx,

I am user of my desktop, so i cant do any changes in dhcp server. DHCP server is mainted by Sys. Admin.
So i need to add extra name servers entry on my local system after every reboot.

I had also add /etc/profile file with few shell command,s and it is also working. But for that i need to login in root a/c after every reboot.

And one more thing, if i edit /etc/rc.local then it is not getting executing. due to limited access to user.

so now i think, i need to writer some different script and need to put it in /etc/init.d

Let see what happen ahead. If you find some script for it. then let me know i will try with that one.

Ok!

I don't have any DHCP client linux machines to try this on (mostly static servers) and it depends on what distro you're using. From the docs I find on this it looks like you can edit the dhcpd.conf to add in extra DNS servers when DHCP does it's thing.

In the file using whichever editor you choose (I'm a VI guy but gedit or some other graphical notepad type app might be easier to use). add a line at the end with the nameserver you want to add like this replacing the 127.0.0.1 with the name server of your choice, additional servers can be added seperated with a comma ","

prepend domain-name-servers 127.0.0.1;

If something is messed up and this causes DHCP to fail, remove the line and restart the network.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.