Jump to content

DNS problems with my router under Mandrake 10.1


m0tion
 Share

Recommended Posts

This is actually Mandrake 10.1-RC1 X86-64. I have a simple wired router connected to my cable modem which acts as a DHCP server for my two PCs (the one in question and a windows box). This router does not have DNS server or caching functionality. I am able to correctly lease an IP address from the router using DHCP, I configured eth0 using the mandrake wizard at installation. I was unable to resolve DNS names so I took a look in /etc/resolv.conf:

search company.com

nameserver 192.168.1.1

192.168.1.1 is the ip address of my router and as I stated earilier it is not a DNS server. When I run "ipconfig /all" on the windows box connected to the same router I get:

Ethernet adapter Local Area Connection:

    Connection-specific DNS suffix   : company.com

     DHCP Enabled                              : Yes

     Autoconfiguration Enabled          :  Yes

     IP Address                                       : 192.168.1.4

     Subnet Mask                                   : 255.255.255.0

    Default Gateway                              : 192.168.1.1

     DHCP Server                                  : 192.168.1.1

    DNS Servers                                    : 207.69.188.185

                                                                  207.69.188.186

I then changed the nameserver lines in /etc/resolv.conf to use the correct DNS servers (the ones shown in the windows configuration) and that worked fine. Approximately 15 minutes later I started having the same DNS resolution problems again and noticed my /etc/resolv.conf had been over-written and now contained the same information as shown earlier. I did some searches on google and found a few potential fixes that I have tried.

 

I tried adding the line:

net.ipv4.tcp_window_scaling = 0

to /etc/sysctl.conf

and also adding the lines:

alias net-pf-10 off

alias ipv6 off

to /etc/modprobe.conf, then restarted. This did not seem to have any effect.

 

From what I've read other people have had this problem and it seems that most people think it has something to do with IPV6 support (?). I don't know about that, but I'd really like to find a solution because it is EXTREMELY annoying. Any ideas would be appreciated.

Link to comment
Share on other sites

There are two solutions: the correct one and the easy one :)

 

First the easy: change the permissions on the /etc/resolv.conf file so it becomes not writable.

 

The correct one: it's the dhcp client that is overwriting the resolv.conf file. Adjust the settings. Look in man dhcpd.

Link to comment
Share on other sites

I'll take a look at the settings for the dhcp client (I believe it's dhclient), but I've tried taking away the write permission, it doesn't work. When I check back to find that the file has been overwritten I also find that the permissions have been changed, go figure... I'd be very open to hear some more ideas on this problem.

Link to comment
Share on other sites

Whilst the use of the chattr command is probably the required (and perhaps best) course of action here, just be careful using it! chattr +i filename will mean a file becomes unchangeable even by root. If you've made a mistake in /etc/resolv.conf (or wish to change it at a later date), you'll first need to run chattr -i filename.

 

Hope this works for you!!

Link to comment
Share on other sites

Well, I gave the 'chattr +i' a shot. Afterward I did a 'lsattr' just to make sure the attributes had really changed, they had. About 15-20 minutes later I noticed my DNS requests were timing out again so I checked the file and it had been CHANGED! I then checked the attributes and the file was no longer +i. I'm not sure if this has anything to do with it but I'm using reiserfs and I think the chattr command may only work with EXT2/3. Anyway, still broken, thanks for the help though. Any other ideas?

Edited by m0tion
Link to comment
Share on other sites

Seems my knowledge is a bit out of date (mandrake spoiled me :D).

 

How do I keep /etc/resolve.conf from being overwritten by DHCP? 


Make a file named /etc/dhclient-enter-hooks
It should be executable, and contain:
                                                                               
# tell function that re-writes resolv.conf to do nothing
make_resolv_conf() {}

#[Zachariah Johnson]

 

man dhclient-script.

 

This should work. Good luck.

Link to comment
Share on other sites

I implemented this and it doesn't seem to work (ie. /etc/resolv.conf still gets overwritten about every 15-20mins). I shouldn't need to restart or anything after implementing this correct?

 

[root@tehabsolutrazar wigginjs]# ls -al /etc/dh*
-rwxr-xr-x  1 root root 80 Jan 12 11:28 /etc/dhclient-enter-hooks*
[root@tehabsolutrazar wigginjs]# cat /etc/dhclient-enter-hooks
# tell function that re-writes resolv.conf to do nothing
make_resolv_conf() {}

[root@tehabsolutrazar wigginjs]#

Edited by m0tion
Link to comment
Share on other sites

I implemented this and it doesn't seem to work (ie. /etc/resolv.conf still gets overwritten about every 15-20mins).  I shouldn't need to restart or anything after implementing this correct?

yes. i did this once in debian and it worked only after a reboot.

Link to comment
Share on other sites

uh... just a silly question... are you using firefox or mozilla? if yes, you need to block ipv6 there, too. can be done by typing about:config in the adressbar, then in the appearing searchbar, type ipv and set the first entry (ipv6 disable) from false to true by double clicking it.

Edited by arctic
Link to comment
Share on other sites

Fixed problem, the code in /etc/dhclient-enter-hooks should look like this:

[root@tehabsolutrazar wigginjs]# cat /etc/dhclient-enter-hooks
# tell function that re-writes resolv.conf to do nothing
function make_resolv_conf() {
   :
}

 

This works, you can test it by running dhclient as root. If the file /etc/resolv.conf doesn't get over-written you know you've implemented it correctly.

Edited by m0tion
Link to comment
Share on other sites

arctic:

On a side not I'd like to ask that you stop answering questions on this forum.  You made several replies, none of which were remotely relevent to my problem.  You actually caused me to waste time on my way to a solution.

 

M0tion

Thats uncalled for (and i suggest a little rude) You asked for ideas and arctic gave you some.

arctic has helped many members here on networking and we would like him to continue doing so.

There are a number of posible reasons why the /etc/resolv.conf file gets over written.

IMO you solved the problem (congrats)...............but not the root cause .

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...