Hostname and interfaces

Rob listone at deathbeforedecaf.net
Mon Sep 20 05:37:38 PDT 2004


Fellow BSDers,

I have a FreeBSD 4.x firewall with 2 sis(4) interfaces on the inside, and a 
PPPoE interface to the rest of the world.

According to the BIND FAQ, the ideal relationship between hostnames & 
interfaces is:

    gethostbyname(gethostname) == gethostbyaddr(primary_interface_address)

For multihomed hosts, the difficulty is in choosing the 'primary' interface. 
Normally, I would pick the default or upstream interface, but in this case 
it's the least reliable due to the whims of my ISP. It's also missing when 
the machine first boots, before mpd(8) starts.

So I'm wondering what happens if I don't assign the hostname to any 
interface. I know that sendmail(8) gets upset when it can't resolve the 
hostname, but do other applications care?

Doing a little research, I ran

    # cd /usr/src
    # find * -type f -name '*.[ch]' | xargs grep -l gethostname | \
        xargs grep -l gethostbyname
    contrib/amd/fixmount/fixmount.c
    contrib/amd/wire-test/wire-test.c
    contrib/bind/bin/dnsquery/dnsquery.c
    contrib/cvs/src/server.c
    contrib/gcc/sys-protos.h
    contrib/gdb/gdb/m32r-rom.c
    contrib/ipfilter/common.c
    contrib/perl5/iperlsys.h
    contrib/perl5/objXSUB.h
    contrib/sendmail/mail.local/mail.local.c
    contrib/sendmail/src/daemon.c
    contrib/smbfs/lib/smb/nb_net.c
    contrib/tcsh/tc.func.c
    contrib/traceroute/traceroute.c
    crypto/heimdal/appl/login/utmp_login.c
    crypto/heimdal/lib/krb5/get_addrs.c
    crypto/kerberosIV/appl/bsd/su.c
    crypto/kerberosIV/appl/ftp/ftp/ruserpass.c
    crypto/kerberosIV/appl/sample/simple_client.c
    crypto/kerberosIV/appl/telnet/telnet/commands.c
    crypto/kerberosIV/include/win32/config.h
    crypto/kerberosIV/include/win32/roken.h
    crypto/kerberosIV/kadmin/kadm_ser_wrap.c
    crypto/kerberosIV/lib/krb/getaddrs.c
    crypto/kerberosIV/lib/krb/verify_user.c
    crypto/kerberosIV/slave/kprop.c
    crypto/openssh/auth-krb4.c
    crypto/openssh/logintest.c
    crypto/openssh/session.c
    kerberos5/include/config.h
    kerberosIV/include/config.h
    lib/libcompat/4.3/rexec.c
    libexec/bootpd/bootpd.c
    sbin/route/route.c
    usr.bin/su/su.c
    usr.bin/w/w.c
    usr.sbin/ppp/ipcp.c
    usr.sbin/ppp/radius.c
    usr.sbin/pppd/options.c
    usr.sbin/timed/timed/timed.c
    usr.sbin/timed/timedc/cmds.c
    usr.sbin/traceroute6/traceroute6.c

This host runs very few applications, and with the exception of ssh none of 
them are in this list.

Has anyone tried running a networked system with a non-resolvable hostname? 
Apart from sendmail and general principles, what is likely to break?

Thanks
Rob. 



More information about the freebsd-questions mailing list