In the course of supporting a CENTOS 6.5 VM guest under VSphere 5.5, I had experienced three different scenarios of losing network connectivity. These scenarios had included a P2V conversion, network driver update (E1000 > VMXNET3), and full VM restore. In each instance, I had begun my adventure typing ping at command prompt interrogating the gateway, ultimately receiving the error “destination unreachable.” With each instance, I had gained a little bit more experience as Windows guy on UNIX. I had hoped summarizing those collective experiences in the steps below.
With respect to CENTOS 6.5 P2V conversion support by VMWare, this was officially untested as of July 2014. For more information on “Using VMware vCenter Converter Standalone to convert physical or virtual CentOS 5.x machines to vSphere 5.1 environments” go to SpiceWorks click here. The scope of these steps had expected an administrator already verifying VM Guest adapter being “enabled” and available. Additionally, I had thought to iterate having the proper VLANs configured in VMWare guest settings and any attached network equipment. So, if you had received “destination unreachable” when pinging your gateway begin with the below:
A. REVIEWING NETWORK INTERFACES
1. Login as root
2. Review active OS network connections, run the command, ip a
Example:
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:50:56:b7:79:ef brd ff:ff:ff:ff:ff:ff
inet 192.24.1.10/24 brd 172.26.253.255 scope global eth0
inet6 fe80::250:56ff:feb7:79ef/64 scope link
valid_lft forever preferred_lft forever
3. Review network adapter IP configuration, go to /etc/sysconfig/network-scripts/
4. List files in the directory with ls command. The listed interface files should match up with the results of #2.
Example:
ifcfg-eth0
ifcfg-lo
5. If an extra or odd numbered interface exist, say ifcfg-eth1, I had recommended making a copy of the file (i.e. cp ifcfg-eth0 backup.ifcfg-eth0).
6. Review the network interface configuration in VI with the command (i.e. vi ifcfg-eth1, vi ifcfg-eth0, etc).
Example of output:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
NM_CONTROLLED=no
IPADDR=172.26.253.10
NETMASK=255.255.255.0
7. To save the file without changes, type :q
8. To make changes, I had recommended going to CSU Basic vi Commands Page to learn the following commands:
I for insert
:wq for save
9. A file that requires changes, focus on two things;
a. the filename (i.e. cp ifcfg-eth6 ifcfg-eth0).
b. Ensure the value DEVICE= matches the necessary interface (i.e. eth0 vs. eth6)
10. After making the necessary changes, restart network server, service network restart.
B. REVIEW DEFAULT GATEWAY CONFIGURATION
11. If you were still unable to ping the gateway, perform route print, route
Example A:
Destination Gateway GenMask Iface default
192.24.10.1 0.0.0.0 UG eth0
Example B:
Destination Gateway GenMask Iface default
192.24.10.1 0.0.0.0 UG eth6
In Example B, the wrong interface is configured. To correct, run the following snippet from/sbin/ route add -net 0.0.0.0 gw 192.24.10.1 eth0
C. IS NETWORK MANAGER STARTED?
12. If ping had continued to fail to gateway, verify Network Manager service status.
13. Verifying Network Manager running on any interfaces, #chkconfig –list Network Manager
Example of output: NetworkManager 0:off 1:off 2:off 3:off 4:off 5:off 6:off
a. To stop NetworkManager service, service NetworkManager sto
b. To disable NetworkManager from running, chkconfig NetworkManageroff
D. DELETING 70-persistent-net.rules file
14. If network interface and default gateway configuration look good, go to etc/udev/rules.d
15. Locate the 70-persistent-net.rules file, this file contains adapter mac addresses and aliases
Example of content:
# 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:0x100f (e1000)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:50:56:b7:79:ef”, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″
# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:50:56:b7:48:89″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth1″
16. Delete this file, when prompted type, Y for YES.
Example:
rm-70-persistent-net.rules.
17. Run reboot command. The file will be recreated after restart (i.e. reboot command).
18. After restart repeat sections A and B to ensure network configuration file and route were properly updated.
Read More:
CentOS 6.3 Device eth0 does not seem to be present (Minimal non-cloned setup) (unix.stackexchange.com)
Disabling Network Manager (redhat.com)
Using VMware vCenter Converter Standalone to convert physical or virtual CentOS 5.x machines to vSphere 5.1 (spiceworks.com)
Basic vi Commands (cs.colostate.edu)