After installing CentOS you will wan’t to most likely configure a static ip address. CentOS is mostly used as Server for some purpose be it hosting your website or running a gaming server. So whatever the case you will want to give it a static IP address. By default CentOS interface is configured to receive IP from DHCP server if this is turned on. Here I will show you how to configure static IP address in CentOS system.
1. You will need to edit the file for your Ethernet connection under /etc/sysconfig/network-scripts. We will edit this file and add the correct settings. You will need to use an editor like vi, vim, nano, pico etc. In this example I will use nano editor. After you start your server running CentOS enter root user credentials and get in. Type the command, # nano /etc/sysconfig/network-scripts/ifcfg-eth0 it will look something like this
2. The settings may look like this
3. Now change the configurations to something like this
4. Save the file in whichever editor your using.
5. Now restart the network services by issuing the command,
[root@hostname~]# service network restart
6. To verify the IP address issue the following command,
[root@hostname~]# ifconfig
7. Next you will want to configure your DNS settings we’ll need to edit the DNS file so we type the command thing is to edit /etc/recolv.conf. Using nano editor to configure DNS information, /etc/recolv.conf. Using nano editor to configure DNS information,
[root@hostname~]# nano /etc/resolv.conf
8. After you save this file, you’ll want to test your connection with a simple command like ping www.bbc.co.uk which should come back with something like this below.
You should be all setup and ready.