Configure a static ip address in CentOS 5.5

This is a quick and easy tutorial on how to configure a static ip address on CentOS 5.5
You will need to login as the root user and type the following command, "system-config-network":



You will enter the SELECT ACTION screen in the network setup screen:



Select "Edit Devices". You will be presented with the option to configure the various network interface cards that are currently present on you system:



Hit enter to begin configuring your ip address. On the next screen (shown below) you will enter the appropriate values for the static ip address for your system. Be sure to uncheck the option for "Use DHCP". DHCP is the acronym for Dynamic Host Configuration Protocol; just a fancy way for requesting an ip address from your gateway (router) instead of explicitly specifying an ip address. For the purposes of my example, I've configured an internal ip address:



When finished, select OK and then SAVE. Now, back to the SELECT ACTION screen, we'll select "Edit DNS configuration":



On the following screen, we configure the DNS settings. We can specify the hostname of your machine, in my example I've left it as "localhost" and then you specify the ip addresses of each DNS. A DNS is short for Domain Name Server. A domain name server simple converts a alphanumeric name into an ip address. For example, when you type in in your web browser, your system will query a DNS server for the ip address of the web server that is hosting the website. This would be equivalent to you actually typing in the ip address of directly into your browser. The benefits of using DNS is that users won't have to memorize an ip address, and system administrators can change ip addresses (web hosts) without users needing to make any changes or updates.

In my example, I've configured my system to use my gateway (router) as my primary DNS. I've configured the secondary and tertiary DNS as google's public DNS servers, and left the search field blank:



Finally, select OK and SAVE&QUIT to exit the network configuration menu. Lastly, you will need to restart your network to apply the changes. Type in the following command, "service network restart". You should see the messages that the network has successfully stopped and restarted as shown on the screenshot below. You can test to make sure your ip address is correct by typing in the following command, "ifconfig". If you cannot get eth0 to come up (the device that we've configured to use the static ip address, you'll need to open up /etc/sysconfig/network-scripts/ifcfg-eth0 and make sure ONBOOT=yes. Congratulations! You're done!

Add comment

  Country flag
  • Comment
  • Preview