# [Solved] Network card drivers overwriting my dns domain name

## BlindSpy

I've got a Blitzz network card that works with the adm8211 pci wireless card drivers. I've also followed the Gentoo Wiki TIP for Setting Your FQDN. The FQDN (fully qualified domain name) works fine when my /etc/resolve.conf is clear but as soon as my wireless card gets an IP address from the DHCP, my /etc/resolve.conf gets set to:

```
nameserver 192.168.0.1

search clvdoh.adelphia.net
```

where 192.168.0.1 is my D-Link router and clvdoh.adelphia.net is my ISP. I'm hoping that this is just some kind of configuration problem that enables the wireless driver to overwrite my /etc/resolve.conf when it gets an IP address from the DHCP.

/etc/conf.d/net:

comments removed for readability

```

iface_eth1="dhcp"

gateway="/"
```

/etc/conf.d/wireless:

```
essid_eth1="my_essid"

key_my_essid="my_wep"
```

If anyone has any ideas about how to keep my wireless drivers from overwriting my dnsdomainname, please help.[/b]

----------

## overkll

Add " -R " to the dhcpcd statement in /etc/conf.d/net

```
dhcpcd_eth1="-R"
```

"-R" will prevent your dchpd server from overwriting you resolv.conf file.

FYI, if you use ntp, add " -N " as well.  " -N " will prevent the dhcpd server from overwriting the ntp.conf file.

----------

## BlindSpy

AAH thank you! I had -N and I thought that may have been causing the problem. Hopefully this will fix it. Thank you for your quick and clear responds.

----------

## overkll

You're Welcome!  Make sure to add [solved] to the subject line of this thread.

----------

## BlindSpy

Something I'm affraid of though is that I may not get an IP address from my router unless it's put its own crap in the /etc/resolv.conf. The way I tested this was, with my /etc/resolv.conf first cleared, running dhcpcd and just kept reprinting /etc/resolv.conf until I got an IP address from my router (since it usually takes a while). I found that it didn't get an IP address until the stuff in /etc/resolv.conf was filled in.

----------

## overkll

What version of baselayout are you using?  (emerge -s baselayout)

----------

## BlindSpy

baselayout-1.11.12-r4

even with those flags I've added, It just adds old wireless info to the /etc/resolv.conf instead of the latest stuff. And I cant connect to the internet unless I have nameserver 192.168.0.1 in there. This is the line that causes my FQDN to screw up though. Instead of using radix.mine.nu it just uses mine.nu which is incorrect.

----------

## overkll

Doesn't that version of baselayout use /etc/conf.d/domainname and /etc/conf.d/hostname to set the FQDN as opposed to /etc/hostname and /etc/dnsdomainname?  I can't check that on my own system since it's using the older, unmasked baselayout.

Also check to see if you have "hostname" and "domainname" enabled in rc-update.

```
rc-update show

domainname |      default

hostname | boot
```

----------

## BlindSpy

domainname and hostname are both in the rc startup and yes the new baselayout uses /etc/conf.d/* instead of the /etc/* ones.

----------

## overkll

What do /etc/conf.d/domainname and hostname contain?

----------

## BlindSpy

```
# /etc/conf.d/domainname

# $Header: /var/cvsroot/gentoo-src/rc-scripts/etc/conf.d/domainname,v 1.1.4.1 2005/02/19 02:13:53 vapier Exp $

# When setting up resolv.conf, what should take precedence?

# If you wish to always override DHCP/whatever, set this to 1.

OVERRIDE=1

# To have a proper FQDN, you need to setup /etc/hosts and /etc/resolv.conf

# properly (domain entry in /etc/resolv.conf, and FQDN in /etc/hosts).

#

DNSDOMAIN="radix.mine.nu"

# This only set what /bin/hostname returns.  If you need to setup NIS, meaning

# what /bin/domainname returns, please see:

#

#   http://www.linux-nis.org/nis-howto/HOWTO/

#

NISDOMAIN="radix.mine.nu"
```

----------

## overkll

Are you using dhcp to push an ip address and nameserver to your wireless linux box?  IMHO, it would be easier to configure this if you have a static ip address for your linux box.  Reading the following comment in /etc/conf.d/domainname, I gather you need to setup your domainname in resolv.conf and in /etc/hosts.  

```
# To have a proper FQDN, you need to setup /etc/hosts and /etc/resolv.conf

# properly (domain entry in /etc/resolv.conf, and FQDN in /etc/hosts).

#

DNSDOMAIN="radix.mine.nu"
```

If you are using dhcp and the address your dlink is assigning to the wireless device on your linux box will always be the same, then it's easy to add it to your /etc/hosts file.  If it keeps changing from dhcp, you'll have to keep changing the /etc/hosts file to the current ip address.

Do you have:

```
domain radix.mine.nu
```

in /etc/resolv.conf and

```
<wireless-device-ipaddress>   radix.mine.nu
```

in /etc/hosts ?

Are you using NIS?

```
# This only set what /bin/hostname returns.  If you need to setup NIS, meaning

# what /bin/domainname returns, please see:

#

#   http://www.linux-nis.org/nis-howto/HOWTO/

#

NISDOMAIN="radix.mine.nu"
```

If not, comment out the NISDOMAIN line.

----------

## BlindSpy

This is where I become unclear. First of all, my dlink router give me the same IP though DHCP every time (with some static DHCP IP address feature or something). So I have the domain name radix.mine.nu that I got form http://www.dyndns.org and I want to use that as my domain name. I guess I'm not sure how to set this up - It used to work the way I have it now but it doesnt any more.

My /etc/resolv.conf now looks like this:

```
nameserver 192.168.0.1

search clvdoh.adelphia.net

domain radix.mine.nu
```

and my /etc/hosts looks like this (as specified by the wiki docs):

```
127.0.0.1       OptimusPrime.radix.mine.nu OptimusPrime localhost.localdomain localhost
```

----------

## BlindSpy

This is something I dont understand:

 */etc/init.d/hostname restart wrote:*   

> * Setting DNS domainname to radix.mine.nu ...                                                                                                                               [ ok ]
> 
> OptimusPrime ~ # dnsdomainname
> 
> mine.nu

 

why is the dnsdomainname still set to mine.nu even after it was explicitly set to radix.mine.nu?

----------

## overkll

Do you have dns running locally i.e. named/bind?  Or do you rely on your provider's dns?

----------

## BlindSpy

i'm not running named or bind.

----------

## overkll

So, you rely on your provider for domain name resolution.  Right?

I'm not familar with the dlink capabilities.  Does it have dns capabilities? resolv.conf is the file that tells your linux box which dns servers to check

 *Quote:*   

> My /etc/resolv.conf now looks like this:
> 
> ```
> nameserver 192.168.0.1
> 
> ...

 

```
nameserver 192.168.0.1
```

is telling your linux box to check 192.168.0.1 for dns.  I'm assuming this is you r dlink router.  Correct?  Try changing you resolv.conf to this:

```
domain radix.mine.nu

search radix.mine.nu

nameserver 24.50.78.2

nameserver 68.168.224.177

nameserver 68.168.192.17
```

Those are adelphia's name servers.

 *Quote:*   

> and my /etc/hosts looks like this (as specified by the wiki docs):
> 
> ```
> 127.0.0.1       OptimusPrime.radix.mine.nu OptimusPrime localhost.localdomain localhost
> ```
> ...

 

Try changing /etc/hosts to:

```
127.0.0.1        localhost.localdomain localhost

<eth1 ipaddress>     OptimusPrime.radix.mine.nu OptimusPrime radix.mine.nu
```

What do you get?

----------

## darkphader

 *BlindSpy wrote:*   

> baselayout-1.11.12-r4

 

It does seem like something has changed as the "hostname" command now works differently for me. I don't know if it happened right at this release or earlier as it's not something i usually check (but I saw this thread and...).

Previously "hostname -f" would give my the FQDN of my system, "hostname -d" the domain name, and "hostname" just the name of the host.

Now "hostname -d" returns nothing, and "hostname -f" returns "localhost". If I reorder the 127.0.0.1 entry in /etc/hosts so that the FQDN is first:

```
127.0.0.1 f.q.d.n hostname localhost
```

 the hostname commands return the proper info as previously (but I didn't need that explicit order before).

And yes, /etc/conf.d/domainname has the proper information.

Don't know why the change in behavior.

Also check to make sure the previous hostname and dnsdomainname files in /etc have been deleted (these were used by some earlier baselayout versions).

Chris

----------

## overkll

Thanks for chime'n in, darkphader.

I believe the change in behavior is with the new baselayout, which is still masked.  And since I don't have it, I can't test it on my my rig.

----------

## BlindSpy

Thank you both for your help but I feel that this assistance has gone beyond the scope of my initial question and has been narrowed down enough that it is just a matter of me researching the topic. Thanks again for all your help guys and expecially overkll  :Very Happy: 

----------

## overkll

You're welcome, BlindSpy.  I was beginning to wonder if you got it all sorted out or not.  Good Luck!

----------

## BlindSpy

nope not sorted out  yet =(. I tried using the adelphia dns servers directly but that doesnt work. The only time I can get any dns lookup is if I have my router as the nameserver which is strange. Since you mentioned it, it doesnt seem logical that a little 4 port wireless dlink router has a dns server. My guess is that my computer queries my router which queries adelphias dns. If that was the case, my setup should work though.

... There's just something I'm not seeing here.

----------

## BlindSpy

in my issue file I changed a \O to a \o and it seems to display the domainname now instead of the dnsdomainname (which was shorter than what it should have been) I guess its working now. Anyone know what the dif between \O and \o is?

----------

## overkll

Now that you mention \O \o, I don't think I've every seen a FQDN that uses uppercase.  That might not be allowed, just as the character " _ " is not allowed in a domain name. 

Yeah, you are probably right about the dns, however, you got me thinking about a related issue.  Your domain name, radix.mine.nu is from dyndns.org.  So dyndns.org is the authority of your domain.  It would seem to me that if you have your hostname(s) (like optimusprime.radix.mine.nu) in your /etc/hosts file, any program that is able to use the hosts file for name resolution will be able to find the host(s).  But, if for some reason the program can't/doesn't use the host file and uses dns instead, the host(s) would be not found - unless you've added the host to your domain at dyndns.org.  I'm curious if this is the case or not.

----------

## BlindSpy

well it used to work with uppercase and I tried it with lowercase like yesterday just to eliminate that as a problem. The main places i've been noticing the problem are with programs that claim to use /etc/hosts or (in the case of GNOME) print an error when I boot saying "Cant find your hostname. try fixing /etc/hosts" or something along those lines.

----------

## UberLord

 *BlindSpy wrote:*   

> The FQDN (fully qualified domain name) works fine when my /etc/resolve.conf is clear but as soon as my wireless card gets an IP address from the DHCP, my /etc/resolve.conf gets set to:
> 
> ```
> nameserver 192.168.0.1
> 
> ...

 

dhcpcd is killing that file for you - dhcpcd-1.3.22_p4-r10 and baselayout-1.12.0-alpha3 (not yet in portage) will solve this.

In the meantime, you can use baselayout-1.11.12-r4 and the below config with either udhcpc or dhclient instead of dhcpcd

/etc/conf.d/net

```
modules=( "udhcpc" ) # Change to dhclient if you chose dhclient

config_eth1=( "dhcp" )
```

Then if you wish to change the resolv.conf file - which you may not need, so please review it before using this bit.

```
dns_domain_my_essid="put.your.domain.here"

dns_servers="192.168.0.1"

```

----------

## overkll

Blindspy,  Are your hostname, domain name, and localhost.localdomain all defined as 127.0.0.1 on one line in your /etc/hosts file like you originally posted here?

 *BlindSpy wrote:*   

> 
> 
> ```
> 127.0.0.1       OptimusPrime.radix.mine.nu OptimusPrime localhost.localdomain localhost
> ```
> ...

 

or did you modify it like I suggested

 *overkll wrote:*   

> Try changing /etc/hosts to:
> 
> ```
> 127.0.0.1     localhost.localdomain localhost
> 
> ...

  changing optimusprime to the address of eth1?

----------

## BlindSpy

The latter of the 2 didn't work but I did try it. Anyway with UberLord's post it looks like this is a bug and something I just have to wait for to be fixed. Thanks for all your help guys.

----------

