Home >Operation and Maintenance >CentOS >Centos6.5 system cannot access the Internet

Centos6.5 system cannot access the Internet

王林
王林Original
2020-03-16 11:53:253837browse

Centos6.5 system cannot access the Internet

1. Check the virtual machine settings

Make sure the network connection is working in NAT mode, as shown in the figure:

Centos6.5 system cannot access the Internet

(Recommended tutorial: centos usage tutorial)

2. Modify the DNS address

Switch to the root user, switch to the directory /etc, and modify the resolv.conf file DNS address, add a DNS address such as nameserver:8.8.8.8, where 192.168.61.2 is the gateway IP of my virtual machine. You can ignore this and save and exit. As shown in the picture:

Centos6.5 system cannot access the Internet

After saving, open Firefox and see if you can log in to Baidu. If you can, then it's OK.

However, the contents in the resolv.conf file will be reset after restarting the network service service network restart or restarting the virtual machine.

So if we want the configuration to be retained, we need to modify the network configuration of the virtual machine

3. Modify the network configuration of the virtual machine

Switch to the root user and switch to the directory network- In the scripts directory, cd /etc/sysconfig/network-scripts/

Modify the network configuration file ifcfg-eth0 and add a DNS1="8.8.8.8" to it, as shown in the figure:

Centos6.5 system cannot access the Internet

4. Restart the network service

You can restart the network service through the command service network restart under root authority.

Recommended related video tutorials: linux video tutorial

The above is the detailed content of Centos6.5 system cannot access the Internet. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn