Quote:
Originally Posted by Neelabha Banerjee
Hello Experts,
I wanted to add alias IP to my ifcfg-eth0 ... i searched the net (as i lack knowledge in this area)and found the following command which i executed
echo -e "IPADDR_0=192.168.0.1\n
> NETMASK_0=255.255.255.128\n
> LABEL_0=0\nPREFIXLEN_0=''" >> /etc/sysconfig/network/ifcfg-eth0
which seems to work fine and if i do ifconfig i can see an entry for eth0:0
Now one to add another entry ... can i execute something like this (below)... will it create eth0:1
echo -e "IPADDR_1=192.168.0.2\n
> NETMASK_1=255.255.255.128\n
> LABEL_1=1\nPREFIXLEN_1=''" >> /etc/sysconfig/network/ifcfg-eth0
I would appreciate if you can validate whether its the right way (right command).
|
While you CAN do it that way...I wouldn't. The proper way to configure the interface is with the ifconfig (interface configuration), command. Read the man page on it.
All you're doing is editing the files in /etc/sysconfig/network with echo statements...which could lead to problems, since you're just shoving stuff in there at the end, without knowing what's above it. You CAN edit those files with any editor, too (as root, of course), which would be a safer method.