Remove Network Interfaces and Configure Again on AIX / VIOS

Remove Network Interfaces and Configure again on AIX / VIOS

AIX Operating System offers command line to remove the Network IP address configured over interfaces and then reconfigure it back. For example you have configured SEA backed by Ether Channel as a real adapter and now your requirement is to remove SEA and Ether Channel and configure SEA backed by Real Physical adapter.



Removing and Re-configuring the network adapter is simple and requires LPAR / VIOS network may go off but it can be gained back with in 5 minutes of downtime.

Suppose assuming AIX / VIOS is having network interface from ent0 upto ent999. To remove thousand interfaces below is the script

#!/usr/bin/ksh

echo "Listing the network devices"
lsdev | grep ent
echo "Listing the network devices"
sleep 10
echo "Removing the network Interface"
index=0
while [[ $index -lt 5 ]]; do
        i=999
        while [[ $i -gt -1 ]]; do
                rmdev -dl `echo en${i}`
                rmdev -dl `echo et${i}`
                rmdev -dl `echo ent${i}`
                i=` expr $i - 1`
        done
        index=` expr $index + 1`
done 
echo "Done Removing the interface"
echo "Refreshing the Network Devices"
cfgmgr
echo "Done Refreshing the Network Devices"
echo "Listing the network devices"
lsdev | grep ent
echo "Listing the network devices"

 If needed the above yellow highlighted index can be changed from 999 to any value depending the number of network interfaces present in the AIX/ Logical Partition. The command cfgmgr will refresh the network devices and lsdev | grep ent will display the network devices.

Post a Comment

0 Comments