User Tools

Site Tools


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 a 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 take the interface down and bring it back up to change the IP address (ifdown eth0 && ifup eth0). 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 verify the host name, domain name, and FQDN, run:

hostname -d
hostname -f

On Solaris, changing a hostname/IP is a bit different. The hostname of the system is contained in /etc/hostname.<interface>. If your primary interface is hme0, your hostname (not FQDN) would be in /etc/hostname.hme0. That hostname also needs to needs to be in /etc/inet/ipnodes. Solaris finds the corresponding IP in those files and then assigns it to the appropriate interface. Once you've changed the config files, you can either run 'svcadm -v refresh network/physical' or reboot.

Note that if your network does not use the default netmask for its class, you will need to enter the network address and netmask in /etc/netmasks.

Solaris sets the default router in /etc/defaultrouter.


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.

Authoratative DNS Records

When changing system IPs, you'll need to update the authoratative DNS records for those systems. These are hosted at EveryDNS. See the domains page for more info.


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. Check all the ServerName and ServerAlias settings in the files in /etc/apache2/sites-available/.


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


LDAP is not implemented on our systems yet.

build/ips.txt · Last modified: 2009/08/05 18:10 by