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.

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

Dear icaruslnx,

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

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.