I have used Ubuntu6, 7, and 8 on vmware. They all have the following problem: Through DHCP, the DNS server address can be obtained, but it does not work. The result is that the domain name cannot be resolved, and the Internet cannot be accessed unless the IP address is used directly. The solution is not to use DHCP to directly specify a static IP address. Specific Operation: sudosim/etc/resolv. conf, you can see that this file stores the retrieved DNS server address. Delete the first few addresses, leaving only the last one, that is, when
I have used Ubuntu 6, 7, and 8 on vmware. They all have the following problem: Through DHCP, the DNS server address can be obtained, but it does not work. The result is that the domain name cannot be resolved, and the Internet cannot be accessed unless the IP address is used directly.
The solution is not to use DHCP to directly specify a static IP address. Specific operations:
Sudo sim/etc/resolv. conf
The file contains the retrieved DNS server address. Delete the first few addresses, and only the last one is the address of the gateway of the current network. On my machine:
Search domain
Nameserver 192.168.1.1
Then
Sudo vim/etc/network/interfaces
Modify the content of auto eth0:
Auto eth0
Iface eth0 inet static
Address 192.168.1.110
Netmask 255.255.255.0
Gateway 192.168.1.1
Finally, restart the network:
Sudo/etc/init. d/networking restart
Ping the internet.
However, after a period of time, the connection will fail again. At this time, check/etc/resolv. conf and find that it has been modified back. At this time, you can only set/etc/resolv. conf to read-only, so that other programs cannot be modified. You can find the following methods on the Internet:
Sudo chattr + I/etc/resolv. conf
But an error is reported on my machine:
Chattr: Inappropriate ioctl for device while reading flags on/etc/resolv. conf
I use it directly
Sudo chmod a-w/etc/resolv. conf
No problem.
There are several different methods to prevent/etc/resolv. conf from being rewritten. See
Http://blog.csdn.-net/xport/archive/2007/05/03/-1595769. aspx
As for the cause of this problem, I started to think it was a problem with the compatibility between vmware and ubuntu. Later I went online and found that countless people had encountered the same problem, it does not run on the vm, or even FreeBSD. Some people say this is a problem in the nat environment, but my vm does not use nat, but directly connects to the home LAN through bridge. Some people refer to the bug of Ubuntu. If so, it would be too much if so many versions have not been corrected. But Fedora 6 in the same environment does not have this problem.