A Web.com Partner
Sign Up / Log In
Online Support Linux Servers

How to assign an IP Address to CentOS Linux Server

This tutorial shows you how to assign an IP Address to your CentOS Linux Server.

Step 1. Log in to the server console as root user.
Step 2. Open the file /etc/sysconfig/network-scripts/ifcfg-eth0 in a text editor, such as VI, if your default network interface is eth0.
assigning dedicated IP addresses to a CentOS Linux server step 2
Step 3. Edit the file and add this information:
assigning dedicated IP addresses to a CentOS Linux server step 3, enter information
Below is a description of the fields:
IP address IPADDR='your IP Address goes here'
Address Subnet Prefix PREFIX='IP Address subnet prefix goes here'
Step 4. Save and restart the network service.
assigning dedicated IP addresses to a CentOS Linux server step 4, restart the network service
Step 5. If you check with the command ifconfig -a, you can see the assigned IP address.
assigning dedicated IP addresses to a CentOS Linux server step 5, checking the IP address with ifconfig -a

Congratulations, you have assigned a hostname IP Address to your CentOS Linux Server.

Was this helpful? Yes No 100% of people found this helpful.
{"message":""}