Add multiple alias Ethernet interfaces
Posted on 2004-09-24
I need to create 126 alias interfaces of eth1 (eth1:1 - eth1:126).
I know how to do this in the GUI and manually by creating /etc/sysconfig/network-scripts/ifcfg-eth1:1, ifcfg-eth1:2.....
Created a shell script, very simple because I'm not a good at scripting.
for ((i = 2 ; i <=126; i++ ))
cp /etc/sysconfig/network-scripts/ifcfg-eth1:1 /etc/sysconfig/network-scripts/ifcfg-eth1:$i
The script works fine and creates all the files I need. But, I dont want to manually edit all the files to set the Interface name and IP.
Is there a quicker way of creating alias interfaces or could someone help me to create a script that changes the interface and IP automatically?
Also, I tried the use "ifconfig eth1:2 192.168.0.100 netmask 255.255.255.128 up"
Works fine until I restart the server, then all alias interfaces are gone.
Need a quick answer to this one!