User Tools

Site Tools


This is an old revision of the document!

How to Change IP Address and/or Host Name

This page describes the steps required to change IP addresses and/or domain names. It should be used whenever changing ISPs, or whenever the IP address or domain/system name of the system changes.

Note that this page may get out of sync with the other pages. But the hope is that everything is documented here. Either way, be sure to test all network applications after changing the system's IP address and/or host name.


The IP address is stored in /etc/network/interfaces on Debian systems. You can its settings by taking the interface down and bringing it back up. If you're connected via the network, you'll get logged out. You'll probably be able to log back in over the network, but be prepared to log in at the console if things go wrong.

The host name and domain name are configured a bit oddly in Debian. The hostname is set in /etc/hostname. You should probably use the hostname command to set it. The domain name is determined by looking up the system's IP address in the /etc/hosts file. Hence, the first entry for the IP address must be the fully qualified name of the system. The host name (without the domain name) should come after the FQDN.

You should also make sure /etc/hosts is updated for any other systems that are getting their IP address or name changed.

To verify the IP address, run:

$ /sbin/ifconfig | grep -E '(^[a-z])|inet addr'

To verfy the host name, domain name, and FQDN, run:

$ hostname
$ hostname -d
$ hostname -f


Shorewall determines the system's IP address and network from the interface settings, so no changes are required.

The firewall doesn't need to know the system's host name or domain name.


Our SSH is configured to listen on all interfaces, so no settings need to be changed.

The SSH daemon doesn't need to know the system's host name or domain name.


Our caching DNS server is configured to query the upstream DNS server for anything it doesn't have cached. This will generally be the ISP's DNS server. This will need to be changed when changing ISPs, as the ISPs generally only allow their own customers to access their DNS servers. The setting is stored in the /var/lib/named/etc/bind/named.conf.options file, in the forwarders statement.

When changing domain names, the /etc/resolv.conf file needs to have the domain setting changed.


There are no local IP addresses or names used in our NTP configuration.


Postfix needs to know our domain name in order to receive email for that domain. It's also nice to have it receive mail for its own host name. To change domain names, change the following configuration settings:

postconf -e "myhostname=`hostname -f`"
postconf -e "mydomain=`hostname -d`"

It may be necessary to change the mynetworks setting, if you're changing the IP address of any systems that need to be able to send outbound email through this system.

Restart Postfix to make the settings take affect:

/etc/init.d/postfix restart


Our Apache virtual hosts are set to listen on all interfaces, so no changes need to be made when changing IP addresses.

We used named virtual hosts, so any changes in domain names will need to be updated in the Apache virtual host configuration files. Change any ServerName and ServerAlias settings in the files in /etc/apache2/sites-available and /etc/apache2/sites-enabled/.


I don't think there are any changes that are required in the IMAP server when chaging IP address or system name.


LDAP is not implemented on our systems yet.

build/ips.1131201620.txt.gz · Last modified: 2006/01/16 18:34 (external edit)