原 Linux:ping不通baidu.com
如果某台Linux服务器ping不通域名, 如下提示:
[root@localhost ~]# ping www.baidu.com
ping: unknown host www.baidu.com
首先确定已经连接上路由器,并且路由器能够访问外网,可以通过访问网关进行确定
[root@localhost ~]# ping 8.8.8.8
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=2.96 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=1.75 ms
如果确定网络没问题的情况下, 可以通过如下步骤寻找解决办法:
1) 确定设置了域名服务器, 没有的话, 建议设置Google的公共DNS服务, 它应该不会出问题的
[root@localhost ~]# cat /etc/resolv.conf
search localdomain
因为我的DNS没有设置所以导致了ping外网ping不通。将dns添加到该文件中
[root@localhost ~]# vi /etc/resolv.conf
nameserver 202.98.96.68
nameserver 61.139.2.69
~
或者加入192.168.1.1 (默认网关)
2) 确保网关已设置
# grep GATEWAY /etc/sysconfig/network-scripts/ifcfg*
——————————————————————-
/etc/sysconfig/network-scripts/ifcfg-eth0:GATEWAY=192.168.40.1
——————————————————————-
如果未设置, 则通过如下方式增加网关:
# route add default gw 192.168.40.1
或者手工编写/etc/sysconfig/network-scripts/ifcfg*文件后, 重启network服务:
# service network restart
3) 确保可用dns解析
# grep hosts /etc/nsswitch.conf
——————————————————————-
hosts: files dns
——————————————————————-
如果以上哪个有问题, 修正后, 再测试, 应该就没问题了:
#ping -c 3 www.baidu.com
PING www.a.shifen.com (220.181.6.175) 56(84) bytes of data.
64 bytes from 220.181.6.175: icmp_seq=0 ttl=50 time=9.51 ms
64 bytes from 220.181.6.175: icmp_seq=1 ttl=50 time=8.45 ms
64 bytes from 220.181.6.175: icmp_seq=2 ttl=50 time=8.97 ms
— www.a.shifen.com ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 8.450/8.977/9.511/0.446 ms, pipe 2
原文地址:https://blog.csdn.net/qq_35370485/article/details/77844860
原 Linux:ping不通baidu.com的更多相关文章
- Linux ping不通百度的解决方法
今天在学习DNS的时候遇到了一个问题,我的虚拟机能够ping通ip地址,却ping不通www.baidu.com www.qq.com等域名,先是出现了以下报错: 折腾了几个小时终于找到解决办法 1. ...
- Linux ping不通外网
在linux中ping www.baidu.com 无法ping通,可能原因是DNS没配置好 方法一: 修改vi /etc/resolv.conf 增加如下内容: nameserver 114.11 ...
- VMware虚拟机中red hat linux ping不通宿主物理主机原因
在VMware Workstation中安装了red hat enterprise linux系统,网络使用“桥接”形式,最后出现在Windows下能够Ping通虚拟主机,而虚拟主机Ping不通Win ...
- VMware下配置Linux IP,解决Linux ping不通
因为安装好VMware8.0后,把VMware服务都设成手动的了,导致有些功能不好使,费了半天劲, 如果安装Linux时选择DHCP自动分配IP,需要启动服务: VMware DHCP service ...
- Linux ping 不通 域名 添加DNS
修改路由配置文件 vi /etc/resolv.conf # Generated by NetworkManager #NDS nameserver 192.168.32.2 redhat7 系统优化 ...
- centos虚拟机Ping不通网关
centos虚拟机Ping不通网关 今天在VMware中安装了centos mini版本,安装完成后,用xshell连接一直连不上,本来以为是mini版本没有安装ssh server,于是就用命令: ...
- linux:ping不通www.baidu.com
如果某台Linux服务器ping不通域名, 如下提示: [root@localhost ~]# ping www.baidu.com ping: unknown host www.baidu.com ...
- Linux安装centos,网络net8模式ping不通www.baidu.com或者ping不通主机
1.Linux安装centos,网络net8模式ping不通www.baidu.com或者ping不通主机. 我使用的是net8模式.配置如下所示,保证可以ping通www.baidu.com或者pi ...
- 【Linux】【通信】1.ping不通
关于为什么ping不通有很多种原因,但直接的表象就网络之间没有成功进行通讯: 在构建虚拟机和win之间的交互时,主要使用了3种网络模式: 桥接bridge VMnet0 主机host VMne ...
随机推荐
- day5 from 金角大王
Python 之路 Day5 - 常用模块学习 本节大纲: 模块介绍 time &datetime模块 random os sys shutil json & picle shel ...
- Eclipse中提示 找不到类 javax.servlet.http.HttpServletResponse
问题如题, 解决方案如下: 复制tomcat的安装路径下\lib\servlet-api.jar 到WEB-INF/lib下即可.
- poj 2184 Cow Exhibition(01背包)
Cow Exhibition Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10882 Accepted: 4309 D ...
- 03搭建docker私有仓库
搭建docker私仓,可以使用docker官方提供的registry镜像.该镜像目前有2.0,2.3和2.3.1版本.它只与1.6.0以上版本的docker兼容.搭建私仓的步骤如下: 一:无代理.无认 ...
- 修改Mariadb存储路径
大部分基于此文章操作:http://lddyw.blog.51cto.com/4151746/1684364 找个好久的资料,都打算源码安装了,最后终于更改成功了. 环境:CentOS6.6 64位虚 ...
- mysql 中 DATE_ADD函数和 DATE_SUB函数用法
mysql 中 DATE_ADD(date,INTERVAL expr type) 和 DATE_SUB(date,INTERVAL expr type) 这些函数执行日期运算. date 是一个 D ...
- oracle函数 RPAD(c1,n[,c2])
[功能]在字符串c1的右边用字符串c2填充,直到长度为n时为止 [参数]C1 字符串 n 追加后字符总长度 c2 追加字符串,默认为空格 [返回]字符型 [说明]如果c1长度大于n,则返回c1左边n个 ...
- Getting started with the basics of programming exercises_5
1.编写函数,把由十六进制数字组成的字符串转换为对应的整型值 编写函数htoi(s),把由十六进制数字组成的字符串(包含可选的前缀0x或0X)转换为与之等价的整型值.字符串中允许包含的数字包括:0~9 ...
- ng-model 将时间戳转换为标准时间
html部分 <div class="form-group loginCon1"> <label class="col-sm-2 control-l ...
- POJ3080 Blue Jeans 题解 KMP算法
题目链接:http://poj.org/problem?id=3080 题目大意:给你N个长度为60的字符串(N<=10),求他们的最长公共子串(长度>=3). 题目分析:KMP字符串匹配 ...