linux修改網路卡名字
ifconfig發現網路卡名字(eth1、eth2)與配置檔案中名字(eth0、eth1)不符,修改如下
一、檢視網路卡名字對應的HWADDR
[root@linnux ~]# ifconfig -a
eth1 Link encap:Ethernet HWaddr 08:00:27:14:87:06
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe14:8706/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:658 errors:0 dropped:0 overruns:0 frame:0
TX packets:527 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:65027 (63.5 KiB) TX bytes:78666 (76.8 KiB)
eth2 Link encap:Ethernet HWaddr 08:00:27:3E:94:DC
inet addr:172.168.1.2 Bcast:172.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe3e:94dc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:35 errors:0 dropped:0 overruns:0 frame:0
TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5599 (5.4 KiB) TX bytes:7155 (6.9 KiB)
二、編輯ifcfg-eth0檔案和ifcfg-eth1檔案,把MAC改為正確的,把UUID刪掉
[root@node1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.1.2
PREFIX=24
GATEWAY=192.168.1.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="eth0"
#UUID=1976d3c7-b6fa-4002-8738-f370de6eddd6
ONBOOT=yes
HWADDR=08:00:27:14:87:06
LAST_CONNECT=1498051708
三、檢視檔案70-persistent-net.rules進行修改,網路卡名字要和MAC地址對應
[root@node1 ~]# cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x8086:0x100e (e1000)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:41:05:c4", ATTR{type}=="1" , KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:14:87:06", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:3e:94:dc", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
四、檢視hostname是否正確
[root@node1 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=node1
一、檢視網路卡名字對應的HWADDR
[root@linnux ~]# ifconfig -a
eth1 Link encap:Ethernet HWaddr 08:00:27:14:87:06
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe14:8706/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:658 errors:0 dropped:0 overruns:0 frame:0
TX packets:527 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:65027 (63.5 KiB) TX bytes:78666 (76.8 KiB)
eth2 Link encap:Ethernet HWaddr 08:00:27:3E:94:DC
inet addr:172.168.1.2 Bcast:172.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe3e:94dc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:35 errors:0 dropped:0 overruns:0 frame:0
TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5599 (5.4 KiB) TX bytes:7155 (6.9 KiB)
二、編輯ifcfg-eth0檔案和ifcfg-eth1檔案,把MAC改為正確的,把UUID刪掉
[root@node1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.1.2
PREFIX=24
GATEWAY=192.168.1.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="eth0"
#UUID=1976d3c7-b6fa-4002-8738-f370de6eddd6
ONBOOT=yes
HWADDR=08:00:27:14:87:06
LAST_CONNECT=1498051708
三、檢視檔案70-persistent-net.rules進行修改,網路卡名字要和MAC地址對應
[root@node1 ~]# cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x8086:0x100e (e1000)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:41:05:c4", ATTR{type}=="1" , KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:14:87:06", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:3e:94:dc", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
四、檢視hostname是否正確
[root@node1 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=node1
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29618264/viewspace-2141100/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux Ubuntu 修改網路卡名字LinuxUbuntu
- Linux修改網路卡的名字Linux
- 如何修改linux的網路卡mac地址LinuxMac
- 網路卡MAC修改Mac
- Linux 修改網路卡裝置名(interface name)Linux
- Linux下修改網路卡名稱(centos6.5)LinuxCentOS
- linux 批量修改檔名字尾名命令renameLinux
- 修改+asm的名字!ASM
- CentOS 8 修改網路卡名稱CentOS
- CentOS 6.5 修改網路卡配置資訊CentOS
- Git修改分支的名字Git
- Linux 網路卡配置Linux
- Linux網路卡teamLinux
- go: 修改應用的名字Go
- centos6 修改網路卡名指令碼CentOS指令碼
- intel 82754L網路卡修改MAC地址IntelMac
- 修改RHEL6.3的網路卡名稱
- 如果修改VMware下的網路卡MAC地址Mac
- 怎麼修改MAC電腦名字,三步教你修改MAC電腦的名字Mac
- Linux網路卡繫結Linux
- linux 網路卡繫結Linux
- LINUX網路卡檢查Linux
- 麒麟系統修改網路卡名步驟和網路卡佔用故障處理
- Linux系統自定義網路卡並更改網路卡介面Linux
- Linux系統新增自定義網路卡並更改網路卡介面Linux
- oracle 11g 修改資料庫名字和例項名字Oracle資料庫
- 【LINUX】Linux網路卡繫結探析Linux
- Mac Linux 重啟網路卡MacLinux
- LINUX下手工新增網路卡Linux
- Linux(09):網路卡繫結Linux
- Linux 7 配置網路卡(nmcli)Linux
- linux雙網路卡繫結Linux
- Linux雙網路卡聚合改造Linux
- Linux 繫結雙網路卡Linux
- Linux檢視網路卡流量Linux
- Linux 雙網路卡繫結Linux
- Linux物理網路卡bondingLinux
- Linux命令----分析網路卡流量Linux