Linux能ping通IP,ping不通域名
今天碰到个问题, 能ping通IP地址, ping不通域名, 一直以为是 DNS解析服务器的问题, 找了半天。 问题不在这里。
[root@www postfix]# cat /etc/resolv.conf
nameserver 202.96.209.133
options attempts:1 timeout:1 rotate
#nameserver 10.202.72.117
nameserver 10.202.72.118
nameserver 114.114.114.114
nameserver 8.8.8.8
[root@www postfix]#
看了一下路由表, 问题也不在路由网关上。
[root@www postfix]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
115.28.80.0 0.0.0.0 255.255.252.0 U 0 0 0 eth1
10.163.176.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
192.168.0.0 10.163.191.247 255.255.0.0 UG 0 0 0 eth0
172.16.0.0 10.163.191.247 255.240.0.0 UG 0 0 0 eth0
10.0.0.0 10.163.191.247 255.0.0.0 UG 0 0 0 eth0
0.0.0.0 115.28.83.247 0.0.0.0 UG 0 0 0 eth1
[root@www postfix]#
[root@www postfix]#
[root@www postfix]#
[root@www postfix]#
[root@www postfix]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
115.28.80.0 * 255.255.252.0 U 0 0 0 eth1
10.163.176.0 * 255.255.240.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
link-local * 255.255.0.0 U 1003 0 0 eth1
192.168.0.0 10.163.191.247 255.255.0.0 UG 0 0 0 eth0
172.16.0.0 10.163.191.247 255.240.0.0 UG 0 0 0 eth0
10.0.0.0 10.163.191.247 255.0.0.0 UG 0 0 0 eth0
default 115.28.83.247 0.0.0.0 UG 0 0 0 eth1
然后再看看 :
[root@www postfix]# grep hosts /etc/nsswitch.conf
#hosts: db files nisplus nis dns
#hosts: files dns
hosts: dns files
我改动为 先 dns, 在 files, 測试了, 也还是不通。
最后发现是防火墙的原因, 我开启了防火墙, 造成了 ping 域名不通。
域名解析用到了53端口。 须要把以下的设置配置到防火墙里就可以。
iptables -A INPUT -p udp --sport 53 -j ACCEPT
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
iptables -A INPUT -p udp --dport 53 -j ACCEPT
iptables -A OUTPUT -p udp --sport 53 -j ACCEPT
这样就能够 ping 通域名了。
Linux能ping通IP,ping不通域名的更多相关文章
- 解决CentOS下可以ping通ip ping不通域名
现象:1. ping不通域名,比如 www.qq.com 2. 可以ping通ip,比如 61.135.157.156 分析:1. 查看DNS配置文件 /etc/resolve.conf, 里面的服务 ...
- 为什么可以Ping通IP地址,但Ping不通域名?
能否ping通IP地址,与能否解析域名是两回事不能ping通IP地址,说明对方禁止ICMP报文或对方没有开机等解析域名只是将域名翻译成IP地址,不论该IP地址是否能够正常访问 问题是ping域名的时候 ...
- 解决可以Ping通ip地址,但Ping不通域名的思路
在正常的网络故障处理中,ping命令是大家经常用到的,出现ping通ip地址,但ping域名是出现超时情况,一般是由于TCP/IP协议中的“DNS设置”不正确,请检查其中的配置,或者更换其他可用的DN ...
- PC问题-可以PING通IP,PING名字不通,可以远程,但不能访问共享文件夹?
问题现象:可以PING通IP,PING名字不通,可以远程,但不能访问共享文件夹? 问题原因:目标主机中NetLogon服务未启动. 问题处理:远程打开目标主机,“我的电脑-管理-服务-启动(改为自动) ...
- red hat7 系统可以ping通ip地址但是不能ping通域名
在red hat7中ifconfig后出现这样的情况,ens33是物理网卡,与eth0一样只是不同的名字.但是只能ping通ip地址不能ping通域名. 解决方法: 在文件 /etc/resolv.c ...
- 公司网络能ping通ip,不能ping域名
第一天去公司,就因为网络问题弄了大半天.只能ping通ip,不能ping域名.网上查了各种方式都不行,刷新dns缓存.说是什么域名解析问题.dns的问题.公司里好几个人都看了看不能解决.领导让重装系统 ...
- ping通网关 ping不能外网 DNS无法解析
###ping通网关 ping不能外网 DNS无法解析 客户上不了网 DNS解析不了 首先登陆机器 先查看IP 然后看dns是否正常 然后测试ping网关 ping外网 nslookup ...
- linux 能ping通IP但无法解析域名
vi /etc/nsswitch.conf hosts: files dns networks: files 改成: hosts: files dns wins networks: files 最近碰 ...
- ubuntu中可以ping通IP地址但是ping不通域名的问题(www.baidu.com)
治标不治本的办法:每次开机后执行sudo /etc/init.d/resolvconf restart就可以ping通. 治本方法见原博:https://blog.csdn.net/WFping518 ...
随机推荐
- vector迭代器
https://www.cnblogs.com/quant-lee/p/6618829.html
- 服务器搭建域控与SQL Server的AlwaysOn环境过程(四)配置AlwaysOn
0 引言 这一篇才真正开始搭建AlwaysOn,前三篇是为搭建AlwaysOn 做准备的. 步骤 1.3 配置AlwaysOn 请先使用本地用户Administrator登录这两个集群节点并执行下面的 ...
- js各种验证
1. var Validate = function() { //账号验证 字母,数字,下划线,不能少于6位大于20位 this.isName =function(value){ var reg = ...
- c++常见操作的模板
1.统计时间 #include<ctime> clock_t startTime = clock(); code(); clock_t endTime = clock(); cout &l ...
- macOS seria 10.12升级到macOS Mojave的报错:xcrun: error: invalid active developer path, missing xcrun
今天升级mac系统到macOS mojave后,在终端操作gitlab时遇到一行莫名其妙的错误: xcrun: error: invalid active developer path (/Libra ...
- 关于buffer和cache的区别
1. Cache:缓存区,是高速缓存,是位于CPU和主内存之间的容量较小但速度很快的存储器,因为CPU的速度远远高于主内存的速度,CPU从内存中读取数据需等待很长的时间,而 Cache保存着CPU刚 ...
- 使用AFNetworking第三方下载类
AFNetworking 眼下使用比較多得一个下载库 眼下一直在维护更新,使用的是很easy 不须要加入不论什么关联的库 1.带block形式 内部是任务队列进行下载 就是对operation的一 ...
- 10.29 工作笔记 ndk编译C++,提示找不到头文件(ndk-build error: string: No such file or directory)
ndk编译C++.提示找不到头文件(ndk-build error: string: No such file or directory) 被这个问题弄得愁眉苦脸啊.心想为啥一个string都找不到呢 ...
- Web端本地存储
1.需求背景:当用户在页面上添加一行一行的数据时,突然发现网络断掉了,页面上编辑的数据没法保存进数据库,所以需要一个本地端的临时保存功能,以便在网络通畅后重新加载出来! 2.解决方案: 结合网上搜刮, ...
- angularjs 自定义服务
<!DOCTYPE HTML> <html ng-app="myApp"> <head> <meta http-equiv="C ...