2015/07/18

Published 7月 18, 2015 by

修改Linux 網卡ethx的對應

OS: RHEL6.5_X64
透過虛擬機常會出現虛擬網卡,因為變更或新增網卡之後,eth0、eth1、eth2…常會變更,導致系統通常不是抓到eth0,或者他的對應變來變去,變更方法如下:

一、修改此檔案, /etc/udev/rules.d/70-persistent-net.rules ,把不要的網卡刪除掉
二、到網卡的設定檔去做修改mac的對應


#vi /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, probably run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.
# MAC addresses must be written in lowercase.

# Firewire device 000ac606203a402e (ohci1394)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:0d:a4:e5:02:44:e0:62", NAME="eth0"

# PCI device 0x8086:0x119b (e1000)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:26:d3:32:a3:c8", NAME="eth1"


Note: 如果有多張網卡,還是會跑來跑去,可以在這邊來做定義試試
/etc/modprobe.d/aliases 中加上
alias eth0 e1000
alias eth1 tulip


Reference:
http://wiki.debian.org.hk/w/Fix_network_interface_name

http://blog.xuite.net/happyman/tips/16199196-%5Bubuntu%5D+udev+%E5%9B%BA%E5%AE%9A+netowrk+device+name

Read More