Guides & Tutorials

hosting image

Configure Static IP Address in CentOS

You have to follow these steps to configure static IP address in CentOS. You must required static IP if you want to upload SSL certificate on VPS (virtual private server).

Files that need network configuration are under /etc/sysconfig/network-scripts. So open the file with editor nano.

After you start your server running CentOS login as a root user. Type the command.

# nano /etc/sysconfig/network-scripts/ifcfg-eth0

Now you will see the default configuration.

blank

Change the configuration like this.

blank

Then save the file by pressing ctrl+x to exit and press y for confirmation.

Now restart the network services by this command.

[root@hostname~]# service network restart

Now verify the IP address by the following command.

[root@hostname~]# ifconfig

Following information will appear in front of you.

blank

After configuring IP address now configure DNS. DNS information is stored in different file. The location is, /etc/recolv.conf. By using nano editor type following command.

[root@hostname~]# nano /etc/resolv.conf

By default, this file is empty, so enter at least one line here,

nameserver 4.2.2.2

The name server IP address may be different its depending on your network scenario. I am using “www.google.com”. Now save the file and exit. You can test the configuration by ping command.

[root@hostname~]# ping www.google.com

You have successfully configured the IP address and DNS information.

To install Apache on cenOS 7 click here.