linux怎样修改网卡名字-创新互联
linux怎样修改网卡名字,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。
为长岭等地区用户提供了全套网页设计制作服务,及长岭网站建设行业解决方案。主营业务为网站设计、网站建设、长岭网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!ifconfig发现网卡名字(eth2、eth3)与配置文件中名字(eth0、eth2)不符,修改如下
一、查看网卡名字对应的HWADDR
[root@linnux ~]# ifconfig -a
eth2 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)
eth3 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-eth2文件,把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="eth2"
四、查看hostname是否正确
[root@node1 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=node1
关于linux怎样修改网卡名字问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注创新互联-成都网站建设公司行业资讯频道了解更多相关知识。
网站标题:linux怎样修改网卡名字-创新互联
URL标题:http://pwwzsj.com/article/pjigd.html