#!/bin/sh
#*************************************************************
# 网络测试脚本
# written by braincol 2011.04.06
#*************************************************************
#****************************************
#被注释掉的方法获取网关所需的时间太长!
#GATEWAY=`route | grep 'default.*' | awk '1{split($0,parts," ");print parts[2]}'`
#****************************************
GATEWAY=`cat /proc/net/route | awk '
function char2num(char)
{
dec = "0123456789"; # decimal
cap = "ABCDEF"; # capital
min = "abcdef"; # minuscule
if( length(char) > 1 ){
print "the length of the input char is erro!";
return;
}
if( index(dec,char) > 0 ) {
return (index(dec,char) - 1);
}
else if( index(cap,char) > 0 ) {
return (index(cap,char) + 9);
}
else if( index(min,char) > 0 ) {
return (index(min,char) + 9);
}
else{
#print "input char error!"
return 0
}
}
function str2ip(str) {
split(str,out,"");
strout= sprintf("%d.%d.%d.%d",
char2num(out[7])*16 + char2num(out[8]),
char2num(out[5])*16 + char2num(out[6]),
char2num(out[3])*16 + char2num(out[4]),
char2num(out[1])*16 + char2num(out[2]));
return strout;
}
(FNR>1) {
split($0,parts," ")
if(parts[3] != "00000000"){
print str2ip(parts[3])
}
}'`
#*******************************************
#被注释掉的方法获取的dns太多,实际只需一个就够了
#NAMESERVER=`cat /etc/resolv.conf | grep 'nameserver.*' | sed 's/^.*nameserver *//g'`
#*******************************************
NAMESERVER=`cat /etc/resolv.conf |awk '(FNR<2) && /nameserver.*/' |sed 's/^.*nameserver *//g'`
INTERNET="www.baidu.com"
echo "GATEWAY: " $GATEWAY
echo "NAMESERVER: " $NAMESERVER
echo "INTERNET: " $INTERNET
echo "------------------------------"
ping -c 3 127.0.0.1 > /dev/null 2>&1
if [ "$?" != "0" ]; then
echo "Network card does not work! "
else
echo "Network card is OK!"
fi
ping -c 3 $GATEWAY > /dev/null 2>&1
if [ "$?" != "0" ]; then
echo "Can't connect to GateWay!"
else
echo "GateWay is connected!"
fi
ping -c 3 $NAMESERVER > /dev/null 2>&1
if [ "$?" != "0" ]; then
echo "Can't connect to DNS!"
else
echo "DNS is connected!"
fi
ping -c 3 $INTERNET > /dev/null 2>&1
if [ "$?" != "0" ]; then
echo "Can't connect to Internet!"
else
echo "Internet is connected!"
fi
exit 0
-
linux 网络测试脚本
2011-04-06 17:40:00#!/bin/sh #******************************************************...# 网络测试脚本 # written by braincol 2011.04.06 #************************************************************* #**************...转载于:https://www.cnblogs.com/hibraincol/archive/2011/04/06/2007072.html
-
网络栈测试脚本packetdrill.zip
2019-07-18 04:27:28packetdrill 是个脚本工具,可以快速准确的测试 TCP/UDP/IPv4/IPv6 网络栈,从系统调用层到 NIC 硬件。packetdrill 当前支持 Linux, FreeBSD, OpenBSD 和 NetBSD。packetdrill 可以通过 LAN 的物理 NICs 或者使用... -
测试网络脚本
2019-05-18 23:07:04[root@localhost data]# vim if02....read -p '请输入要测试的ip地址:' ip ping $ip if [ $? -eq 0];then echo 可以通讯 else echo 无法通讯 fi [root@localhost data]# chmod +x if02.sh [root@localhost data]#...[root@localhost data]# vim if02.sh
#!/bin/bash
read -p '请输入要测试的ip地址:' ip
ping $ip
if [ $? -eq 0];then
echo 可以通讯
else
echo 无法通讯
fi[root@localhost data]# chmod +x if02.sh
[root@localhost data]# /root/if02.sh
bash: /root/if02.sh: No such file or directory
[root@localhost data]# /home/tedu/data/if02.sh
请输入要测试的ip地址:127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.208 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.045 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.070 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.061 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.034 ms
64 bytes from 127.0.0.1: icmp_seq=6 ttl=64 time=0.065 ms
64 bytes from 127.0.0.1: icmp_seq=7 ttl=64 time=0.068 ms
64 bytes from 127.0.0.1: icmp_seq=8 ttl=64 time=0.068 ms
64 bytes from 127.0.0.1: icmp_seq=9 ttl=64 time=0.056 ms
64 bytes from 127.0.0.1: icmp_seq=10 ttl=64 time=0.038 ms
64 bytes from 127.0.0.1: icmp_seq=11 ttl=64 time=0.080 ms
^C -
星罗棋布:VPS测试脚本集锦
2021-01-25 14:11:53引言 莫忧世事兼身事,须著人间比梦间...网络类测试脚本 【带宽测试】 ???? 一、oooldking 原版 GitHub 主页:https://github.com/oooldking/script 使用方法: wget https://raw.githubusercontent.com/oooldkin引言
莫忧世事兼身事,须著人间比梦间。 ——勿埋我心
当我们获得一个服务器后,会想知道它的性能如何?宝塔自带跑分的应用,但是测试的数据比较片面,所以就有了各种各样的测试脚本。
勿埋我心带你了解一下有哪些常用的VPS测试脚本。网络类测试脚本
【带宽测试】
🌠 一、oooldking 原版
GitHub 主页:https://github.com/oooldking/script使用方法:
wget https://raw.githubusercontent.com/oooldking/script/master/superspeed.sh chmod +x superspeed.sh ./superspeed.sh
原版目前已经不再更新,勿埋我心建议使用第二个版本。
🌠 二、ernisn 版本(推荐)
GitHub 主页:https://github.com/ernisn/superspeed使用方法:
bash <(curl -Lso- https://git.io/superspeed)
【Ping值测试】
uPing:一个24小时监测VPS延迟的工具
依赖安装:
#Debian / Ubuntu apt-get update apt-get install python wget screen -y #CentOS / RHEL yum install screen wget python -y
使用方法:
screen -S uping wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/uPing/master/uping.py python uping.py
【回程路由测试】
从你的 Linux(X86/ARM)/Mac/BSD 系统环境下发起 traceroute 请求,附带链路可视化,兼容性更好,支持 JSON 格式
#下载 https://cdn.ipip.net/17mon/besttrace4linux.zip #解压 unzip besttrace4linux.zip #使用 ./besttrace -q 1 xxqiantigersxx #"xxqiantigersxx"替换为目标IP
性能类测试脚本
【内存检测脚本】
检测VPS真实可分配内存的小工具,适用于检测VPS超售情况。本程序检测的可分配内存指的是用户使用时最大能占用的内存量。
使用方法:
#CentOS / RHEL yum install wget -y yum groupinstall "Development Tools" -y wget https://raw.githubusercontent.com/FunctionClub/Memtester/master/memtester.cpp gcc -l stdc++ memtester.cpp ./a.out #Ubuntu / Debian apt-get update apt-get install wget build-essential -y wget https://raw.githubusercontent.com/FunctionClub/Memtester/master/memtester.cpp gcc -l stdc++ memtester.cpp ./a.out
【UnixBench测试脚本】
UnixBench是一个类unix系(Unix,BSD,Linux)统下的性能测试工具,一个开源工具,被广泛用与测试linux系统主机的性能。Unixbench的主要测试项目有:系统调用、读写、进程、图形化测试、2D、3D、管道、运算、C库等系统基准性能提供测试数据。
使用方法:
wget --no-check-certificate https://github.com/teddysun/across/raw/master/unixbench.sh chmod +x unixbench.sh ./unixbench.sh
综合类测试脚本
这类脚本是综合测试VPS基础信息、硬盘IO、带宽和网络延迟等项目的一键式脚本。
【Bench.sh脚本】
Github地址:https://github.com/teddysun/across/blob/master/bench.sh
特点:
- 显示当前测试的各种系统信息;
- 取自世界多处的知名数据中心的测试点,下载测试比较全面;
- 支持 IPv6 下载测速;
- IO 测试三次,并显示平均值。
使用方法:
#第一种方法 wget -qO- bench.sh | bash #第二种方法 curl -Lso- bench.sh | bash #第二种方法 wget -qO- 86.re/bench.sh | bash #第二种方法 curl -so- 86.re/bench.sh | bash
【SuperBench测试脚本】
这个脚本是在基于Bench.sh脚本的基础上,加入了独服通电时间,服务器虚拟化架构等内容
Github:https://github.com/oooldking/script/blob/master/superbench.sh特点:
- 改进了显示的模式,基本参数添加了颜色,方面区分与查找。
- I/O测试,更改了原来默认的测试的内容,采用小文件,中等文件,大文件,分别测试IO性能,然后取平均值。
- 速度测试替换成了 Superspeed 里面的测试,第一个默认节点是,Speedtest 默认,其他分别测试到中国电信,联通,移动,各三个不同地区的速度。
使用方法:
#第一种方法 wget -qO- --no-check-certificate https://raw.githubusercontent.com/oooldking/script/master/superbench.sh | bash #第二种方法 curl -Lso- -no-check-certificate https://raw.githubusercontent.com/oooldking/script/master/superbench.sh | bash
【Zbench测试脚本】
脚本由漏水和kirito,基于Oldking大佬 的 SuperBench,然后加入Ping以及路由测试的功能,还能生成测评报告,分享给其他人查看测评数据。
使用方法:
#中文版 wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/ZBench-CN.sh && bash ZBench-CN.sh #英文版 wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/ZBench.sh && bash ZBench.sh
【LemonBench测试脚本】
LemonBench工具(别名LBench、柠檬Bench),是一款针对Linux服务器设计的服务器性能测试工具。通过综合测试,可以快速评估服务器的综合性能,为使用者提供服务器硬件配置信息。
使用方法:
#第一种方法 curl -fsSL https://ilemonrain.com/download/shell/LemonBench.sh | bash #第二种方法 wget -qO- https://ilemonrain.com/download/shell/LemonBench.sh | bash
结语
感谢这些优秀作者开发的脚本,希望它们为你甄别优秀的服务器。欢迎有疑惑在勿埋我心评论区留言。
-
Linux性能/网络测试综合脚本
2019-01-10 16:59:17虽然网络上测试脚本有很多,但是没几个使用顺手的,于是今天花时间,修改编写了一个全新的Linux测试脚本。 本脚本最大的特点是测试全面,运行迅速,不会因为硬盘i/o低下或者网络状况不好,造成测试时间较长的问题,...虽然网络上测试脚本有很多,但是没几个使用顺手的,于是今天花时间,修改编写了一个全新的Linux测试脚本。
本脚本最大的特点是测试全面,运行迅速,不会因为
硬盘i/o
低下或者网络状况不好
,造成测试时间较长的问题,无论是什么机器,不带UnixBench都能保持在15分钟
以内执行完。测试项目
获取系统基本信息
测试硬盘存取延迟、iops、存取速度
测试本机带宽
测试本机到25个国外
节点下载速度
测试本机到8个国内
节点下载速度
测试本机到国内9个节点的路由
测试本机到国内9个节点的延迟与丢包使用说明
下载脚本
wget https://raw.githubusercontent.com/chiakge/Linux-Server-Bench-Test/master/linuxtest.sh -N --no-check-certificate
运行说明
#不含UnixBench的测试,无网页分享 bash linuxtest.sh #不含UnixBench的测试,带网页分享 bash linuxtest.sh s #含UnixBench的测试,不带网页分享 bash linuxtest.sh a #含UnixBench的测试,带网页分享 bash linuxtest.sh as #网页分享不包含任何VPSip信息
-
ZenData 网络自动化测试脚本 v1.6免费版
2021-01-03 04:55:51为您提供ZenData 网络自动化测试脚本下载,ZenData是一款网络测试数据生成软件,可以帮助用户对网络数据进行测试和生成,让用户可以更快的配置相关的参数,操作简单使用方便,有需要可以下载。使用方法 简单无依赖... -
原创-性能测试篇-网络性能测试脚本优化
2019-06-06 21:27:47本节所要用到netperf工具对...# 测试网络传输速率 网络吞吐率 # 网络响应时间等, # 包括 TCP UCP 流吞吐速率等 echo "hello" # 标题 test_title="网路接口性能 标识96" # 预期结果1 ecpect_result1="预测结果... -
网络两端延时测试脚本
2016-12-22 15:42:00本工具能够在tcp层面测试网络两端之间的rtt。原理是通过在client端与server端建立tcp连接,之后通过该连接传输多个数据包,记录传输时间,最终算出rtt的平均值。 1、Server端 脚本:server.py import socket ... -
[自动化测试]网络重连的测试脚本
2019-06-12 11:21:34最近在一个安卓客户端项目上重写了断开重连的处理逻辑,需要写个简单的压力测试脚本不断进行断网/网络恢复的操作,大概思路有两种: 1.安卓机器上 安卓机器上可以通过以下命令控制网络断开、连接: svc wifi enable... -
利用Python实现网络测试的脚本分享
2020-09-21 07:47:57主要给大家介绍了关于利用Python实现网络测试的方法,文中给出了详细的示例代码供大家参考学习,对大家具有一定的参考学习价值,需要的朋友们下面来一起看看吧。 -
网络测试的window bat脚本分析
2017-12-01 14:57:45网络测试的window bat脚本分析 -
linux 网络逻辑闪断测试脚本
2019-03-08 15:31:08如果需要长时间模拟此类测试则需要借助shell脚本,以下是我随便写的 有需要欢迎修改使用 #!/bin/bash ############################################################# # this script for disk operate with ... -
网络测试:用Python编写的脚本,用于测试网络连接-源码
2021-02-18 15:42:19这些脚本测试托管网站的网络连接。 使用Ping命令行实用程序进行测试。 这些命令作为进程执行。 评估这些过程的结果以确定连接是否成功 这些结果称为状态码 0:表示成功连接 1-250 +:代表不成功的对决 重要技术... -
python考试脚本_利用Python实现网络测试的脚本分享
2020-12-18 15:41:49前言最近同学让我帮忙写一个测试网络的工具。由于工作上的事情,断断续续地拖了很久才给出一个相对完整的版本。其实,我Python用的比较少,所以基本都是边查资料边写程序。程序的主要逻辑如下:读取一个excel文件中... -
批量测试服务器网络端口脚本
2019-04-17 23:31:19#PS C:\Users\admin.MYAD\Desktop> .\test.ps1 -Dir C:\Users\admin.MYAD\Desktop\test.txt -Port 443 param($Dir,$Port) function Test-PortAlive {[CmdletBinding()][OutputType([System.boolean])]param([Para... -
Caffe训练网络和测试网络时的脚本文件
2018-08-01 10:31:32在配置文件和超参数文件都配置好了之后,想要使得网络开始训练和测试,就需要在ubuntu的命令行上运行脚本文件,也就是后缀为.sh的文件,具体如下所示: ####训练网络 #在Ubuntu的命令行上运行脚本文件train_lenet.... -
测试网络ping通脚本
2018-11-02 14:45:19#!/bin/bash function ping_success(){ if ping -c 1 $ip >/dev/null; then echo "$ip ping is success." >> success.txt continue fi } cat ip.txt | while read ip...$ip pi... -
VPS服务器常用性能测试脚本汇总
2021-01-08 23:09:48分享一下常用的VPS服务器一键性能测试脚本,可以用来测试机器的配置和性能,测试VPS服务器的网络速度,硬盘性能等。 这里收集一些测试脚本,脚本均来自于网络,代码内有作者信息,感谢网络大神们提供这么优秀的工具... -
一个测试网络脚本
2012-03-16 19:03:41:b ping 192.168.10.12 -n 1 -l 2 | find "Request timed out" || goto b echo %time% >> ./a.txt goto b -
python写一个网络测速脚本_Python编写的Linux网络设置脚本,Debian Wheezy上测试通过...
2020-12-01 03:52:32注意事项参见程序注释快速使用指南:根菜单下,直接回车意味着.../usr/bin/env python3# -*- coding: UTF-8 -*-"""网络设置脚本在debian wheezy环境下测试通过依赖命令:ip, iw, wpa_supplicant, wpa_cli, dhclient... -
Perl 脚本测试网络连接
2012-11-21 17:14:48Perl 脚本测试网络连接。 #!/usr/bin/perl use IO::Socket; use POSIX qw(strftime); use vars qw($configfile @listen @filter @unknown @nlisten @pingable); sub testConnect($$) { my ($host, $port) = @_... -
Kafka 自带测试脚本进行性能测试
2020-07-20 20:57:23用Kafka官方自带的脚本,对Kafka进行压测。Kafka压测时,可以查看到哪个地方出现了瓶颈(CPU,内存,网络IO)。一般都是网络IO达到瓶颈。 producer 压力测试 bin/kafka-producer-perf-test.sh --topic test --record... -
云服务器测速脚本_VPS服务器常用性能测试脚本
2020-12-20 08:58:06这里收集一些测试脚本,脚本均来自于网络,代码内有作者信息,感谢网络大神们提供这么优秀的工具。一、superbench测试VPS服务器配置信息、IO性能、到国内节点的网速wget ... -
定时重启机器和自动测试网络连接shell脚本
2012-04-12 10:52:36shell脚本 定时重启机器 自动测试网络连接 -
脚本:我为网络枚举和渗透测试编写的各种脚本-源码
2021-02-07 16:39:02剧本 我的脚本集以及各种摘要等 -
一键测试脚本bench.sh
2019-01-14 10:05:13经过几个版本的演化,一键测试脚本 bench.sh 已经几乎全面适用于各种 Linux 发行版的网络(下行)和 IO 测试。 并将测试结果以较为美观的方式显示出来。 总结一下 bench.sh 特点: 1、显示当前测试的各种系统...