经常遇到防止PING的服务器,试了一下
直接在终端下敲入
sysctl -w net.ipv4.icmp_echo_ignore_all=1
sysctl -p
sysctl设置和显示在/proc/sys目录中的内核参数.能用sysctl来设置或重新设置连网功能,如IP转发、IP碎片去除及源路由检查等。用户只需要编辑/etc/sysctl.conf文件,即可手工或自动执行由sysctl控制的功能。
sysctl [-n] [-e] -w variable=value
sysctl [-n] [-e] -p (default /etc/sysctl.conf)
sysctl [-n] [-e] -a
阅读全文>>
jquery的ping插件://要用的需要明白代码及自己改些地方
(function($) {
$.fn.ping = function(options) {
var opts = $.extend({}, $.fn.ping.defaults, options);
var stime = new Date().getTime();
return this.each(function() {
var ping, requestTime, responseTime ;
var target = $(this);
function ping(){
$.ajax({url: opts.getUrl(target.html())+'/'+ Math.random() + '.html', //设置一个空的ajax请求
type: opts.type,
dataType: 'html',
timeout: opts.timeout,
beforeSend : function() {
requestTime = new Date().getTime();
},
complete : function() {
responseTime = new Date().getTime();
ping = Math.abs(reque
阅读全文>>