# DNS issue [UPDATE]

## Animatus

OK,

My problem is I will try to go to www.google.com (or any site) and it will work one time, but not the next. I can connect to MSN, but I couldnt connect to IRC.

My dnsdomainname file contains 

 *Quote:*   

> homenetwork

 

My hostname file contains

 *Quote:*   

> tux

 

My conf.d/net file contains

 *Quote:*   

> # /etc/conf.d/net:
> 
> # $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18 19:39:22 azarah Exp $
> 
> # Global config file for net.* rc-scripts
> ...

 

and finaly my hosts file contains

 *Quote:*   

> 127.0.0.1     tux.homenetwork tux localhost
> 
> # IPV6 versions of localhost and co
> 
> ::1 ip6-localhost ip6-loopback
> ...

 

It should be noted that when I enabled the line  *Quote:*   

> #dhcpcd_eth0="-HD"

  everything seemed to work, but my name (in bash) was a wierd 10-23-43-28... 

What should I do next??  :Smile: 

Oh and here is my resolv.conf file, though Im not sure what this file is for:

 *Quote:*   

> nameserver 24.226.10.193
> 
> nameserver 24.226.1.94
> 
> nameserver 24.226.10.194
> ...

 

My current IP is 24.36.145.67Last edited by Animatus on Sun Dec 19, 2004 12:21 am; edited 1 time in total

----------

## westboy21

First of all, your /etc/resolv.conf file is where the server goes to figure out how to resolve DNS queries.  Whatever servers are listed in there will be used to contact about DNS questions.

I would try commenting out the last 3 lines of your resolv.conf file.  See what that gives you.  Usually only a primary and secondary DNS server are necessary.

This is what I would try first.

----------

## gnuageux

Hrmmm shouldnt really matter that youve got more than two nameservers listed though. Although generally two is ample. Wondering if your dns servers are having intermittent issues? When you cant get to google or whereever try: dig any problemdomain.com @ the nameserver addresses listed in /etc/resolv.conf and see if anything is returned. If not the name servers are to blame.

----------

## toralf

This works for me:

```

dhcpcd_eth0="-D -Y -N -d -t 7 -h ${HOSTNAME}"

```

----------

## Animatus

Thanks everyone, I will try again when I get home tomorow  :Smile: 

----------

## Animatus

UPDATE:

OK, I tried adding "dhcpcd_eth0="-D -Y -N -d -t 7 -h ${HOSTNAME}""  with no luck.

I tried commenting out specific items in my resolv.conf file and it worked! The problem is the file is re-created everytime I boot so I would have to comment it everytime. How would I get around this?

----------

## curtis119

 *Animatus wrote:*   

> UPDATE:
> 
> OK, I tried adding "dhcpcd_eth0="-D -Y -N -d -t 7 -h ${HOSTNAME}""  with no luck.
> 
> I tried commenting out specific items in my resolv.conf file and it worked! The problem is the file is re-created everytime I boot so I would have to comment it everytime. How would I get around this?

 

Just use 

```
dhcpcd_eth0="-R"
```

the -R will stop the dhcp client from replacing the resolv.conf. All the other options from the above example (-D -Y -N -d -t etc) are probably not necessary. If my example doesn't work for you then just add the -R to the other example.

----------

## Animatus

When I do that my resolv.conf file contents were replaced with "domain homenetwork"

----------

## curtis119

 *Animatus wrote:*   

> When I do that my resolv.conf file contents were replaced with "domain homenetwork"

 

The -R option is supposed to keep this file from being overwritten. The -d option tells dhcpcd to log it's actions. Look in /var/log for this log. It may be in in /var/log/everything/current if there is no specific log for dhcpcd itself. 

so try this config in /etc/net and then stop and start eth0. If the resolv.conf still gets overwritten then post that log file here.

```
 "dhcpcd_eth0="-R -Y -N -d"
```

----------

## Pajarico

Then how is that even when i use the -R option it still uses a different DNS server than the one from /etc/resolv.conf?

```
lxuser@hal2000 ~ $ cat /var/lib/dhcpc/dhcpcd-eth0.info

IPADDR=192.168.1.34

NETMASK=255.255.255.0

NETWORK=192.168.1.0

BROADCAST=192.168.1.255

GATEWAY=192.168.1.1

DNS=80.58.0.33

DHCPSID=192.168.1.1

DHCPGIADDR=0.0.0.0

DHCPSIADDR=192.168.1.1

DHCPCHADDR=00:0C:76:E6:2E:FB

DHCPSHADDR=00:30:DA:38:6E:11

DHCPSNAME=''

LEASETIME=604800

RENEWALTIME=302400

REBINDTIME=529200

INTERFACE='eth0'

CLASSID='Linux 2.6.12-gentoo-r10 x86_64'

CLIENTID=00:0C:76:E6:2E:FB

lxuser@hal2000 ~ $ 
```

DNS=80.58.0.33 is brought by dhcpcd. I'm not sure from where does that DNS come. The DNS of my ISP are 80.58.61.250.

Ok, so i have a /etc/resolv.conf like this:

```
nameserver 80.58.61.250
```

And OVERRIDE=1 in /etc/conf.d/domainname . I start dhcpcd with -R and still have wrong the DNS' (80.58.0.33) in /var/lib/dhcpc/dhcpcd-eth0.info.

-Why?

-Where does the "wrong" DNS come from?

-How can I make sure that i'm using the DNS given by my ISP and not any other?

PS: Everything works fine here. The only thing that doesn't work is IRC, and I don't understand why since the ports are redirected on the router (NAT) and i get a "time out".

----------

