Sunday, August 11, 2013

Fix lỗi không vào mạng khi clone centos với VMware

Cách 1:
At first, I checked the configuration of its NIC
$ ping www.google.com
ping: nuknown host www.google.com 
$ cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
HWADDR="00:50:56:B0:7F:24"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE=Ethernet
BOOTPROTO=static
IPADDR=192.168.20.174
NETMASK=255.255.255.0
DNS=168.126.63.1
DNS=168.126.63.2
GATEWAY=192.168.20.1
IPV6INIT=no

then, I restarted network of the VM.
$ service network restart
....
Bringing up interface eth0: Device eth0 does not seem to be present, defining initialization                                                [FAILED]



I found a post which include how to solve it. According to a post: http://aaronwalrath.wordpress.com/2011/02/26/cloned-red-hatcentosscientific-linux-virtual-machines-and-device-eth0-does-not-seem-to-be-present-message/, 

It was said like the following: 
"As it turns out there is a device manager for the Linux kernel named 'udev' which remembers the settings from the NIC of the virtual machine before it was cloned.  I was not familiar with udev because it was not installed in my previous Linux VM install, which were mainly CentOS 5."

I checked network device again.
$ ls /sys/class/net/
eth1   lo

It was wrong information. I intended that I added the NIC named "eth0". 

To solve this, I had to changed some information in /etc/udev/rules.d/70-persistent-net.rules file and in /etc/sysconfig/network-scripts/ifcfg-eth0.

1) Replace value of "ATTR{address} of "eth0 with the value of "eth1"
$ vi /etc/udev/rules.d/70-persistent-net.rules
.......
# PCI device 0x15ad:0x07b0 (vmxnet3) 
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}== "00:50:56:B0:7F:24", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
     -> wrong info.

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:8e:27:fe", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"            -> right info. 


My /etc/udev/rules.d/70-persistent-net.rules file was modified. 
$ cat /etc/udev/rules.d/70-persistent-net.rules
....
# PCI device 0x15ad:0x07b0 (vmxnet3) 
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}== " 00:50:56:8e:27:fe", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

2) Change NIC's mac address with the same value of above case.
$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
HWADDR=" 00:50:56:8e:27:fe"
NM_CONTROLLED="no"
.....

3) Restart the VM.

The network of the VM worked as "eth0" after reboot.

Cách 2:
After clone the VM within Virtual box, I receive the error message “
Device eth0 does not seem to be present, delaying initialization.” when start the network service.
image
The /etc/sysconfigu/network-scripts/ifcfg-eth0 does exist. The issue is that the network device eth0 is non longer exist. The VM clone processes create the new device eth1.
The device file is at /sys/class/net.
ip link show
image
We can rename the device by using the up command.
ip link set eth1 name eth0
image
After the device being renamed, we can successfully bring up the network interface.

Related Posts:

  • REGULARLY FLUSHING THE MYSQL QUERY CACHE When we analyze our customers systems we see typically a high fragmentation of the query cache after a while. This leads to a less optimal use of the Query Cache than possible. With the following Query you can see the value… Read More
  • 20 công cụ theo dõi hệ thống linux#1: top - Process Activity CommandThe top program provides a dynamic real-time view of a running system i.e. actual process activity. By default, it displays the most CPU-intensive tasks running on the server and updates the … Read More
  • Giới thiệu về Unix processLà một kỹ sư lập trình hệ thống, một server guy, hay là một sys admin, sys dev, sys ops,… phần lớn thời gian bạn sẽ phải làm việc trên hệ thống Unix. Để làm việc trên Unix, chúng ta tương tác với hệ điều hành thông qua các… Read More
  • Một số lệnh check ddos Mã:netstat -n | grep :80 |wc -lKiểm tra số lượng connection đang ở trạng thái SYN_RECV:Mã:netstat -n | grep :80 | grep SYN_RECV|wc -lHiển thị tất cả các IP đang kết nối và số lượng kết nối từ mỗi IP:Mã:netstat -an|grep :80 … Read More
  • Sử dụng sar(Sysstat) cho Linux/Unix để giám sát hiệu suất hoạt động Chúng ta không thể cứ kè kè canh chừng chiếc máy tính khi chúng hoạt động. Bạn muốn biết chúng hoạt động như thế nào trong từng khoảng thời gian?? Sử dụng sar có thể giúp bạn thu thập dữ liệu, hiệu suất hoạt đ… Read More