Linux DHCP get IP address can surf the Internet, set a static IP address is not Internet access

Source: Internet
Author: User
Tags get ip nameserver

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.