CTS 2333 (Unix/Linux Networking) Project #3
Static IP and Hostname Configuration


Due: by the start of class on the date shown on the syllabus


Each student has been assigned two hosts, one server and one client host.  In this project you will learn how to configure one of your hosts (we'll call it the server host, and your other system the client host) with static IP addresses, hostnames, and other networking parameters.  This setup will be used for the rest of the course.

Make sure you keep an accurate system journal of any and all changes you make to your system!  You will need to turn this in, along with the answers to the questions asked below.

For your static IP address to actually work you must set other network parameters, including a default gateway.  Other steps include setting a hostname and configuring the resolver (DNS libraries) with the IP address of your nameserver and your default domain name.  Until we build a new nameserver you will need to update your /etc/hosts file with the names and IP addresses of all the hosts used in our classroom.  You can create this file from the information found at the Networking class wiki site, the “Networking Class Host Name List”.

The hostname you picked at the beginning of the term should be assigned to your server We won't be configuring your client host in this project, so it should continue to use DHCP as before.

Since version 11, Fedora doesn't enable the “network” service by default.  Instead the “NetworkManager” service is enabled.  This service doesn't support “static” IP configuration through Fedora 15 (even though it says it does; see bugzilla.redhat.com/show_bug.cgi?id=698199).

Before beginning this project you must disable NetworkManager and enable instead network.  Once you do this, you may (or may not) need to configure the network service for DHCP before networking will operate correctly.  You can use any GUI or other method to do this.

For Fedora 15, you use “systemctl disable NetworkManager.service”, then enable the older service with “systemctl enable network.service”.  You may need to install system-config-network with yum.  In addition, you can (and probably should) add “NM_CONTROLLED=no” to your ifcfg-<name-of-interface> file.

If you need help with this step, ask your instructor.


Answer the following questions and perform the following tasks.  (For the answers to Solaris questions consult the man pages and the Solaris on-line documentation.)

Part I — Creating a Static IP Setup

Before proceeding, make a copy of your current, working network setup: IP address and mask, routing table (especially the default route), and the contents of /etc/resolv/conf.  As usual, when you modify files you should first make a copy.  You can then record the output of diff to show your changes.

  1. From the command line (and without modifying any files) configure the NIC on your server with the static IP address assigned to you in class.  This step requires the use of the ifconfig command, or the ip addr add address/prefix-length dev interface  command.  Here's an example using the new Linux ip command:
    # ip addr add dev eth0

    (Of course you use the correct address, prefix length, and device, which may not be eth0.)  Once set, verify your NIC has the correct address.  What command do you use to verify the address assigned to a NIC?

    Make sure to keep track of all IP address assignments!  This is typically a separate document from any one system's journal.  This document should be kept current and include a “last revised” date.  However, with only two hosts to keep track of, you can just record the IPM address assignments in your system journal.  (Consider putting that information in a table near the beginning of the journal, say near the partition map.)

  2. From the command line update your default route (or gateway).  This will be the same as your current gateway address as assigned by DHCPWhat is your current (working) gateway (default route) IP address?  You must set your default route to the IP address of the classroom's gateway router (which should be  This step is done using the route command or the new Linux ip command:
    # ip route add 0/0 via address

    (Of course you should use the correct gateway address.)  Once set, verify your system's routing table (make sure the default route shows and is correct).  What command do you use to verify the default route?

    When checking the routing table, you make notice a long delay when displaying the default route.  This may happen when the network gateway doesn't have a DNS entry, and your system by default attempts to lookup the name for the gateway's IP address.  What is the option for the command to display the routing table, to cause it not to lookup DNS names?  (One way to fix this, is to add a name for the gateway IP address in the DNS system, or in /etc/hosts.  I often add a name such as “HCC-gateway” for this.)

  3. From the command line assign your host a new hostname, using the hostname command.  (You can use the new Linux command hostnamectl instead if you wish.)  To set the domain name in Red Hat compatible Linuxes you must make sure your name service can lookup the fully qualified domain name or FQDN from the hostname.  For the default setup this means you must add an entry to /etc/hosts that contains the static IP address of your host, its FQDN, and its hostname.

    The domain name for our class is "gcaw.org".  For a hostname of siegfried and an IP address of the /etc/hosts entry should be:  siegfried.gcaw.org  siegfried

    What was the exact command line you used to set your system's hostname?

  4. Test your static IP setup.  Try the command “traceroute”.  This should show several hops, the first of which should be the class gateway.  If you don't get the expected output verify your IP address and default route again.  If necessary you can start over by restarting networking (use "/etc/rc.d/init.d/network restart").  This will reactivate your DHCP configuration.

Part II — Making the Static IP Setup Permanent

Once your static IP and routing configuration is working it is time to make the changes permanent.  This requires you to modify files on your host (besides the /etc/hosts file, which you've already modified).  Perform the following steps:

  1. Configure your resolver library.  This is the name to IP-address lookup service.  To avoid any DNS lookup problems, update your /etc/hosts file with entries for the gateway router and for the other student servers (and the instructor's host as well).  (As mentioned above, I generally use a name such as “HCC-gateway” for the router.)  Don't forget to keep the entry for your own host added earlier.  Remember all entries (but at least your own) should contain both the hostname and the FQDN.
    1. Update your /etc/hosts file with the information from the class wiki site's “Networking Class Host Name List”.
    2. Configure the resolver to use the hosts file before trying DNS.  (You system is likely already setup this way.)  Examine and update if necessary /etc/nsswitch.conf (the hosts entry).  What changes did you need to make?  What is the output of the command “grep hosts /etc/nsswitch.conf”?
    3. Since the resolver is set to use DNS, you must update the /etc/resolv.conf file to include the correct default domain name(s) and DNS (nameserver) IP address(es).  This file was managed and routinely over-written by DHCP (and PPP), but now you must edit it manually.  What is the current contents of the /etc/resolv.conf file (as created by DHCP)?
    4. The default domain name to use for our class is gcaw.org.  The nameserver IP address to use is  Optionally you can specify a second default domain name of hccfl.edu, to allow commands such as “ssh ua00@YborStudent” to work.  It is possible you may need to set some options, for example you may find it necessary to change the default DNS timeout from 5 seconds to a larger value.  See the resolv.conf man page for more information.

      The resolve.conf file might look like this:


          search gcaw.org hccfl.edu

      The DHCP version of resolv.conf is probably correct.  Use the DNS (nameserver) IP addresses you see there when making your own version of this file.
      When DHCP modifies the /etc/resolv.conf file, it first makes a copy of this file.  When the interface is brought down, the old resolv.conf file is restored.  So, after your next reboot any changes to this file may be lost!  This is a one-time thing; once you set your interface to static IP, the DHCP client won't over-write resolv.conf again.  Make a copy of your correct resolv.conf file, so you can easily restore it later (if needed).

    5. Test your resolver setup.  Try using the ping command to ping hosts by name.  What is the results of each of the following commands?:
      ping -v wpserver
      ping -v wpserver.gcaw.org
      ping -v your-hostname
      ping -v your-hostname.gcaw.org
      ping -v www
      ping -v www.hccfl.edu
    6. How many domains can be listed on the search directive in the resolv.conf file?  How did you find this out?
  2. At this point the resolver, routing, and your IP address are are set up and tested for a static configuration.  However if you restart networking (or reboot), all your work will be lost.  You must now make your changes permanent by updating the various configuration files.  These differ by system; here we will configure your Fedora system, using the network service (and not the newer but buggy NetworkManager service).  What is the configuration file's absolute pathname that holds the network configuration for your NIC (e.g., “eth0”)?

    The descriptions of the various configuration files you need to edit are found in the file:

  3. Turn off DHCP and set for static configuration.  Edit the NIC's configuration file and change the boot protocol from dhpc to noneWhat is the exact entry you modified for this?
  4. Next add an entry for the IP address and netmask to use for this NICWhat are the exact two lines you modified (or added) for this?
  5. Configure your default gateway.  Edit the file /etc/sysconfig/network and add (or change) an entry for the following:
    GATEWAY=address  #IP address of gateway

    In Red Hat compatible Linuxes since version 7.2, the default gateway can be set in a manner similar to that used on Solaris, by creating the file /etc/default-route.  This file should just contain the IP address of your gateway.  What file should contain your gateway IP address on Solaris?

  6. Configure your hostname. 

    The whole concept of a hostname is confusing!  Before DNS or even Ethernet, a computer could be given a name, sometimes called the hostname or the nodename.  With DNS and NICs, a name is associated with each IP address assigned to each NIC on some computer.  This too is called the hostname.  So what is “the” hostname on a host with multiple IP addresses?  It is not well defined but is usually configured by the administrator to be one of the DNS hostnames.  Some systems will set the hostname by a reverse DNS lookup on the first NIC found with an IP address assigned (the first or last address).

    For Red Hat compatible Linux systems you should edit the file /etc/sysconfig/network and add (or change) an entry for HOSTNAME=YourHostname.  This should NOT be the FQDN name.  The hostname and FQDN should still be set in the /etc/hosts file, which Red Hat consults to find the FQDN name.  (Note that Red Hat installers and documentation state to use the FQDN, but I've read the code and that is not correct through RHEL 6, or through Fedora 19.  You can test your system to see if “hostname” and “hostname -f” both report the FQDN; they shouldn't.)

    What file(s) on Solaris are updated to contain the host's hostname and domain name?

  7. What are the new contents of the files you changed in the previous four steps?

At this point your system is now configured with a static IP address, and the change will persist even if you restart networking or reboot.  However there are additional configuration steps you may wish to do:

  1. Update the greetings files with the hostname.  The file /etc/issue and /etc/issue.net contain system identification information that is displayed before a login prompt.  The default value contains information that is more useful to hackers than legitimate users.  You should update these files to contain a greeting which contains your system's hostname and no other information.  Another greeting file is used with the anonymous FTP server.  On Red Hat compatible Linuxes since 7.2, the default file is /var/ftp/welcome.msg.  This file too should only contain the hostname, something like "Welcome to the hostname Anonymous FTP Server!".
  2. Some other related files should be created or updated.  /etc/motd is displayed to users just after a successful login and often contains an acceptable use policy (AUP) statement.

    The file /etc/networks allows you to assign names for IP network numbers.  This file is optional but if present will allow you to use the names in commands such as route and ifconfig.  A sample networks file might look like this:


  3. Suppose one day your DNS stops working.  This is likely because the network administrator has updated the nameserver IP addresses to use.  No doubt if you were running DHCP you would automatically get the new DNS IP addresses.  How can you determine the new networking parameters (such as the DNS server IP address(es) to use)?  List two different ways.

Test your static IP setup by restarting networking.  Use the command “/etc/rc.d/init.d/network restart” and verify everything is correctly configured by using the hostname, ifconfig, route, traceroute, and ping commands as before.

If things are not working, carefully check all the steps you did by comparing the system journal with these directions.  Also make sure the classroom is plugged into the campus network.  If you are unable to get things to work, you can attempt to use a GUI network setup tool.  You can also run the dhclient command to temporarily restore the DHCP configuration.

To be turned in:

You can send as email to (preferred).  If email is a problem for some reason, you may turn in a hard-copy.  In this case the pages should be readable, dated, and stapled together.  Your name should appear on the first page. 

Don't turn in your whole journal, you will need to add to it every day in class!  It is common in fact to keep the journal as a text file on the system (with a paper backup of course).

Please see your syllabus for more information about submitting projects.