最近检查/var/log/messages,发现大量的下列信息
Sep 28 13:40:12 files java: gethostby*.getanswer: asked for "tomcat01 IN AAAA", got type "A"
Sep 28 13:41:30 files last message repeated 60 times
Sep 28 13:42:32 files last message repeated 108 times
Sep 28 13:43:54 files last message repeated 216 times
Sep 28 13:45:01 files last message repeated 76 times
Sep 28 13:46:32 files last message repeated 100 times
Sep 28 13:47:40 files last message repeated 131 times
Sep 28 13:48:41 files last message repeated 198 times
Sep 28 13:49:42 files last message repeated 301 times
Sep 28 13:50:52 files last message repeated 89 times
Sep 28 13:52:02 files last message repeated 134 times
Sep 28 13:53:03 files last message repeated 154 times
Sep 28 13:54:04 files last message repeated 363 times
google上查了很多,众说纷纭,有说遭攻击了,有说中病毒了,却没有人就日志中出现的信息给出解决方法。
查找答案的时候发现,各种服务都可能引起日志中出现的gethostby*.getanswer,比如我这次是java引起的,别人有httpd,postfix之类的都有,此处并不排除遭受攻击或者中病毒的情况,仅仅就个人的理解以及实际经验提供出一个可行的办法,以期今后有兄弟姐妹在日志中遇到这样的信息的时候不要惊慌失措,并且能够迅速的找出问题的根源。
首先
Sep 28 13:40:12 files java: gethostby*.getanswer: asked for "tomcat01 IN AAAA", got type "A"
这条信息中,files是主机名,其实现在的主机名是tomcat01,但是服务器已经将近2年没有重起了,syslog仍然用旧的主机名来记录日志,重起一下syslogd就可以了,这个问题与本次要说明的问题没什么关系。 java是本次出现问题的服务,这台服务器上仅仅运行了一个tomcat,另外有台服务器上运行的apache通过mod_jk2.so与之集成。虽然在tomcat中都禁用了域名查询,(以下是推断)但是在8009端口上,tomcat不断的接受另外一台服务器发来的请求,它一直想知道tomcat01是谁(推断结束),但是在dns上是解析不出来tomcat01这个域名的,于是便在/var/log/messages中出现了这条信息,而我所维护的服务器,访问量比较大,每分钟都有大量的8009端口的请求,日志中接下来出现了last messages repeated * times。
解决方法
既然是无法解析出tomcat01这个域名,linux与windows一样,都有一个本地host表的,可以把这个tomcat01解析到127.0.0.1的信息写入这个host表。首先确认/etc/host.conf中规定的解析顺序,默认的是这样的
# vi /etc/host.conf
order hosts,bind #也就是先本地解析,后到dns上解析
然后,编辑/etc/hosts文件
# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost localhost.localdomain files
将files改成tomcat01,或者,在下面加上一行
127.0.0.1 localhost localhost.localdomain tomcat01
也是可以的。
再观察/var/log/messages,此类信息已经不再有了。
思考
其实这个问题还可以引申出很多相关的问题,比如为什么tomcat要去解析tomcat01这个域名,比如说为什么要解析tomcat01而不是请求的来源--apache01?
今后再遇到这样的问题,至少能够知道,是哪个服务在哪个端口接收了大量的请求,继而根据实际情况来判断请求的来源,最终解决问题
Sep 28 13:40:12 files java: gethostby*.getanswer: asked for "tomcat01 IN AAAA", got type "A"
Sep 28 13:41:30 files last message repeated 60 times
Sep 28 13:42:32 files last message repeated 108 times
Sep 28 13:43:54 files last message repeated 216 times
Sep 28 13:45:01 files last message repeated 76 times
Sep 28 13:46:32 files last message repeated 100 times
Sep 28 13:47:40 files last message repeated 131 times
Sep 28 13:48:41 files last message repeated 198 times
Sep 28 13:49:42 files last message repeated 301 times
Sep 28 13:50:52 files last message repeated 89 times
Sep 28 13:52:02 files last message repeated 134 times
Sep 28 13:53:03 files last message repeated 154 times
Sep 28 13:54:04 files last message repeated 363 times
google上查了很多,众说纷纭,有说遭攻击了,有说中病毒了,却没有人就日志中出现的信息给出解决方法。
查找答案的时候发现,各种服务都可能引起日志中出现的gethostby*.getanswer,比如我这次是java引起的,别人有httpd,postfix之类的都有,此处并不排除遭受攻击或者中病毒的情况,仅仅就个人的理解以及实际经验提供出一个可行的办法,以期今后有兄弟姐妹在日志中遇到这样的信息的时候不要惊慌失措,并且能够迅速的找出问题的根源。
首先
Sep 28 13:40:12 files java: gethostby*.getanswer: asked for "tomcat01 IN AAAA", got type "A"
这条信息中,files是主机名,其实现在的主机名是tomcat01,但是服务器已经将近2年没有重起了,syslog仍然用旧的主机名来记录日志,重起一下syslogd就可以了,这个问题与本次要说明的问题没什么关系。 java是本次出现问题的服务,这台服务器上仅仅运行了一个tomcat,另外有台服务器上运行的apache通过mod_jk2.so与之集成。虽然在tomcat中都禁用了域名查询,(以下是推断)但是在8009端口上,tomcat不断的接受另外一台服务器发来的请求,它一直想知道tomcat01是谁(推断结束),但是在dns上是解析不出来tomcat01这个域名的,于是便在/var/log/messages中出现了这条信息,而我所维护的服务器,访问量比较大,每分钟都有大量的8009端口的请求,日志中接下来出现了last messages repeated * times。
解决方法
既然是无法解析出tomcat01这个域名,linux与windows一样,都有一个本地host表的,可以把这个tomcat01解析到127.0.0.1的信息写入这个host表。首先确认/etc/host.conf中规定的解析顺序,默认的是这样的
# vi /etc/host.conf
order hosts,bind #也就是先本地解析,后到dns上解析
然后,编辑/etc/hosts文件
# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost localhost.localdomain files
将files改成tomcat01,或者,在下面加上一行
127.0.0.1 localhost localhost.localdomain tomcat01
也是可以的。
再观察/var/log/messages,此类信息已经不再有了。
思考
其实这个问题还可以引申出很多相关的问题,比如为什么tomcat要去解析tomcat01这个域名,比如说为什么要解析tomcat01而不是请求的来源--apache01?
今后再遇到这样的问题,至少能够知道,是哪个服务在哪个端口接收了大量的请求,继而根据实际情况来判断请求的来源,最终解决问题
专业linux服务器维护,上海个人兼职
PIL 安装说明,关于decoder jpeg not available 和 jpeglib.h


2007/09/28 15:02 | by 