AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[geoip](server)

Martin Hope
Shakiba Moshiri
Asked: 2020-07-15 00:50:25 +0800 CST

bind9 geoip 无法正常工作

  • 1

bind9 bind-9.17.2已从debian-9上的源代码编译。

./named -V
BIND 9.17.2 (Development Release) <id:6d46544>
running on Linux x86_64 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07)
built by make with  '--with-maxminddb' '--prefix=/usr' '--enable-fixed-rrset' '--sysconfdir=/etc/bind'
compiled by GCC 6.3.0 20170516
compiled with OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019
linked to OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019
compiled with zlib version: 1.2.8
linked to zlib version: 1.2.8
linked to maxminddb version: 1.2.0
threads support is enabled

default paths:
  named configuration:  /etc/bind/named.conf
  rndc configuration:   /etc/bind/rndc.conf
  DNSSEC root key:      /etc/bind/bind.keys
  nsupdate session key: /usr/var/run/named/session.key
  named PID file:       /usr/var/run/named/named.pid
  named lock file:      /usr/var/run/named/named.lock
  geoip-directory:      /usr/share/GeoIP

主要目标是使用其GeoIP功能并根据解析器 IP 地址位置回答查询,并且配置named.conf.local非常简单:

...
...
include "/etc/bind/geoip/GeoIP.acl";

view "Iran" {
      match-clients { IR; };
      recursion no;
      zone "ppod.ir" {
            type master;
            file "/etc/bind/db.ppod.ir.iran";
      };
};

view "default"  {
       include "/etc/bind/named.conf.default-zones";
       ...
       ...

的区域db.ppod.ir.iran是:

; A, AAAA => host record
ppod.ir.     1      IN      A       185.8.172.233

而对于default view是:

; A, AAAA => host record
ppod.ir.     1      IN      A       5.63.13.22
ppod.ir.     1      IN      A       95.216.12.6

现在,如果我从伊朗查询域ppod.ir,DNS 服务器给了我错误的 IP。

$ dig ppod.ir # the answer is wrong

; <<>> DiG 9.11.3-1ubuntu1.12-Ubuntu <<>> ppod.ir
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15519
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;ppod.ir.           IN  A

;; ANSWER SECTION:
ppod.ir.        1   IN  A   5.63.13.22
ppod.ir.        1   IN  A   95.216.12.6

;; Query time: 263 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Tue Jul 14 12:59:53 +0430 2020
;; MSG SIZE  rcvd: 68

但无论是哪种方式,如果我直接询问 DNS 服务器或跟踪它提供正确 IP 的查询。

$ dig ppod.ir @171.22.25.82 +short # the answer is right
185.8.172.233

并追踪它:

$ dig ppod.ir @1.1.1.1 +trace  +short # the answer is right
NS a.root-servers.net. from server 1.1.1.1 in 257 ms.
NS b.root-servers.net. from server 1.1.1.1 in 257 ms.
NS c.root-servers.net. from server 1.1.1.1 in 257 ms.
NS d.root-servers.net. from server 1.1.1.1 in 257 ms.
NS e.root-servers.net. from server 1.1.1.1 in 257 ms.
NS f.root-servers.net. from server 1.1.1.1 in 257 ms.
NS g.root-servers.net. from server 1.1.1.1 in 257 ms.
NS h.root-servers.net. from server 1.1.1.1 in 257 ms.
NS i.root-servers.net. from server 1.1.1.1 in 257 ms.
NS j.root-servers.net. from server 1.1.1.1 in 257 ms.
NS k.root-servers.net. from server 1.1.1.1 in 257 ms.
NS l.root-servers.net. from server 1.1.1.1 in 257 ms.
NS m.root-servers.net. from server 1.1.1.1 in 257 ms.
RRSIG NS 8 0 ..... from server 1.1.1.1 in 257 ms.
couldn't get address for 'ns2.redcursor.ir': not found
A 185.8.172.233 from server 171.22.25.82 in 40 ms.

TTL 的缓存设置为 1,绑定也符合 GeoIP 功能,问题是为什么 DNS 服务器没有正确响应? 我知道缓存 IP 地址和公共 DNS 服务器的递归查询,但根据我配置的 IP 应该被缓存

这是这两个查询的日志dig ppod.ir,dig ppod.ir @171.22.25.82来自相同的位置和 IP 地址。第一个是错的,第二个是对的。

14-Jul-2020 08:38:21.312 info: client @0x7fbb20000a30 162.158.82.125#56703 (ppod.ir): view default: query: ppod.ir IN A -E(0)D (171.22.25.82)
14-Jul-2020 08:38:21.312 debug 3: client @0x7fbb20000a30 162.158.82.125#56703 (ppod.ir): view default: query 'ppod.ir/A/IN' approved
14-Jul-2020 08:38:21.312 debug 3: client @0x7fbb20000a30 162.158.82.125#56703 (ppod.ir): view default: reset client
14-Jul-2020 08:38:43.308 debug 3: client @0x7fbb20000a30 5.117.5.210#55509: UDP request
14-Jul-2020 08:38:43.308 debug 5: client @0x7fbb20000a30 5.117.5.210#55509: view Iran: using view 'Iran'
14-Jul-2020 08:38:43.308 debug 3: client @0x7fbb20000a30 5.117.5.210#55509: view Iran: request is not signed
14-Jul-2020 08:38:43.308 debug 3: client @0x7fbb20000a30 5.117.5.210#55509: view Iran: recursion not available
14-Jul-2020 08:38:43.308 info: client @0x7fbb20000a30 5.117.5.210#55509 (ppod.ir): view Iran: query: ppod.ir IN A +E(0)K (171.22.25.82)
14-Jul-2020 08:38:43.308 debug 3: client @0x7fbb20000a30 5.117.5.210#55509 (ppod.ir): view Iran: query 'ppod.ir/A/IN' approved
14-Jul-2020 08:38:43.308 debug 3: client @0x7fbb20000a30 5.117.5.210#55509 (ppod.ir): view Iran: reset client
domain-name-system bind geoip
  • 1 个回答
  • 235 Views
Martin Hope
Pat
Asked: 2016-10-19 08:13:12 +0800 CST

GeoIP PHP 扩展无法在 CentOS 7 上运行

  • 2

我无法让 GeoIP PHP 扩展在 CentOS 7 和 PHP 5.5.21 上运行。

我首先开始yum install php-pecl-geoip并重新启动了 httpd。然后我做了一个简单的测试:

$record = geoip_record_by_name($_SERVER["REMOTE_ADDR"]);
if ($record) {
    print_r($record);
}

我收到错误 500,在错误日志中,我看到

PHP Fatal error: Call to undefined function geoip_record_by_name()

所以我认为 yum 包不好并删除了它。然后我做了pecl install geoip并启用了扩展/etc/php.d/geoip.ini并extension=geoip.so重新启动了httpd。同样的错误 - 未定义的函数。

为了确保安装正确,我再次尝试了 pecl 安装并收到以下输出:

pecl/geoip is already installed and is the same as the released version 1.0.8

我确实安装了 Apache 的 mod_geoip。这2个有冲突吗?

我还能检查什么?

php httpd geoip
  • 1 个回答
  • 2037 Views
Martin Hope
azatuni
Asked: 2016-08-19 23:56:59 +0800 CST

nginx/1.10.1 上的未知指令“geoip_country”

  • 5

我在通过 nginx repo 安装的 CentOS 7 上有一个 nginx/1.10.1。我只是安装geoip模块

[root@www nginx]# nginx -V
nginx version: nginx/1.10.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic **--with-http_geoip_module=dynamic** --with-http_perl_module=dynamic --add-dynamic-module=njs-1c50334fbea6/nginx --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_v2_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'

添加geoip_country GeoIP.dat;到 http 部分nginx.conf,但是当我做 configtest

[root@www nginx]# nginx -t
nginx: [emerg] unknown directive "geoip_country" in /etc/nginx/nginx.conf:40
nginx: configuration file /etc/nginx/nginx.conf test failed

有谁能够帮我?预先感谢。

nginx geoip
  • 3 个回答
  • 15234 Views
Martin Hope
Paystey
Asked: 2012-05-17 05:52:22 +0800 CST

Geo IP Apache 模块可靠性

  • 0

我正在寻找一些简单的方法来确定用户正在查看该网站的国家/地区,这只是品牌问题而不是合法性问题,因此一些误报不会那么重要。

Apaches mod_geoip 似乎正是我要找的东西,但没有迹象表明它有多准确。

有没有人对准确性有任何确切的数字?
例如

  • 1000 名用户中有多少用户在国家/地区级别被准确定位?
  • 有多少是市级的?
  • 可靠性下降的任何特定区域(南美、澳大拉西亚)?

或者,我可以使用另一种快速、可靠的地理定位解决方案吗?(第 3 方网络服务并不是真正的选择,太多的开销不值得)

apache-2.2 geolocation geoip
  • 1 个回答
  • 671 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve