Randomness

Add an IP alias (virtual nic)

Posted on: November 12, 2007

CentOS

Copy your eth0 config file located at /etc/sysconfig/network-scripts/
(you need to be root to do most of these commands)

cd /etc/sysconfig/network-scripts/
cp eth0 eth0:1

Now we need to edit this new file. You will need to …escape.. the colon. Neither eth0 or eth0:1 can be set by DHCP, you must setup a static address. The “HWADDR=” needs to be deleted from eth0:1 since it is the same physical device as eth0.

vi eth0\:1
DEVICE=eth0:1
BOOTPROTO=static
BROADCAST=192.168.0.255
IPADDR=192.168.0.5
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
TYPE=Ethernet

Now you should be able to issue the ifup <device> command to bring up the virtual device and confirm with an ifconfig.

ifup eth0:1
ifconfig

Ubuntu

================================================

UNFINISHED
WILL UPDATE SOON.

Advertisements

1 Response to "Add an IP alias (virtual nic)"

Nice article! I know this is old, but this just saved me tons of time trying to figure out how this worked. Thanks.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: