Author Topic: resolv.conf not being written correctly  (Read 2781 times)

octowaters

  • Guest
resolv.conf not being written correctly
« on: August 12, 2009, 07:51:29 AM »
There are several posts in different topics related to wifi and eth0 in relation to resolv.conf file not being written correctly or not at all.

There have been a couple where forum members have kindly offered suggestions to use *nano* in konsole super-user mode to write the correct information to the file. The problem, as seen on my machine is that it DOES NOT STICK.

I don't know the mechanics of glibc in generating the updated information, but whether one uses PCC to set up a connection or wishes to delete an existing connection in order to endeavour to get the information to be written correctly of DNS server IP's (for that is what is being talked about here) fails to register correctly.

For example, my first nameserver is 127.0.0.1 and the second xxx.xx.xxx.xx but only the first gets written.

Any ideas as to why?

Thanks in advance.
« Last Edit: August 20, 2009, 10:37:17 AM by octowaters »

Online Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: resolv.cong not being written correctly
« Reply #1 on: August 12, 2009, 10:09:26 AM »
There are several posts in different topics related to wifi and eth0 in relation to resolv.conf file not being written correctly or not at all.

There have been a couple where forum members have kindly offered suggestions to use *nano* in konsole super-user mode to write the correct information to the file. The problem, as seen on my machine is that it DOES NOT STICK.

I don't know the mechanics of glibc in generating the updated information, but whether one uses PCC to set up a connection or wishes to delete an existing connection in order to endeavour to get the information to be written correctly of DNS server IP's (for that is what is being talked about here) fails to register correctly.

For example, my first nameserver is 127.0.0.1 and the second xxx.xx.xxx.xx but only the first gets written.

Any ideas as to why?

Thanks in advance.


[polack@fatman ~]$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8 )
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 208.67.222.222
nameserver 4.2.2.1

Mine is correct, and it tells you, in no uncertain terms, it will be overwritten if edited by hand. I'd guess something in your configuration is not correct. No Idea what that might be, as you didn't provide any more information than "it's broke".
« Last Edit: August 12, 2009, 03:21:46 PM by old-polack »
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

altair4

  • Guest
Re: resolv.cong not being written correctly
« Reply #2 on: August 12, 2009, 10:36:55 AM »
If you right click the Network Icon on the taskbar , do you have "Get DNS servers from DHCP" enabled?

Or if you want to go all config file,  look at /etc/sysconfig/network-scripts/ifcfg-eth0
and look for a line: BOOTPROTO=dhcp
Change it to BOOTPROTO=static

Anyway, that's the first thing I would check.

octowaters

  • Guest
Re: resolv.cong not being written correctly
« Reply #3 on: August 12, 2009, 01:33:40 PM »
Answering:
               old-polack
               altair4

#1. I can precise what exactly "is broke"  I'm afraid.

However, the Internet connectivity test failed. You should test your connection manually, and verify your Internet modem or router.

Settings are manually set not BOOTDHCP.

#2. The *ifcfg-eth0* file reads as follows:

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.3
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT=yes
METRIC=10
MII_NOT_SUPPORTED=no
USERCTL=no
MTU=1500
DNS1=127.0.0.1
DNS2=200.45.191.35
RESOLV_MODS=no
IPV6INIT=yes
IPV6TO4INIT=yes

BUT, *resolv.conf* merely shows the first nameserver.




altair4

  • Guest
Re: resolv.cong not being written correctly
« Reply #4 on: August 12, 2009, 03:03:58 PM »
I'll be honest with you I don't know. But I did find this: http://forum.mandriva.com/viewtopic.php?t=79053

The Problem:
Quote
I looked at resolv.conf, and found that only only one name server was present: the local cache (127.0.0.1).

So I went into MCC, to respecify OpenDNS as the secondary server, only to find that MCC still showed OpenDNS' server as the secondary. I went ahead and resaved the config, but when I went back to look at resolv.conf, only 127.0.0.1 was present.


The Solution:
Quote
My solution is twofold:

1. In mcc > Sytem > Manage system services... un-tick resolvconf.

2. As root, open the file /etc/sysconfig/network-scripts/ifcfg-eth0 and delete the following lines:

RESOLV_MODS=yes
DNS1=xxx.xxx.xxx.xxx
DNS2=xxx.xxx.xxx.xxx

Even after that, make yourself a copy of resolv.conf:
Code:
su
cp -p /etc/resolv.conf /etc/resolv.conf.bak

Reboot your system. Don't be surprised if /etc/resolv.conf gets clobbered one last time. Restore from the .bak version and it should stay put from now on.


This was for mandriva so the path to "system services" is different and it's not an elegant solution but sometimes brute force is necessary. Easy enough to undo if it doesn't work.

Online Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: resolv.cong not being written correctly
« Reply #5 on: August 12, 2009, 03:08:32 PM »
octowaters:

I just changed mine from this;

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.99
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT=yes
METRIC=5
MII_NOT_SUPPORTED=no
USERCTL=no
MTU=1492
DNS1=208.67.222.222
DNS2=4.2.2.1
RESOLV_MODS=no
LINK_DETECTION_DELAY=6
IPV6INIT=no
IPV6TO4INIT=no


To this:

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.99
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT=yes
METRIC=5
MII_NOT_SUPPORTED=no
USERCTL=no
MTU=1492
DNS1=4.2.2.2
DNS2=4.2.2.1
RESOLV_MODS=no
LINK_DETECTION_DELAY=6
IPV6INIT=no
IPV6TO4INIT=no


Then as root

[root@fatman ~]# service network restart

After the restart;

[polack@fatman ~]$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8 )
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 4.2.2.2
nameserver 4.2.2.1
« Last Edit: August 12, 2009, 03:22:07 PM by old-polack »
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

octowaters

  • Guest
Re: resolv.cong not being written correctly
« Reply #6 on: August 12, 2009, 04:52:41 PM »
old-polack
Altair4

I tried both suggestions, one after the other as the first failed, and so I tried the second with the same result.

It just registers nameserver 127.0.0.1 and not the second. :(

Syslog reports that /etc/sysconfig/network-scripts/ifup updates etc/resolv.conf for localhost and later the same thing for my machine name, that is Merlin. When checked, we are back to just 127.0.0.1 so I am completely baffled, to say the least.

Online Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: resolv.cong not being written correctly
« Reply #7 on: August 12, 2009, 05:19:25 PM »
old-polack
Altair4

I tried both suggestions, one after the other as the first failed, and so I tried the second with the same result.

It just registers nameserver 127.0.0.1 and not the second. :(

Syslog reports that /etc/sysconfig/network-scripts/ifup updates etc/resolv.conf for localhost and later the same thing for my machine name, that is Merlin. When checked, we are back to just 127.0.0.1 so I am completely baffled, to say the least.

Try changing the 127.0.0.1 as the first DNS server to DNS1=208.67.222.222

Then do the service network restart.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

octowaters

  • Guest
Re: resolv.cong not being written correctly
« Reply #8 on: August 12, 2009, 05:34:22 PM »
old-polack, Hi there.

I just changed as you commanded.  :)

I'm connected using the changed DNS Ip's.

What next do you have in mind?

Online Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: resolv.cong not being written correctly
« Reply #9 on: August 12, 2009, 05:45:03 PM »
old-polack, Hi there.

I just changed as you commanded.  :)

I'm connected using the changed DNS Ip's.

What next do you have in mind?


Did you recheck resolv.conf?
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

octowaters

  • Guest
Re: resolv.cong not being written correctly
« Reply #10 on: August 12, 2009, 05:47:50 PM »
old-polack:

Yes, sir.

It records the two DNS servers, yours first and mine as the second.


Online Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: resolv.cong not being written correctly
« Reply #11 on: August 12, 2009, 05:49:25 PM »
old-polack:

Yes, sir.

It records the two DNS servers, yours first and mine as the second.


Seems you have your solution. ;D
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

octowaters

  • Guest
Re: resolv.cong not being written correctly
« Reply #12 on: August 12, 2009, 05:53:33 PM »
old-polack:

Yes, sir.

It records the two DNS servers, yours first and mine as the second.


Seems you have your solution. ;D

Hmmmmm... I'm not so sure. You see, I need 127.0.0.1 for my BIND workstation DNS server and my IP's first server, in that order.

I'll try changing the DNS servers in PCC setup. Cross my fingers and light 150 candles.  :)

octowaters

  • Guest
Re: resolv.cong not being written correctly
« Reply #13 on: August 12, 2009, 06:31:51 PM »
As I thought it would, resolv.conf it did not take the second nameserver.

There is something basically wrong in the setup for manual (read this to be static) addresses in the PCC script that ends up writing to the *resaolv.conf* file. It just likes to write exclusively 127.0.0.1 and disregards all else after it.

Should one write a normal IP address, no problem.

So the question is, how do we setup BIND on PCLinuxOS for a simple workstation, because BIND requires 127.0.0.1 as its first DNS server address?

Online Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: resolv.cong not being written correctly
« Reply #14 on: August 12, 2009, 07:48:32 PM »
As I thought it would, resolv.conf it did not take the second nameserver.

There is something basically wrong in the setup for manual (read this to be static) addresses in the PCC script that ends up writing to the *resaolv.conf* file. It just likes to write exclusively 127.0.0.1 and disregards all else after it.

Should one write a normal IP address, no problem.

So the question is, how do we setup BIND on PCLinuxOS for a simple workstation, because BIND requires 127.0.0.1 as its first DNS server address?

More likely something wrong with your bind set up, then the resolv.conf setup.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...