


Make sure you change the relevant settings to suit your network. The # character at the beginning of the line indicates that it is commented out, and will be ignored. This allows you to change it back easily at a later date if you want to. If you dont want to delete the lines, simply comment them out. Most of the lines in this file will be changing, so your best option is to remove all the lines except the first one, and copy the example format from the example below.

You should see the lines similar to the following in the editor. # vi /etc/sysconfig/network-scripts/ifcfg-eth0 Make sure you are logged in as “root”, or a user with root privileges. This guide will be using the “vi” editor, but you can use “nano” or another editor. Open up the /etc/sysconfig/network-scripts/ifcfg-eth0 file in your favorite editor.

This example will assume that you want to set up the static IP address on the first network interface. The files to look for are ifcfg-eth# where # is the network interface number, starting from 0. The following steps will guide you through setting up your computer to use a static IP address on CentOS.Īssuming the network interface is supported and detected under CentOS, you will find that the configuration files required to set the IP address can be found under /etc/sysconfig/network-scripts. If for whatever reason you dont want to go down the path of setting a DHCP reservation (you may not have access to the DHCP server unsure how to set it up etc), the only option is to set a static IP address on the PC itself. You could set up a IP address reservation on the DHCP server based on the hardware/mac address of the network interface, or alternativly, set the operating system to use a static IP address. There are two options for ensuring you get/use the same IP address at every boot. While that may be fine for most desktop users, if you are wanting to set up a server, the chances are you will be wanting it to always have the same IP address. During a default install of CentOS it will try to either automatically obtain an IP address using DHCP, or it wont even set up the network interface automatically.
