A small problem occurs in the Test environment, because the virtual machines are often copied to each other, resulting in inconsistent Nic configurations 1. problem description
A small problem occurs in the Test environment because the virtual machines are often copied to each other, resulting in inconsistent Nic configurations.
Configuration file information:
[Root @ ora10g network-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
20174_failure_fatal = no
IPV6INIT = no
NAME = "System eth0"
UUID = 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
HWADDR = 08: 00: 27: BD: A6: ED
[Root @ ora10g network-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
20174_failure_fatal = yes
IPV6INIT = no
NAME = "System eth1"
UUID = 9c92fad9-6ecb-3e6c-eb4d-8a47c6f50c04
HWADDR = 08: 00: 27: 6E: 86: 10
The network adapter names are eth0 and eth1.
However, if we use the ifconfig command to view:
[Root @ ora10g network-scripts] # ifconfig-
Eth2 Link encap: Ethernet HWaddr08: 00: 27: BD: A6: ED
Inet addr: 192.168.1.12 Bcast: 192.168.1.255 Mask: 255.255.255.0
Inet6 addr: fe80: a00: 27ff: febd: a6ed/64 Scope: Link
Up broadcast running multicast mtu: 1500 Metric: 1
RX packets: 187 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 59 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 fig: 1000
RX bytes: 16356 (15.9 KiB) TXbytes: 6116 (5.9 KiB)
Eth3 Link encap: Ethernet HWaddr08: 00: 27: 6E: 86: 10
Inet addr: 192.168.1.13 Bcast: 192.168.1.255 Mask: 255.255.255.0
Inet6 addr: fe80: a00: 27ff: fe6e: 8610/64 Scope: Link
Up broadcast running multicast mtu: 1500 Metric: 1
RX packets: 1357 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 1099 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 fig: 1000
RX bytes: 120604 (117.7 KiB) TXbytes: 115937 (113.2 KiB)
Lo Link encap: Local Loopback
Inet addr: 127.0.0.1 Mask: 255.0.0.0
Inet6 addr: 1/128 Scope: Host
Up loopback running mtu: 16436 Metric: 1
RX packets: 8 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 8 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX bytes: 480 (480.0 B) TXbytes: 480 (480.0 B)
The NIC names here are eth2 and eth3.
II. Solution
Modify the ing relationships in the/etc/udev/rules. d/70-persistent-net.rules file.
-- Before modification:
[Root @ ora10g network-scripts] # cat/etc/udev/rules. d/70-persistent-net.rules
# This file was automatically generated bythe/lib/udev/write_net_rules
# Program, run by thepersistent-net-generator.rules rules file.
#
# You can modify it, as long as you keepeach rule on a single
# Line, and change only the value of theNAME = key.
# PCI device 0x8086: 0x100e (e1000)
SUBSYSTEM = "net", ACTION = "add", DRIVERS = "? * ", ATTR {address} =" 08: 00: 27: d4: AB: 67 ", ATTR {type} =" 1 ", KERNEL = "eth *", NAME = "eth1"
# PCI device 0x8086: 0x100e (e1000)
SUBSYSTEM = "net", ACTION = "add", DRIVERS = "? * ", ATTR {address} =" 08: 00: 27: af: 2b: 37 ", ATTR {type} =" 1 ", KERNEL = "eth *", NAME = "eth0"
# PCI device 0x8086: 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"
# PCI device 0x8086: 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"
-- After modification:
[Root @ ora10g network-scripts] # cat/etc/udev/rules. d/70-persistent-net.rules
# This file was automatically generated bythe/lib/udev/write_net_rules
# Program, run by thepersistent-net-generator.rules rules file.
#
# You can modify it, as long as you keepeach rule on a single
# Line, and change only the value of theNAME = key.
# PCI device 0x8086: 0x100e (e1000)
SUBSYSTEM = "net", ACTION = "add", DRIVERS = "? * ", ATTR {address} =" 08: 00: 27: 6E: 86: 10 ", ATTR {type} =" 1 ", KERNEL = "eth *", NAME = "eth1"
# PCI device 0x8086: 0x100e (e1000)
SUBSYSTEM = "net", ACTION = "add", DRIVERS = "? * ", ATTR {address} =" 08: 00: 27: BD: A6: ED ", ATTR {type} =" 1 ", KERNEL = "eth *", NAME = "eth0"
Note that the MAC address here should be consistent with the ifcfg-eth0.
Restart the NIC and udev:
-- Ifdown Nic:
Ifdown eth0
Ifdown eth1
-- Restart udev
/Etc/init. d/udev-post stop;
/Etc/init. d/udev-post start
Or use:
Service udev-post stop
Service udev-post start
Note: For Oracle linux, it is udev-post, and redhat is udev.
-- Ifup:
Ifup eth0
Ifup eth1
However, in my test, none of these two items worked. I restarted the entire OS to take effect. Small knowledge.