Today encountered a strange problem: the installation of a centos6.6, after the installation of the default DHCP to obtain the IP address, found to be able to surf the internet, get the IP address of 192.168.0.131/24, because it is installed server, so it is intended to set this address as a static IP address, The use of Yum found that the connection is not up, and later found that the system is unable to surf the internet.
Check long time, found Ping 8.8.8.8 is can ping pass, but Ping www.baidu.com can't ping pass, then I go to change/etc/resolv.conf inside add nameserver 192.168.0.1 Restart Network, or can not surf the internet, see vi/etc/resolv.conf found inside added nameserver 192.168.0.1 and deleted, on-line find " here to emphasize a point is, directly modify/etc/ resolv.conf This file is useless, network service restart will be based on/etc/sysconfig/network-scripts/ifcfg-eth0 to reload the configuration, if Ifcfg-eth0 does not configure DNS, Then resolv.conf will be washed away and re-converted into null values. "
Then go to configure DNS, in the system-preferences-network connection, go to "IPv4 Settings" inside add DNS server to the gateway address, because we do not have a DNS server, so Add "192.168.0.1", or go "/etc/sysconfig/ Network-scripts/ifcfg-eth0 "Add" dns1=192.168.0.1 ", restart the network" service network restart "After the effective, you can surf the Internet.
To see/etc/resolv.conf
[Email protected] ~]# cat/etc/resolv.conf
# Generated by NetworkManager
NameServer 192.168.0.1
Discover that NameServer has added nameserver 192.168.0.1
To this network configuration is complete.
This article is from the "Summit" blog, make sure to keep this source http://786678398.blog.51cto.com/2082557/1587622
Linux DHCP get IP address can surf the Internet, set a static IP address is not Internet access