Preventing /etc/resolv.conf from bring overwitten
This is the way I believe it should be done:
change /etc/dhclient.conf by adding following: Code:
interface "eth0" { I then changed /etc/rc.d/rc.inet1.conf Code:
DHCP_KEEPRESOLV[0]="yes" I then improvised. I added the DNS servers to resolv.conf and made it READ-ONLY (0444). This now works. But surely this is NOT the correct way to do it? I did not reverse the above changes - but it seems to me that that instead of changing those configuration files, I could have just made resolv.conf read-only in the first place. What is the correct and orthodox way to add a DNS to the system? I have a conventional desktop system connected via dhcp and it seems that my IP address is fixed. |
When you specified DHCP_KEEP_RESOLVED="yes", did you try to add your DNS after the new resolv.conf file was created with only search in it?
If yes, one thing you could try is add the -R parameter to the dhcpcd call in rc.inet1 or wherever it is called. This parameter prevent this file to be overwritten. |
Not sure about slackware type systems, but on Fedora/Red Hat systems you can add an option to the ifcfg-ethx file:
PEERDNS=no This prevents /etc/resolv.conf being updated. |
Quote:
I've now just changed it back to r/w and rebooted - everything's fine. It wasn't over-written. So I should have done an extra re-boot, it seems. Quote:
Code:
# Get the configuration information from /etc/rc.d/rc.inet1.conf: Code:
[ "${DHCP_KEEPRESOLV[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -R" Code:
/sbin/dhcpcd -d -t ${DHCP_TIMEOUT[$i]:-30} ${DHCP_OPTIONS} ${1} Thanks houdelou, I have it now set up in an orthodox manner. I can't understand why it produced a rogue resolv.conf beforehand though. |
Which DNS is really being used?
Is there anyway to tell which DNS is being used?
/etc/dhcpc/dhcpcd-eth0.info does not show the new dns which I added, just the old ones (which are still in resolv.conf together with, but after, the new ones). Also: Do I still need the addition I made to /etc/dhclient.conf? This contains the "prepend domain-name-servers" value. This isn't about "what works" but what should work - i.e. what is the correct way of setting things up. |
I'm not an experienced net admin so I can't tell you the normal way to do this. But I will try to do my best to help you and from what I know, you are on the good track. But it is not a usual problem because when you use DHCP, normally, it does all the work and you don't touch it.
Maybe you could try supersede instead of prepend in your dhclient.conf. Look in man dhclient.conf to know what it does. If this works, maybe you won't need DHCP_KEEPRESOLV. What I would try first is to comment the DHCP_KEEPRESOLV line, add the supersede instead of prepend and restart network services. According to man resolv.conf the dns are tried in the order listed beginning with the first one. To know wich dns is being used, but that can vary with each query, you can use the dig command. Look at the adress after SERVER:. There should be an adress with #53 at the end. #53 means port 53 wich is dns service port. One trick I can give you is that instead of rebooting, try doing /etc/rc.d/inet1 restart. I think it restart all the network processes. |
All times are GMT -5. The time now is 10:53 PM. |