修改aix网卡顺序名


   做10g rac时有一些系统配置基本要求,比如网卡名一致。在rmdev,cfgmgr不能达到改网卡名的情况下, 
这里提供另外一个修改网卡名的方法来达到修改entX的对应关系 

  注意:备份odm库先,改坏了就没得玩了 
  把odm中的en信息get出来,用sed等处理下再add回去 。@_@就贴原文了. 

First, get all the information about the adapters. 

for i in ent0 ent1 ent2 
do 
odmget -q name="$i" CuDv >> /tmp/$i 
odmget -q name="$i" CuAt >> /tmp/$i 
odmget -q name="$i" CuVPD >> /tmp/$i 
done 


Next, down the interfaces and detach them. 

for i in en0 en1 en2 et0 et1 et2 
do 
ifconfig $i down 
ifconfig $i detach 
done 

Now, remove all the references to the devices from the ODM 

for i in ent0 ent1 ent2 en0 en1 en2 et0 et1 et2 
do 
odmdelete -q name="$i" -o CuAt 
odmdelete -q name="$i" -o CuDv 
odmdelete -q name="$i" -o CuVPD 
odmdelete -q value3="$i" -o CuDvDr 
done 

for i in ent1 ent2 en1 en2 et1 et2 
do 
odmdelete -q name="$i" -o CuAt 
odmdelete -q name="$i" -o CuDv 
odmdelete -q name="$i" -o CuVPD 
odmdelete -q value3="$i" -o CuDvDr 
done 

We can verify that no adapters and no interfaces exist now by issuing the lsdev commands again. All we should see is the loopback interface. 

lsdev -Cc adapter -l ent* 
lsdev -Cc if 
lo0 Available Loopback Network Interface 

Edit the files we created the first step and replace every instance of the adapter name with the new adapter name. For instance, I would edit /tmp/ent0 and replace all instances of "ent0? with "ent2?. We can do this with a sed script. 

sed -e "s/ent0/ent1/g" /tmp/ent0 > /tmp/ent1.new 
sed -e "s/ent1/ent2/g" /tmp/ent1 > /tmp/ent2.new 
sed -e "s/ent2/ent0/g" /tmp/ent2 > /tmp/ent0.new 

Then add the files back to the ODM. 

odmadd /tmp/ent0.new 
odmadd /tmp/ent1.new 
odmadd /tmp/ent2.new 

At this point, our adapters will now be redefined. Issue another lsdev command to check: 

lsdev -Cc adapter -l ent* 
ent0 Available 05-08 10/100/1000 Base-TX PCI-X Adapter (14106902) 
ent1 Available 07-08 2-Port 10/100/1000 Base-TX PCI-X Adapter (14108902) 
ent2 Available 07-09 2-Port 10/100/1000 Base-TX PCI-X Adapter (14108902) 

You can see now that ent0 is now the external PCI-X adapter and ent1 and ent2 are the two onboard adapters. But, we still have no interfaces for the adapters. You can verify this by issuing the usual lsdev command again. You should only see the loopback interface. 

lsdev -Cc if 
lo0 Available Loopback Network Interface 

To fix this ( and to make sure our changes stick upon a reboot… ), run a cfgmgr, then check for our interfaces. 

cfgmgr 
lsdev -Cc if 
en0 Defined 05-08 Standard Ethernet Network Interface 
en1 Defined 07-08 Standard Ethernet Network Interface 
en2 Defined 07-09 Standard Ethernet Network Interface 
et0 Defined 05-08 IEEE 802.3 Ethernet Network Interface 
et1 Defined 07-08 IEEE 802.3 Ethernet Network Interface 
et2 Defined 07-09 IEEE 802.3 Ethernet Network Interface 
lo0 Available Loopback Network Interface 

As you can see, we have successfully gotten our interfaces back. We’re almost done! All you need to do now is reboot the system. 

shutdown -Fr 

Once the reboot has completed, issue one last check to verify that the adapters have changed: 

entstat -d ent0 | grep "Device Type" 
Device Type: 10/100/1000 Base-TX PCI-X Adapter (14106902)