linux網卡改名

 今天在測試opennebula,因爲換了這個虛擬網絡,發現啓動的虛擬機的網卡改名了,eth0改爲了eth3

udev: renamed network interface eth0 to eth3

因爲虛擬機的配置是需要通過其他初始化腳本來生成的,所以網卡的設備名不能改變,需要把eth3修改爲eth0

以rhel6爲例,把以下文件作修改如下:

1、把eth0 ,eth1 ,eth2的相關行刪除掉

2、把eth3的相關行保留,並把eth3改爲eth0即可。

 

  1. [root@ovm0246 ~]# vim /etc/udev/rules.d/70-persistent-net.rules  
  2.  
  3. # This file was automatically generated by the/lib/udev/write_net_rules 
  4. # program, run by the persistent-net-generator.rules rules file. 
  5. # You can modify it, as long as you keep each rule on a single 
  6. # line, and change only the value of the NAMEkey
  7.  
  8. # PCI device 0x10ec:0x8139 (8139cp) (custom name provided by external tool) 
  9. SUBSYSTEM=="net"ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:12:34:56", ATTR{type}=="1", KERNEL=="eth*"NAME="eth0" 
  10.  
  11. # PCI device 0x10ec:0x8139 (8139cp) 
  12. SUBSYSTEM=="net"ACTION=="add", DRIVERS=="?*", ATTR{address}=="02:00:c0:a8:14:f9", ATTR{type}=="1", KERNEL=="eth*"NAME="eth1" 
  13.  
  14. # PCI device 0x10ec:0x8139 (8139cp) 
  15. SUBSYSTEM=="net"ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:e4:d4:1d", ATTR{type}=="1", KERNEL=="eth*"NAME="eth2" 
  16. # PCI device 0x10ec:0x8139 (8139cp) 
  17.  
  18. SUBSYSTEM=="net"ACTION=="add", DRIVERS=="?*", ATTR{address}=="02:00:c0:a8:14:fa", ATTR{type}=="1", KERNEL=="eth*"NAME="eth3" 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章