# hostname domainname dnsdomainname fqdn

## jmoore85

I can't get hostname -f to display omnium.barsetshire which is what I think I want to avoid apache errors and various other stupid stuff like not being able to ping by host name or ssh by host name. The config files are below - if you need more information then please let me know. I have searched all the forums and tried combinations of almost everything which makes me think something is not installed. nsswitch.conf maybe? Not sure what that is. If a kind expert could point me in the right direction I'd be really please for the help.

Jonathan.

Here is my configuration

/etc/issue

```
This is \n.\O (\s \m \r) \t
```

/etc/hosts

```
127.0.01        localhost

192.168.12.2    omnium.barsetshire      omnium
```

/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 va

pier 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="barsetshire"

DOMAINNAME="barsetshire"

# 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="barsetshire"
```

/etc/conf.d/dnsdomainname

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

pier 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="barsetshire"

DOMAINNAME="barsetshire"

# 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="barsetshire"
```

/etc/conf.d/hostname

```

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

# Set to the hostname of this machine

HOSTNAME="omnium"
```

/etc/conf.d/net

```
# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

config_eth0=("192.168.12.2 netmask 255.255.255.0")

routes_eth0=("default gw 192.168.12.1")
```

\etc\resolv.conf

```
nameserver 206.141.193.55

nameserver 66.73.20.40

domain barsetshire
```

output of ifconfig

```
eth0      Link encap:Ethernet  HWaddr 00:03:47:63:05:B3  

          inet addr:192.168.12.2  Bcast:192.168.12.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:1655 errors:0 dropped:0 overruns:0 frame:0

          TX packets:788 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:139874 (136.5 Kb)  TX bytes:105704 (103.2 Kb)

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:506 errors:0 dropped:0 overruns:0 frame:0

          TX packets:506 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:31968 (31.2 Kb)  TX bytes:31968 (31.2 Kb)
```

output of route -n

```
Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.12.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

0.0.0.0         192.168.12.1    0.0.0.0         UG    0      0        0 eth0
```

output of various others

omnium:Sun 03:09:58:etc:# hostname

```

omnium
```

omnium:Sun 03:09:59:etc:# dnsdomainname 

```

dnsdomainname: Unknown host
```

omnium:Sun 03:09:59:etc:# domainname

```

barsetshire
```

omnium:Sun 03:09:59:etc:# ping localhost

```

PING localhost (127.0.0.1) 56(84) bytes of data.

64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.046 ms

64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.054 ms

--- localhost ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 1001ms

rtt min/avg/max/mdev = 0.046/0.050/0.054/0.004 ms
```

omnium:Sun 03:09:59:etc:# ping omnium

```

ping: unknown host omnium
```

omnium:Sun 03:09:59:etc:# ping localhost.localdomain

```

ping: unknown host localhost.localdomain
```

omnium:Sun 03:09:59:etc:# uname -a

```

Linux omnium 2.6.11-gentoo-r11 #6 Sun Jul 3 07:56:50 EDT 2005 i686 Pentium III (Coppermine) GenuineIntel GNU/Linux

```

finally the contents of various directories

omnium:Sun 03:10:04:/:# ls

```

b.tar.gz  etc         mnt                              proc                            sys

bin       home        opt                              root                            tmp

boot      lib         portage-20050701.tar.bz2         sbin                            usr

dev       lost+found  portage-20050701.tar.bz2.md5sum  stage3-pentium3-2005.0.tar.bz2  var
```

omnium:Sun 03:10:04:/:# ls /etc

```

DIR_COLORS          etc-update.conf  ld.so.conf          mplayer.conf   runlevels

X11                 exports          limits              mtab           scsi_id.config

adjtime             fb.modes         locales.build       nanorc         securetty

apache2             fdprm            localtime           nas            security

asound.state        filesystems      login.access        networks       services

aumixrc             fonts            login.defs          nisdomainname  shadow

bash                fstab            logrotate.conf      nscd.conf      shadow-

blkid.tab           gentoo-release   logrotate.d         ntp.conf       shells

blkid.tab.old       gpm              mail                opt            skel

conf.d              group            mailcap             pam.d          ssh

cron.d              group-           make.conf           pango          ssl

cron.daily          gshadow          make.conf.example   passwd         ssmtp

cron.deny           gshadow-         make.globals        passwd-        sudoers

cron.hourly         gtk              make.profile        portage        svgalib

cron.monthly        gtk-2.0          man.conf            profile        sysctl.conf

cron.weekly         hosts            modprobe.conf       profile.env    syslog.conf

crontab             hotplug.d        modprobe.conf.old   protocols      terminfo

csh.env             init.d           modprobe.devfs      pwdb.conf      tomcat5

cups                inittab          modprobe.devfs.old  rc.conf        udev

default             inputrc          modules.autoload.d  resolv.conf    vga

dev.d               issue            modules.conf        rmt            wget

dispatch-conf.conf  issue.logo       modules.conf.old    rpc            xinetd.d

env.d               ld.so.cache      modules.d           rsync          xml
```

omnium:Sun 03:10:04:/:# ls /etc/conf.d

```

alsasound    dnsdomainname  hostname     nas          ntp-client     postgresql  tomcat5

apache2      domainname     keymaps      net          ntpd           rc          wireless.example

clock        gpm            local.start  net.example  pg_autovacuum  rsyncd      xfs

consolefont  hdparm         local.stop   nfs          portmap        sysklogd
```

omnium:Sun 03:10:04:/:# ls /etc/runlevels/boot/

```

bootmisc  checkroot  consolefont  hostname  localmount  net.lo     urandom

checkfs   clock      domainname   keymaps   modules     rmnologin
```

omnium:Sun 03:10:04:/:# ls /etc/runlevels/default/

```

alsasound  aumix       hostname  nas       netmount  ntpd     sshd      tomcat5

apache2    domainname  local     net.eth0  nfs       portmap  sysklogd  vixie-cron
```

----------

## papal_authority

The domain should be barsetshire.org or some other TLD. The name omnium.barsetshire is not a valid FQDN.

----------

## jmbsvicetto

 *jmoore85 wrote:*   

> I can't get hostname -f to display omnium.barsetshire which is what I think I want to avoid apache errors and various other stupid stuff like not being able to ping by host name or ssh by host name. The config files are below - if you need more information then please let me know. I have searched all the forums and tried combinations of almost everything which makes me think something is not installed. nsswitch.conf maybe? Not sure what that is. If a kind expert could point me in the right direction I'd be really please for the help.
> 
> Jonathan.
> 
> ...
> ...

 

Hi.

Your /etc/conf.d/domainname doesn't need a DOMAINNAME line. And unless you use NIS, you don't need the NISDOMAIN also. There should also be no /etc/conf.d/dnsdomainname. The new baselayout uses only /etc/conf.d/domainname for both DNS and NIS.

 *jmoore85 wrote:*   

> 
> 
> /etc/resolv.conf
> 
> ```
> ...

 

This means that you're using an external DNS server to solve your DNS names. That is usually a bad idea. Furthermore, you have a "fictional" DNS name - I don't know any TLD named barsetshire, and thus your ISP DNS server, that's what you're using, right?, doesn't know your "ficitonal" zone, so it will never resolve the name of your systems. If you have no interest in running a DNS server at home and have less than a handful of systems, you'll have to tell your system that it should try to resolve names by reading files and only after by querying the DNS server. That means you have to edit /etc/nsswitch.conf to include the following line

```
hosts:       files dns
```

This tells your system to first look at /etc/hosts and only if it fails to ask the DNS server to solve the name. You'll have to include an entry for every system in the /etc/hosts and to sync the file in all hosts that you have on your network.

 *jmoore85 wrote:*   

> 
> 
> ```
> omnium:Sun 03:09:59:etc:# ping omnium
> 
> ...

 

You don't obtain any answer, because your system is trying to solve the name through DNS and doesn't get any answer.

Does this make sense?

PS:

Oh, and if you have NSCD running, when you make any change, you do

```
# /etc/init.d/nscd restart
```

to clear the cache and force it to use the new configuration.

----------

## jmoore85

Still no joy

I have changed DNSDOMAIN and DOMAINNAME ="barsetshire.org" in /etc/conf.d/domainname

hostname is right, domainname returns none and dnsdomainname says unknown host.

Could it be something wrong with my kernel?

EDIT: FORGET THIS POST. I HADN'T READ THE POST FROM jmbsvicetto

----------

## jmoore85

Creating /etc/nwswitch.conf worked. For some reason baselayout-1.11.12-r4 did not create this file. I copied it from another G2 system I have with baselayout-1.9.4-r6 which epm -qf reports owns /etc/nsswitch.conf.

Thanks very much.

Jonathan  :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

----------

## jmbsvicetto

 *jmoore85 wrote:*   

> ... epm -qf reports owns /etc/nsswitch.conf...

 

A similar Gentoo tool is

```
atl64 linux # equery belongs nsswitch.conf

[ Searching for file(s) nsswitch.conf in *... ]

sys-libs/glibc-2.3.5 (/etc/nsswitch.conf)

atl64 linux #  
```

----------

## jmoore85

OK i just emerged gentoolkit and typed

equery nsswitch.conf

```

[ Searching for file(s) nsswitch.conf in *... ]

```

And got the prompt back. glibc-2.3.4.20040808-r1 is installed

Very weird. Not sure why nsswitch.conf was not created.

----------

