修改RHEL6.3的網路卡名稱
From:
正常來說,linux在識別網路卡時第一張會是eth0,第二張才是eth1。在這裡成這樣是因為複製系統的過程中複製的檔案已經有一個網路卡在/etc/udev/rules.d/70-persistent-net.rules被識別成了eth0,而虛擬機器中的識別成了eth1。
解決方法是:
編輯/etc/udev/rules.d/70-persistent-net.rules
找到與ifconfig -a得出的MAC相同的一行(NAME='eth1'這一行),把它改為"NAME=eth0 ",然後把上面一行(NAME='eth0')刪除掉。
編輯/etc/sysconfig/network-script/ifcfg-eth0
把MAC改為正確的,把UUID刪掉。
編輯/etc/sysconf/network,把hostname也改一下。
重啟生效!
say you have two nics installed on the system, eth0, and eth1.
At some times latter, you removed eth0 from the system.
Now eth1 is the only nic in your machine... and you want to rename this nic(eth1) as eth0.
following are the steps:
# rcnetwork stop
# vi /etc/udev/rules.d/30-net_persistent_names.rules
here you find a line as
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k eth1"
simply change eth1, as eth0,
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k eth0"
save and exit
Now execute the following command
# /lib/udev/rename_netiface
i.e
# /lib/udev/rename_netiface eth1 eth0
# rcnetwork start
DONE
even we can give any valid name to our nic, say e.g we want to name our eth0 as lan0, then
# rcnetwork stop
# vi /etc/udev/rules.d/30-net_persistent_names.rules
here you find a line as
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k eth0"
simply change eth1, as lan0,
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k lan0"
Now execute the following command
# /lib/udev/rename_netiface eth0 lan0
NOTE:
say we gave our nic a name as lanX, nicX, or intX(i.e non ethX name), and then want to change the name from lan0 to eth0, all the above steps are required, and reboot too.
正常來說,linux在識別網路卡時第一張會是eth0,第二張才是eth1。在這裡成這樣是因為複製系統的過程中複製的檔案已經有一個網路卡在/etc/udev/rules.d/70-persistent-net.rules被識別成了eth0,而虛擬機器中的識別成了eth1。
解決方法是:
編輯/etc/udev/rules.d/70-persistent-net.rules
找到與ifconfig -a得出的MAC相同的一行(NAME='eth1'這一行),把它改為"NAME=eth0 ",然後把上面一行(NAME='eth0')刪除掉。
編輯/etc/sysconfig/network-script/ifcfg-eth0
把MAC改為正確的,把UUID刪掉。
編輯/etc/sysconf/network,把hostname也改一下。
重啟生效!
say you have two nics installed on the system, eth0, and eth1.
At some times latter, you removed eth0 from the system.
Now eth1 is the only nic in your machine... and you want to rename this nic(eth1) as eth0.
following are the steps:
# rcnetwork stop
# vi /etc/udev/rules.d/30-net_persistent_names.rules
here you find a line as
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k eth1"
simply change eth1, as eth0,
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k eth0"
save and exit
Now execute the following command
# /lib/udev/rename_netiface
i.e
# /lib/udev/rename_netiface eth1 eth0
# rcnetwork start
DONE
even we can give any valid name to our nic, say e.g we want to name our eth0 as lan0, then
# rcnetwork stop
# vi /etc/udev/rules.d/30-net_persistent_names.rules
here you find a line as
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k eth0"
simply change eth1, as lan0,
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k lan0"
Now execute the following command
# /lib/udev/rename_netiface eth0 lan0
NOTE:
say we gave our nic a name as lanX, nicX, or intX(i.e non ethX name), and then want to change the name from lan0 to eth0, all the above steps are required, and reboot too.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27042095/viewspace-1098613/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- CentOS 8 修改網路卡名稱CentOS
- 【DB寶51】CentOS7修改網路卡名稱CentOS
- RockyLinux9,RHEL9修改統一的網路卡名稱Linux
- Fedora網路介面名稱如何修改?Fedora修改網路介面名稱的方法
- 更改Linux系統的網路卡名稱Linux
- CentOS 6.X怎麼更改網路卡名稱?CentOS 6.X更改網路卡名稱的方法CentOS
- 網路卡配置及對應名稱
- 網站上修改公司名稱的方法網站
- centos6 修改網路卡名指令碼CentOS指令碼
- 更改 RHEL7 或者 CentOS 7 的網路卡名稱CentOS
- centos7的網路卡名修改為eth0CentOS
- 網站上怎麼修改公司名稱?網站
- 麒麟系統修改網路卡名步驟和網路卡佔用故障處理
- 帝國cms網站名稱修改不成功,如何在帝國CMS中成功修改網站名稱網站
- Git修改檔名稱Git
- git修改檔案的名稱Git
- Linux修改網路卡的名字Linux
- 網站後臺的使用者名稱修改?dw怎樣修改網站模板?網站
- 修改zabbix的web平臺名稱Web
- sqlserver修改例項名稱SQLServer
- ubuntu修改主機名稱Ubuntu
- 公司網站使用者名稱密碼修改?網站密碼
- Centos系統更換網路卡名稱為eth0教程CentOS
- WPS 修改新建office 檔名稱
- nid修改資料庫名稱資料庫
- ***批次修改資料夾名稱
- Linux Ubuntu 修改網路卡名字LinuxUbuntu
- PowerShell快速修改多個檔案的名稱
- Python自動批次修改檔名稱的方法Python
- react-native 修改專案名稱React
- github修改使用者名稱Github
- VS2017修改專案名稱
- kvm 修改虛擬機器名稱虛擬機
- 用NID修改資料庫名稱資料庫
- 如何修改MySQL資料庫名稱MySql資料庫
- 使用mmv命令批次修改檔名稱
- 修改git遠端倉庫分支名稱Git
- 修改 Ubuntu 系統使用者名稱和登入名Ubuntu
- oracle中的某一個使用者名稱修改Oracle