Home>Article>Operation and Maintenance> Unable to ping external network under linux

Unable to ping external network under linux

王林
王林 Original
2019-12-18 09:30:21 3747browse

Unable to ping external network under linux

1. Check carefully to make sure the network card mode of the virtual machine is selected correctly. For the physical environment, use a router to select the bridge mode. For stand-alone or dial-up Internet access, select the NAT mode. If you do not want to use the virtual machine to access the Internet, select the host. Mode

Unable to ping external network under linux

2. Check whether the gateway is configured correctly

1. First perform dhclient and automatically obtain the ip address

Unable to ping external network under linux

Free online video tutorial recommendation:linux video tutorial

2. Configure through#vi /etc/sysconfig/network-scripts/ifctg-eth0Check

Unable to ping external network under linux

Set ONBOOT=yes to automatically open the network card, and change dhcp to static static configuration. Pay attention to

1) IP and gateway must be In the same network segment

2) DNS is generally set to be the same as the gateway

3) Please refer to the real machine gateway configuration

Unable to ping external network under linux

##3. Restart the network card to ensure that DNS can be resolved

# service network restart

Unable to ping external network under linux

4. Check the DNS resolution

# grep hosts /etc/nsswitch.conf

Unable to ping external network under linux

If there is a problem with any of the above , after correction, test again (ctrl c to terminate), there should be no problem, as shown in the picture:

Unable to ping external network under linux

Recommended related articles and tutorials:

linux tutorial

The above is the detailed content of Unable to ping external network under linux. 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