# domainname resolving

## flazz

my system was working perfectly but like a jackass i did a "-5" after "emerge -uDav system"

/etc/hostname was reset to a new file, which i fixed, but /etc/domainname was still good

```
# rc-update add domainname default

 * rc-update: '/etc/init.d/domainname' not found; aborting

```

what is going on here, how can i get my system to resolve my domain name?

----------

## UberLord

we punted that script

Setup is in conf.d/net now. To get exactly the same functionality, set dns_domain_lo="foo.bar.com" and/or nis_domain_lo="foo.bar.com" and restart net.lo

----------

## flazz

is there a doc or manpage for this somewhere?

----------

## flazz

when i restart net.lo my resolve.conf looks like:

```
cat /etc/resolv.conf

# Generated by net-scripts for interface eth0

nameserver xxx.xxx.xxx.xxx
```

and then no network connections work,

when i comment out that line and restart net.eth0 things work again, but no domain resolution.

this box has one interface eth0.

any ideas?

----------

## UberLord

So either use dns_domain_eth0=

or install and configure resolvconf-gentoo

----------

## flazz

do the settings from lo get overwritten by the eth0 settings? or do they append? or are they mutally exclusive? i'm a little confused. i'm used to one domain name being used per set of machines, it seems like it now per adapter.

also is /etc/resolv.conf generated every boot now? it is not for me. i added "search my.doman" to it and it works perfect. is there a way to generate it?

i think what i need is a better explanation of how the networking configuration system works. it'll haunt me if i get it to work without understanding why. i'll start reading the sample config file, are there any other docs on this?

----------

## UberLord

 *flazz wrote:*   

> do the settings from lo get overwritten by the eth0 settings? or do they append? or are they mutally exclusive? i'm a little confused. i'm used to one domain name being used per set of machines, it seems like it now per adapter.

 

It is per adapter. dhcp clients love to set domain or at least search domain too

 *Quote:*   

> also is /etc/resolv.conf generated every boot now? it is not for me. i added "search my.doman" to it and it works perfect. is there a way to generate it?

 

dns_search_lo="foo"

But same as above.

If you use dhcp and require that then either get the dhcp server to thump out the domain or use resolvconf-gentoo

 *Quote:*   

> i think what i need is a better explanation of how the networking configuration system works. it'll haunt me if i get it to work without understanding why. i'll start reading the sample config file, are there any other docs on this?

 

OK, the long and short is contention. Lots of different things want to add or change one file. This proved error prone and clumsy.

So we made each step either

1) send the change to resolvconf-gentoo and let that tool manage it for you.

otherwise

2) just overwrite the /etc/resolv.conf

That is why we moved the domain config to the network setup as it's mainly each adapter that wants to set it up.

----------

## flazz

thanks, this makes much more sense.

most of the changes are for computers that will access many networks through dhcp, like laptops.

in /etc/conf.d/net you can specify a separate configuration for each access point. if you dont/cant want to use that you can use resolvconf to set it manually.

it will only overwrite resolv.conf if it needs to (like with a dns_search_xxx=".+"), otherwise you can set resolv.conf the old fasioned way, edit it directly.

so with a static ip workstation that stays connected to a cat5 i can put my basic config in /etc/conf.d/net and put the search entries into resolv.conf or use dns_search_eth0.

currently i put two entries into /etc/hosts: one for loopback-localhost, and one for my ip-host.domain-host. i have the ip address, gw, search domain and nameservers in /etc/conf.d/net. i didnt put a dns_domain_eth0 or anything with _lo in there. it seems to be working fine, in the gentoo way.

i guess this is a solved issue. thanks for the info.

----------

## g4j

Is there an on-line (web) man-page for resolvonf-gentoo? I had resolveconf-gentoo installed on my notebook for a few days, but it was causing me all kinds of grief so I uninstalled it. I think in the long run, it's the smart way to do things on a traveling notebook, but I'd like to know how to tame it before re-installing it.

----------

## TheJoker89

 *UberLord wrote:*   

>  *flazz wrote:*   do the settings from lo get overwritten by the eth0 settings? or do they append? or are they mutally exclusive? i'm a little confused. i'm used to one domain name being used per set of machines, it seems like it now per adapter. 
> 
> It is per adapter. dhcp clients love to set domain or at least search domain too
> 
>  *Quote:*   also is /etc/resolv.conf generated every boot now? it is not for me. i added "search my.doman" to it and it works perfect. is there a way to generate it? 
> ...

 

WONDERFULL, thank you soooo much, now my network isnt working anymore, cant ping google etc

what to do now???

[FIXED] but domain still does not work

----------

## glurps

i also still can set domainname.

```
# cat /etc/resolv.conf 

# Generated by resolvconf

search j1.my.cc my.cc localhost

nameserver x.x.x.x

nameserver x.x.x.x

j1 ~ # cat /etc/conf.d/net

dns_search_lo=( "j1.my.cc my.cc localhost" )

dns_domain_lo="j1.my.cc"

nis_domain_lo="j1.my.cc"

config_eth0=( "dhcp" )

routes_eth0=( "default gw 192.168.1.1" )

dns_servers_eth0="x.x.x.x y.y.y.y"

dns_search_eth0=( "j1.my.cc my.cc localhost" )

dns_domain_eth0="j1.my.cc"

nis_domain_eth0="j1.my.cc"

config_eth1=( "192.168.2.1 netmask 255.255.255.0 brd 192.168.2.255" )

dns_search_eth1=( "j1.my.cc my.cc localhost" )

dns_domain_eth1="j1.my.cc"

nis_domain_eth1="j1.my.cc"

# domainname 

j1.my.cc

# domainname -y

j1.my.cc

# domainname -s

domainname: Unknown host

# domainname -a

domainname: Unknown host
```

shouldnt that be easy?   :Confused: 

edit: and now (after switching to resolvconf) i also get this error:

```
# /etc/init.d/net.eth0 restart

 * Stopping eth0

 *   Bringing down eth0

 *     Stopping dhcpcd on eth0 ...                                       [ ok ]

 *     Shutting down eth0 ...                                            [ ok ]

 * Starting eth0

 *   Bringing up eth0

 *     dhcp

 *       Running dhcpcd ...                                              [ ok ]

 *       eth0 received address 192.168.1.4/24

 *   Adding routes

 *     default gw 192.168.1.1 ...

SIOCADDRT: File exists  
```

----------

## UberLord

maybe because the dhcp client is setting the default gateway?

----------

## tundra

 *g4j wrote:*   

> Is there an on-line (web) man-page for resolvonf-gentoo? I had resolveconf-gentoo installed on my notebook for a few days, but it was causing me all kinds of grief so I uninstalled it. I think in the long run, it's the smart way to do things on a traveling notebook, but I'd like to know how to tame it before re-installing it.

 

I have had the same experience.  I only installed resolvconf to get pptpconfig working, as without it pptpconfig would screw up my resolv.conf on exit.  However, I found that with it my resolv.conf was screwed up the rest of the time!  Since I use pptpconfig relatively seldom, it seemed obvious to deal with pptpconfig issues when they happen, rather than dealing with resolvconf issues every time I turn my laptop on!  So just how do we tame resolvconf and make it work all the time?

----------

## UberLord

man resolvconf

Gets you the documentation

----------

## at

Thank you - following this thread I was able to set up resolvconf so that /etc/resolve.conf looks reasonable. 

But why now for every http request - even for the same address - it goes out to DNS servers and tries to resolve it again. In Firefox you can see "Looking up..." for a few seconds before it goes to a just visited site.

```
/etc/conf.d/net:

config_eth0=("192.168.0.15 netmask 255.255.255.0 broadcast 192.168.0.33")

routes_eth0=("default gw 192.168.0.33")

dns_servers_eth0=("192.168.0.33")

dns_search_eth0=("192.168.0.33 localhost")
```

```
resolvconf -l eth0

# resolv.conf for interface eth0

# Generated by net-scripts for interface eth0

search 192.168.0.33 localhost

nameserver 192.168.0.33
```

```
# arp

Address                  HWtype  HWaddress           Flags Mask            Iface

Router.lan                ether   00:09:15:66:AC:13   C                     eth0
```

----------

## at

The problem turned out to be that vpnc left extra nameserver records in resolvconf.

----------

