您的位置:首页 > 其它

geoiplookup命令没有任何输出问题

2017-06-13 10:11 423 查看
在Ubuntu上使用命令 apt-get install geoip-bin安装后,使用geoiplookup 8.8.8.8没有任何输出。

问题原因:缺少数据库,在/usr/share/GeoIP目录没有东西

自己下载数据库安装:

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz wget http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz gunzip GeoIP.dat.gz
gunzip GeoIPASNum.dat.gz
gunzip GeoLiteCity.dat.gz
sudo cp GeoIP.dat GeoIPASNum.dat GeoLiteCity.dat /usr/share/GeoIP/

然后再执行就可以了

root@localhost:~/geoip# geoiplookup 112.95.16.94
GeoIP Country Edition: CN, China
GeoIP ASNum Edition: AS17623 China Unicom Shenzen network

如果要显示城市信息,需要指定参数

root@localhost:~/geoip# geoiplookup 112.95.16.94 -f /usr/share/GeoIP/GeoLiteCity.dat
GeoIP City Edition, Rev 1: CN, 30, Guangdong, Shenzhen, N/A, 22.533300, 114.133301, 0, 0
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  geoip
相关文章推荐