Today, when I configure a network for an Oracle Linux Server release 5.7 Server, I encountered the problem of backing up the ifcfg-eth0 configuration file, which caused the NIC to be unable to bind an IP address. I think this is an interesting case. I would like to record it for your reference to avoid making similar mistakes in the future.
The network is not configured when the system is installed. After the system is installed, the system administrator will learn about the IP address, subnet mask, and gateway information before configuring the network. Back up a configuration file before modifying the ifcfg-eth0 Nic configuration file to avoid the failure to restore to the original configuration due to improper modification. This is also the cause of the incident.
[Root @ localhost ~] # Cd/etc/sysconfig/network-scripts/
[Root @ localhost network-scripts] # cp ifcfg-eth0 ifcfg-eth0_bak
[Root @ localhost network-scripts] # ifcfg-eth0_bak more
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE = eth0
BOOTPROTO = dhcp
HWADDR = 00: 50: 56: 92: 56: 05
ONBOOT = yes
Next, add IP addresses and subnet masks.
[Root @ localhost network-scripts] # vi ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE = eth0
BOOTPROTO = static
# BROADCAST = 192.168.7.255
HWADDR = 00: 50: 56: 92: 56: 05
IPADDR = 192.168.7.222
NETMASK = 255.255.255.0
ONBOOT = yes
TYPE = Ethernet
For more details, please continue to read the 2nd page content:
Recommended reading:
VMware clones CentOS 6.4 and then resets eth0