Static IP Address

Reasons for using a Static IP

Most of the TarHeel Linux machines build with a DHCP address. This is totally appropriate for a desktop machine which is intended to be used by a single person from a console session. However, since DHCP stands for “Dynamic Host Configuration Protocol” this indicates that the IP address of this host can and will change. The following examples are intended to help you decide if you want to move to a static IP address and hostname.

Example 1: The primary user of the machine often accesses the machine remotely using the ssh protocol. It becomes necessary that the user remembers a not-terribly-memorable hostname, and there is a finite possibility that this hostname and associated IP address will change without notice.

Example 2: The machine is a shared resource. While there may be one primary user on the console, other users are connecting remotely to use the applications available on that host. These users must remember the hostname and there is no guarantee that it won’t change.

Example 3: The machine has been modified to run a network “service”. Remote machines need to be able to locate the machine using either its hostname or IP address, either of which is subject to change.

Obtaining a Static IP

The IP for a specific machine is determined by its position in the greater UNC network, and the setup of the port to which it is connected. This determines which VLAN it is in, and the range of IP addresses appropriate for that VLAN must be used. The best starting place is to send an email message to host-reg@unc.edu or submit an online help request via the Remedy system clearly stating the current DHCP address and hostname for your machine and requesting a static IP address for it. It is also good to give the name of the building it is in, and the number associated with the wall port into which it is currently connected. Some departments maintain their own pool of IP addresses, and if this is the case, your request will be referred to the proper authority by the nice people in ITS Networking.

Netmask and Default Gateway

The University of North Carolina runs what is historically known as a “Class B” network. For IP addresses in this range, the appropriate netmask is 255.255.0.0

Important: Many years ago, our network configuration was “flat”, and the default gateway address (sometimes known as the “default router”) was 152.2.254.254. Our network is now much (MUCH!) more complex and that address is scheduled be phased out in the near future. ITS Networking requests that everyone who builds new systems use the currently correct gateway address. The inquiry concerning an appropriate default gateway address is best made along with the request for a static IP address.

Selecting a Hostname

The standard convention for a Fully Qualified Domain Name (FQDN) on the UNC campus is as follows:

[hostname].[dept/vlan].unc.edu

The [dept/vlan] part of the FQDN is often determined by the VLAN and/or the departmental affiliation. The [hostname] is usually something chosen by the primary user of the machine, although some departments have their own naming scheme. Choose a hostname which is relatively short (5-8 characters) and memorable. If you think about it, you will realize that incorporating your ONYEN into the hostname is not a Good Idea from a security standpoint, and is heavily discouraged. The hostname of a machine is public. If it also incorporates the userid of the primary user, hackers are only one datapoint away from owning your machine.

Registering with the UNC Campus DNS

There is one last – but Extremely Important – step in setting up a static IP address for use on the UNC Campus. This involves registering the hostname/IP combination with the UNC Campus Domain Name Service (DNS). This can easily be accomplished by creating a ticket in the Remedy system and assigning it to ITS-IPSERVICES. The information is entered into the database with a guaranteed 24hr M-F turnaround. (Actually, it’s more like two hours during business hours) You will need to include your new static IP and the hostname as part of the Fully Qualified Domain Name in the ticket information.

You can use the “host” command to query the DNS server to see if your information has been posted to the database:

prompt% host [hostname].[dept/vlan].unc.edu

This should return the associated IP address for that hostname. Alternatively,

prompt% host [new.IP.address]

should return the associated hostname.

Changing the IP Address and Hostname in TarHeel Linux 6

Once you know that the new IP address and hostname are in the DNS database, it’s time to make the change on your TarHeel Linux machine.
You should have the following information noted down before you begin the process:

1) New Fully Qualified Domain Name – [hostname].[dept/vlan].unc.edu

2) New IP address

3) Correct netmask (255.255.0.0) and Default Gateway address
The easiest and safest way to do this is to use the GUI provided under the System menu in the top taskbar.

System -> Preferences -> Network Connections 

The following window will pop up.

For most of the desktop machine, there should only be one network connection.  Select that one and click “Edit…”.  The window named “Editing System eth0” will come up.   Click on the “Ipv4 Settings”tab to get to the following window.

In the “Method:” drop-down menu, select “Manual”.  Then, in the box of “Addresses”, click the “Add” button.

Click the box under “Address” and enter the IP address of the system.

Click the box under “Netmask” to enter the netmask.

Click the box under “Gateway” to enter the gateway.

Click the box for “DNS servers:” to enter nameservers separated by comma.

Click the box for “Search domains:” to enter search domains.   The first search domain should be the domain name of the machine.  Others can be the domain users of the system would like to connect to regularly.  These domains are entered and separated by commas.

Click “Apply…” to save the settings.

At this point, you will be prompted for the root password.

Enter the root password and the “Editing System eth0” window will disappear.  Click “Close” in the “Network Connections” window.

Open a terminal window, use your favorite editor to edit the file /etc/sysconfig/network to change the hostname.  The installation of TarHeel Linux 6 sets the hostname to be tarheellinux.isis.unc.edu.  Change it to the reat hostname of the machine.

NETWORKING=YES
HOSTNAME=humite.its.unc.edu

Select System / Shut Down from the top System task bar to restart your machine, and it’s done!

Changing the IP Address and Hostname in TarHeel Linux 5

Once you know that the new IP address and hostname are in the DNS database, it’s time to make the change on your TarHeel Linux machine.
You should have the following information noted down before you begin the process:

1) New Fully Qualified Domain Name – [hostname].[dept/vlan].unc.edu

2) New IP address

3) Correct netmask (255.255.0.0) and Default Gateway address
The easiest and safest way to do this is to use the GUI provided under the System menu in the top taskbar.

System / Administration / Network

At this point, you will be prompted for the root password.

On the screen which follows, begin with the [Devices] tab:


Double click on the Active Device to bring up the edit form:


Change the choice button from “Automatically optain IP address settings with [dhcp]” to “Statically set IP address”. Change the Address, Subnet mask, and Default gateway address fields to reflect your new values.  Now, move to the [DNS] tab:


You want to remove the old hostname and enter the new one on this screen.  The Primary DNS and Secondary DNS entries are set through DHCP connection.  Check to see if they are correct or not.  If not, change them.

Save the new information by selecting File / Save from the window’s task bar:
Select System / Shut Down from the top System task bar to restart your machine, and it’s done!