# /etc/conf.d/domainname doesn't exist in 2006.1?

## humbletech99

Is /etc/conf.d/domainname deprecated now or something?

I have just installed a 2006.1 server and it doesn't exist. In fact I kept getting the following

```
cat /etc/resolv.conf

domain mydomain.com

search mydomain.com

nameserver 192.168.1.137

# dnsdomainname

dnsdomainname: Unknown host
```

until I put the line in /etc/hosts

```
192.168.1.3     mybox.mydomain.com
```

I find it strange that a machine should have to do a dns lookup or hosts file lookup to be able to say where it belongs...

This was before I had it in dns and before it was in /etc/hosts. I just removed it from /etc/hosts and it still worked, so I removed it from dns and then it went back to

```
# dnsdomainname

dnsdomainname: Unknown host
```

again.

How weird that a machine should have to actually look itself up before it will say it's in a domain. This type of checking seems extraneous to me.

perhaps its the dnsdomainname command that is at fault, although then it is more likely by design and my understanding or opinion that is at fault...

EDIT: ok it's the gethostname() system function that is responsible for this behaviour

Back to the original question, where has /etc/conf.d/domainname gone?

----------

## neysx

You don't need resolv.conf to help your box identify itself.

All you need to do is define the hostname in /etc/conf.d/hostname and have a matching name in /etc/hosts:

```
mybox ~ # cat /etc/resolv.conf                                                      

nameserver 10.0.0.1

domain a.la.maison

mybox ~ # cat /etc/conf.d/hostname                                                 

# /etc/conf.d/hostname

# Set to the hostname of this machine

HOSTNAME="mybox"

mybox ~ # cat /etc/hosts                                                           

127.0.0.1 mybox.at.myplace mybox localhost

mybox ~ # dnsdomainname                                                            

at.myplace

mybox ~ # hostname -f                                                              

mybox.at.myplace

mybox ~ # hostname                                                                 

mybox

mybox ~ # ping -c1 basil                                                           

PING basil.a.la.maison (10.0.0.2) 56(84) bytes of data.

64 bytes from basil.a.la.maison (10.0.0.2): icmp_seq=1 ttl=64 time=0.238 ms

--- basil.a.la.maison ping statistics ---

1 packets transmitted, 1 received, 0% packet loss, time 0ms

rtt min/avg/max/mdev = 0.238/0.238/0.238/0.000 ms

```

Hth

----------

## humbletech99

I know that, that is why hosts is used to prevent the dns query.

I did have my hostname set in /etc/conf.d/hostname, but not in /etc/hosts which is why is performed (and failed) a dns query.

Why does it have to resolve itself anyway?

And the original question, what happened to Mr Garibaldi?

err, I mean, what happened to /etc/conf.d/domainname?

----------

## neysx

 *humbletech99 wrote:*   

> I know that, that is why hosts is used to prevent the dns query.
> 
> I did have my hostname set in /etc/conf.d/hostname, but not in /etc/hosts which is why is performed (and failed) a dns query.
> 
> Why does it have to resolve itself anyway?

 It has to find the info somewhere and our *nix deities once decided it would be from /etc/hosts.

 *humbletech99 wrote:*   

> And the original question, what happened to Mr Garibaldi?
> 
> err, I mean, what happened to /etc/conf.d/domainname?

 It was removed from baselayout months ago. The only thing it ever did was to add a line to resolv.conf and we can do without. You can find some info in net.example, but most people are just better off without it.

----------

## humbletech99

hmm it just seems strange to go through the dns nsswitch to find it's own domain name, when this could have been much more easily done statically. Although I guess this was from the days of hosts supremacy. Also this makes it more flexible in a way cos then if you don't have it written anywhere it will fall though to dns which will find it for you.

----------

## col

well I cant get my dnsdomainname to work ... whats wrong ?

```

me ~ # cat /etc/resolv.conf

# Generated by net-scripts for interface ra0

domain mydomain.com.au

nameserver 192.168.1.10

me ~ # cat /etc/conf.d/hostname

# /etc/conf.d/hostname

# Set to the hostname of this machine

HOSTNAME="me"

me ~ # cat /etc/hosts

127.0.0.1       localhost

192.168.1.69    me mydomain.com.au

192.168.1.10    mydomain.com.au

192.168.1.10    www.mydomain.com.au

192.168.1.10    www

me ~ # dnsdomainname

me ~ # hostname -f

me

me ~ # hostname

me

```

```
me ~ # cat /etc/conf.d/net

config_eth0=( "192.168.1.70 netmask 255.255.255.0" )

config_ra0=( "192.168.1.69 netmask 255.255.255.0" )

routes_eth0=("default via 192.168.1.254")

routes_ra0=("default via 192.168.1.254")

dns_servers_eth0="192.168.1.10"

dns_servers_ra0="192.168.1.10"

dns_domain="mydomain.com.au"

```

----------

## dleverton

 *col wrote:*   

> 
> 
> ```
> 192.168.1.69    me mydomain.com.au
> ```
> ...

 

Should be 

```
192.168.1.69    me.mydomain.com.au me
```

----------

## humbletech99

yes, the order in the hosts file makes all the difference. You need to put the fqdn before the hostname on the line with your ip otherwise dnsdomainname doesn't work. I'm not sure why this is, either a limitation of the way it was written or a "feature".

----------

