站点图标 Linux-技术共享

LookingGlass搭建教程 一个能监测服务器回程线路质量的软件

检测服务器的回程线路,是每个VPS玩家的必备技能。检测方法通常都是SSH连接上VPS后使用traceroute命令或者mtr命令,或者安装ipip的besttrace查看回程,还能查看回程IP的运营商和归属地。但是,每次测试回程都要连接SSH服务器,而且还要提前获取自己的IP,才能进行路由追踪,很麻烦。比如,你到你朋友家,网速很慢,你想看看回程路由,还要连接SSH…那就更麻烦了。有没有一个工具能快速查看回程线路呢?
有,那就是LookingGlass。一般IDC的商家会提供LookingGlass,但也有很多不提供,或者官方的线路跟自己的线路有细微的差别。
好在自己搭建LookingGlass并不难,注意避坑就可以了,下面是教程。

LookingGlass
LookingGlass(修改版)源代码:https://github.com/ILLKX/LookingGlass/

LookingGlass源代码:https://github.com/telephone/LookingGlass

推荐使用修改版,修改版不仅增加了对PHP7的支持;traceroute使用的是ipip的besttrace,相较于原版,还能查看回程IP的运营商和归属地。

默认已经安装了HTTP服务端(Nginx、Apache等) PHP 安装这些也很简单,有lnmp、宝塔等,相关教程很多,在此就不赘述了。

安装
下载LookingGlass源代码到服务器,建议下载到网站目录中,就不用移动了

wget https://github.com/ILLKX/LookingGlass/archive/master.zip
解压

unzip master.zip
修改文件夹名称

mv LookingGlass-master lg
进行安装:

bash lg/LookingGlass/configure.sh
按照提示进行安装:

########################################
#
# LookingGlass is a user-friendly script
# to create a functional Looking Glass
# for your network.
#
# Created by Nick Adams (telephone)
# http://iamtelephone.com
#
########################################

Do you wish to install LookingGlass? (y/n): y

### ###
# Starting install #
### ###

#这一步是检查相关依赖是否安装 没有安装的话会自动安装的
Checking script requirements:
Checking for host...
Checking for mtr...
Checking for ping...
Checking for traceroute...
Checking for sqlite3...

Checking for previous config:
Creating Config.php...

Creating test files:
Test files already exist...

### ###
# Starting configuration #
### ###

Running setup:
#输入网站的名字,会显示在标题和header上
Enter your website name (Header/Logo) []: Xiaomage`s LookingGlass
#输入lookingGlass的URL(你想把LG放在哪,包含http协议头)
Enter the public URL to this LG (including http://) []: https://bbx.xmgspace.me/lg
#服务器位置 可不填
Enter the servers location []: San Jose, LA, USA
#服务器IP 为了放在IP泄露,可不填
Enter the test IPv4 address []:
#IPv6地址 可不填
Enter the test IPv6 address (Re-enter everytime this script is run) []:
#生成测速文件的大小 可不填
Enter the size of test files in MB (Example: 25 50 100) []:
#限制每个IP每小时的测试次数 选n就表示不开启此功能
Do you wish to enable rate limiting of network commands? (y/n): n
#不选择其他主题,主题就一套
Would you like to choose a different theme? (y/n): n

Creating Config.php...

Creating SQLite database...
#输入服务器的用户名或用户组 root一把梭
Enter the username of your webserver (E.g. www-data): root
Enter the user group of your webserver (E.g. www-data): root
Fixing besttrace permissions...

Installation is complete

这样安装过程就完成了。访问你的网站:http://你的域名/lg就可以看到LookingGlass的主界面了。可以显示出你的IP,点击你的IP地址,就会自动输入到输入框中。

如果点击开始测试后没有响应,原因可能是因为LookingGlass调用了mtr等系统命令,某些环境会默认禁止这些函数,修改php.ini就可以解除限制。

Demo测试地址

测试

分辨填写测试的网站或者IP,测试类型,并点击Run Test即可开始测试。

退出移动版