Just another WordPress.com site

Network Card Settings in CentOS/RHEL

How to create Virtual (alias) Interface for Ethernet in Linux

 Why do we need multiple Alias Interfaces?

Ex :  Let me consider hosting multiple Website/FTP sites on a Single server and each website to be accessed using a different IP address. In this case, let me consider we need to host 10 websites each one to be access with a different IP address,  then we need 10 NIC cards with one IP address each on the Card which results in increased cost, space and maintenance. This can be overcome with a single Physical Network card with multiple Virtual Interfaces. Here all virtual NIC will share the MAC address of eth0 physical interface.

Case 1 :

To create a range of alias interfaces

Create the following /etc/sysconfig/network-scripts/ifcfg-eth0-range0:

IPADDR_START=<start ip address>
IPADDR_END=M<end IP address>
NETMASK=<network mask>

Example :


 Here alias interfaces will be created starting from eth0:0 to eth0:10, eth0:0 will be having to eth0:10 will be having ip address

/etc/rc.d/init.d/network restart

Case 2:

Let me consider a requirement with only one alias network card.

Here we can follow the below steps

# cp /etc/sysconfig/network-scripts/ifcfg-eth0  /etc/sysconfig/network-scripts/ifcfg-eth0:0

# vi /etc/sysconfig/network-scripts/ifcfg-eth0:0

Replace line DEVICE=eth0 to DEVICE=eth0:0 and change the IPADDRESS as per the requirement and

# /etc/init.d/network restart

If you want the virtual IP address come up on boot, you need to replace




 This makes the interface only come up when the parent interface comes up, while ONBOOT=YES would pull up the parent interface even if that is configured to not come up on boot.

To make the changes take effect please restart the network services using:

# /etc/init.d/network restart


Setup Speed/Duplex settings on a network card in CentOS/Redhat 5.x

 Verify the required packages are installed

# rpm –qa ethtool net-tools
If not already installed, follow the below command

#yum install ethtool net-tools

Add line to the configuration file of the network card, like /etc/sysconfig/network-scripts/ifcfg-eth0

ETHTOOL_OPTS=”autoneg off speed 1000 duplex full”

Execute the below commands to make the changes take effect.

Note : Before doing this change, verify if your switch supports this configuration. Else your network cards will not function anymore.

#ifdown eth0

#ifup eth0

To verify the changes

# ethtool eth0   

For temporary change with ethtool, execute the below command:

# ethtool -s eth0 speed 1000 duplex full

For temporary change with mii-tool, execute the below command:

Disable auto-negotiation, and force the MII to 1000baseTx-FD

# mii-tool -F 1000baseTx-FD


One response to “Network Card Settings in CentOS/RHEL

  1. Chester March 17, 2013 at 8:00 am

    Hello, everything is going nicely here and ofcourse every one
    is sharing facts, that’s actually good, keep up writing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: