|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的小伙伴们!一.成绩申明
测试情况中呈现的小成绩,由于假造机之间常常复制来复制往,招致网卡设置这块的纷歧致征象。
设置文件的信息:
[root@ora10gnetwork-scripts]#catifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.1.12
PREFIX=24
GATEWAY=192.168.1.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
NAME="Systemeth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
HWADDR=08:00:27:BD:A6:ED
[root@ora10gnetwork-scripts]#catifcfg-eth1
DEVICE="eth1"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.1.13
PREFIX=24
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="Systemeth1"
UUID=9c92fad9-6ecb-3e6c-eb4d-8a47c6f50c04
HWADDR=08:00:27:6E:86:10
这里对应的是网卡称号是eth0和eth1.
可是假如我们利用ifconfig下令检察:
[root@ora10gnetwork-scripts]#ifconfig-a
eth2Linkencap:EthernetHWaddr08:00:27:BD:A6:ED
inetaddr:192.168.1.12Bcast:192.168.1.255Mask:255.255.255.0
inet6addr:fe80::a00:27ff:febd:a6ed/64Scope:Link
UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
RXpackets:187errors:0dropped:0overruns:0frame:0
TXpackets:59errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:16356(15.9KiB)TXbytes:6116(5.9KiB)
eth3Linkencap:EthernetHWaddr08:00:27:6E:86:10
inetaddr:192.168.1.13Bcast:192.168.1.255Mask:255.255.255.0
inet6addr:fe80::a00:27ff:fe6e:8610/64Scope:Link
UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
RXpackets:1357errors:0dropped:0overruns:0frame:0
TXpackets:1099errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:120604(117.7KiB)TXbytes:115937(113.2KiB)
loLinkencap:LocalLoopback
inetaddr:127.0.0.1Mask:255.0.0.0
inet6addr:::1/128Scope:Host
UPLOOPBACKRUNNINGMTU:16436Metric:1
RXpackets:8errors:0dropped:0overruns:0frame:0
TXpackets:8errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:0
RXbytes:480(480.0b)TXbytes:480(480.0b)
这里的网卡称号是eth2和eth3.
二.办理***
修正/etc/udev/rules.d/70-persistent-net.rules文件中的映照干系就能够了。
--修正之前:
[root@ora10gnetwork-scripts]#cat/etc/udev/rules.d/70-persistent-net.rules
#Thisfilewasautomaticallygeneratedbythe/lib/udev/write_net_rules
#program,runbythepersistent-net-generator.rulesrulesfile.
#
#Youcanmodifyit,aslongasyoukeepeachruleonasingle
#line,andchangeonlythevalueoftheNAME=key.
#PCIdevice0x8086:0x100e(e1000)
SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="08:00:27:d4:ab:67",ATTR{type}=="1",KERNEL=="eth*",NAME="eth1"
#PCIdevice0x8086:0x100e(e1000)
SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="08:00:27:af:2b:37",ATTR{type}=="1",KERNEL=="eth*",NAME="eth0"
#PCIdevice0x8086:0x100e(e1000)
SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="08:00:27:bd:a6:ed",ATTR{dev_id}=="0x0",ATTR{type}=="1",KERNEL=="eth*",NAME="eth2"
#PCIdevice0x8086:0x100e(e1000)
SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="08:00:27:6e:86:10",ATTR{dev_id}=="0x0",ATTR{type}=="1",KERNEL=="eth*",NAME="eth3"
--修正以后:
[root@ora10gnetwork-scripts]#cat/etc/udev/rules.d/70-persistent-net.rules
#Thisfilewasautomaticallygeneratedbythe/lib/udev/write_net_rules
#program,runbythepersistent-net-generator.rulesrulesfile.
#
#Youcanmodifyit,aslongasyoukeepeachruleonasingle
#line,andchangeonlythevalueoftheNAME=key.
#PCIdevice0x8086:0x100e(e1000)
SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="08:00:27:6E:86:10",ATTR{type}=="1",KERNEL=="eth*",NAME="eth1"
#PCIdevice0x8086:0x100e(e1000)
SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="08:00:27:BD:A6:ED",ATTR{type}=="1",KERNEL=="eth*",NAME="eth0"
注重这里的MAC地点要和ifcfg-eth0坚持分歧。
然后重启一下网卡和udev:
--ifdown网卡:
ifdowneth0
ifdowneth1
--重启udev
/etc/init.d/udev-poststop;
/etc/init.d/udev-poststart
大概利用:
serviceudev-poststop
serviceudev-poststart
注重:对与Oraclelinux是udev-post,而redhat是udev
--ifup:
Ifupeth0
Ifupeth1
不外在我的测试中,这2个都没无效果,我是把全部OS都重启了,才失效的。小常识,漫笔记之。
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们! |
|