Setup IP in CentOS

Here is a way to setup IP in CentOS without Plesk

Let’s assume the network interface is eth0. Then there is a file /etc/sysconfig/network-scripts/ifcfg-eth0. This is an eth0 file configuration.

Use vi or other text editor

# vi /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.0.255
HWADDR=00:0C:29:C8:AA:7C
IPADDR=192.168.0.19
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
TYPE=Ethernet

Create Virtual Interface
Create the virtual interface eth0:0 with the IP address 192.168.0.20. Just create the file /etc/sysconfig/network-scripts/ifcfg-eth0:0 (leave out the HWADDR line as it is the same physical network card):

Use vi or other text editor

# vi /etc/sysconfig/network-scripts/ifcfg-eth0:0DEVICE=eth0:0
BOOTPROTO=static
BROADCAST=192.168.0.255
IPADDR=192.168.0.20
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
TYPE=Ethernet

Restart the network
/etc/init.d/network restart

One Comment to “Setup IP in CentOS”

  1. [...] ip address is setup using Plesk Administration site and using same eth0 as a interface (virtual interface), the configuration file will be saved in ifcfg-eth0:1. If base ip in ifcfg-eth0, second ip with [...]


Leave a Reply