Unable to resolve hostname

So we know hostname returns woofy. But that name can't be resolved to an IP address.

The short answer is that you need to add an entry for woofy in /etc/hosts. Make it resolve to Or if your system is IPv6-capable, ::1.

Keep a backup of the previous version of /etc/hosts in case you make a mistake (I use the handy etckeeper package for this, but if you prefer it ye olde way, you can use a manual backup or even RCS).

The long answer is that how hostnames are resolved to IP addresses is controlled by a set of configuration files which vary slightly between Unix variants. You can configure your Unix system to resolve host names by hosts file (/etc/hosts will work on almost any Unix system) or by DNS (systems which have direct IP reachability to the Internet will always do this). There are other alternatives too, mostly less widely used (including LDAP and NIS/NIS+). See the Wikipedia article about the Name Service Switch for more context on this.

Edit: if this still causes a DNS lookup, the problem is probably that your Name Service Switch configuration consults DNS before /etc/hosts so the change to /etc/hosts has no effect. Try looking at /etc/nsswitch.conf (how the NSS is configured varies between operating systems).

Unix systems have a notion of host name that isn't related to the network subsystem. That name is what the hostname command shows and what turns up in logs. When you make an ssh connection, it performs a DNS lookup, to find out what the name means in the context of the TCP/IP protocol family that SSH operates on.

For your sanity, you had better make sure that this host name agrees with what your neighborhood DNS server says, and with what (if anything) your system thinks it's called. In fact, DNS names are not associated with machines, but with network interfaces, so your DNS name will be associated with one of your network interfaces. On machines with no actual network connection, the host name should be associated with the loopback interface.

In practice, the hostname is stored in the file /etc/hostname on most machines. You can change it at runtime with the hostname command; this is done early in the boot process. The local idea of the DNS name is stored in /etc/hosts, on the line corresponding to either the loopback interface ( or to one of the machine's network interfaces.