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 ...
随机推荐
- java 模拟ajax上传图片
1.maven 引入依赖 <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime --> &l ...
- 【C++】函数和指针
最近在看C++ primer plus,感觉函数与指针这一章难点比较多,记写笔记,加强理解. From C++ Primer Plus: Chapter 7 Function:C++ Programm ...
- Java基础学习总结(1)——equals方法
一.equals方法介绍 1.1.通过下面的例子掌握equals的用法 package cn.galc.test; public class TestEquals { public static vo ...
- HDU 1827 Summer Holiday(强连通)
HDU 1827 Summer Holiday 题目链接 题意:中文题 思路:强连通缩点,每一个点的权值为强连通中最小值,然后入度为0的点就是答案 代码: #include <cstdio> ...
- Springmvc JSON交互
先上前端javascript.ajax代码 <pre name="code" class="javascript"> function testAj ...
- spfile
1 让ORACLE自己主动从spfile启动 SQL> create spfile='/dev/vx/rdsk/vgora/lv_spfile' from pfile; SQL> sh ...
- Windows下使用python绘制caffe中.prototxt网络结构数据可视化
准备工具: 1. 已编译好的pycaffe 2. Anaconda(python2.7) 3. graphviz 4. pydot 1. graphviz安装 graphviz是贝尔实验室开发的一个 ...
- Find and counter
Find: In a sense, find is the opposite of the [] operator. Instead of taking an index and extracting ...
- 【DNN引用包】
<%@ Register TagPrefix="dnn" TagName="address" Src="~/controls/address.a ...
- 洛谷P3195 [HNOI2008]玩具装箱TOY(单调队列优化DP)
题目描述 P教授要去看奥运,但是他舍不下他的玩具,于是他决定把所有的玩具运到北京.他使用自己的压缩器进行压缩,其可以将任意物品变成一堆,再放到一种特殊的一维容器中.P教授有编号为1...N的N件玩具, ...