LoginSignup
0
1

More than 3 years have passed since last update.

IPアドレス情報の検索(サーバ系編)

Posted at

IPアドレスからのシステム情報推定

調査系の話で、FQDNからDNSでIPを引き、IPからどのクラウドサービスをつかってるか/どのISP配下にオンプレ環境をおいているかを推定したいという話。

GEOIP情報のような「住所推定」は当てにしてないのでどうでもいい。
AS情報を効率よく引き抜いて、どこらへんのクラウドにいるのかを把握したいというところですね。
AWSにいるのか、Azuleにいるのか、自社DCか。

RADb

素直に考えるとやはりこれ。

$ whois -h whois.radb.net <IP>

https://radb.net
https://www.nic.ad.jp/ja/newsletter/No27/100.html

ただし、余り激しく接続すると遮断されたような記憶があるのと、そもそも誰が管理しているものでどのような条件で提供されているものなのかをちゃんと調べたことがなかったので、ちゃんとしらべてみますか。。

誰が管理するサービス?

RADbのサイトの下の方にMerit Network.incという記載があり。
Merit Networkは米国ミシガン州の公立大学が共同創立した非営利団体が管理しているとのこと。

なんのためのサービス?

ISP事業者などがルーティングの問題が起こった際の切り分け情報に使ったりするために、自身の管理するIPの情報を登録しあって、相互検索できるようにするデータベース、、かな。
https://en.wikipedia.org/wiki/Routing_Assets_Database

利用条件は?

radb.net自体のページを見ると下段にPricingの記載があるけど、これはISPが自分の情報を登録したりする用途、、ですかね。
第三者が情報検索だけ検索する場合の条件は、、明記されている箇所が見つられず。
。。。。知ってしまうと、、胸張って使いにくいな。。。

実際に使うには

検索結果はちょっと扱いにくいので注意。
例えばquiita.comを名前解決して帰ってきたIPで検索してみると、、

$ nslookup qiita.com                  
Server:         10.0.2.3
Address:        10.0.2.3#53

Non-authoritative answer:
Name:   qiita.com
Address: 54.64.187.122
Name:   qiita.com

$ whois -h whois.radb.net 54.64.187.122 
route:      54.64.0.0/15
descr:      Amazon EC2 NRT prefix
origin:     AS16509
mnt-by:     MAINT-AS16509
changed:    noc@amazon.com 20140627  #18:43:42Z
source:     RADB

route:      54.64.0.0/15
descr:      Amazon EC2 NRT prefix
origin:     AS14618
mnt-by:     MAINT-AS16509
changed:    noc@amazon.com 20140627  #18:43:12Z
source:     RADB

空白業でブロックを区切って見るもののようなのですが、複数回答が出るんですね。

上記はまだシンプルなパターンなのだけど、更新履歴がズラッと表示されてしまったり、RADB以外の複数のソースに登録されている情報を再帰的に引き抜いてくれることもあり、どれ信用すりゃいいんだ?という状態になる。
大体一番上の登録が新しく、かつレンジ的にも小さいものが表示されるのだけど、仕様の確認してないので確証はなし。

また、AS番号の"origin"は必ず記載されているのだけれど、説明に相当する"descr"は記載がなかったり、複数行に渡る長い説明だったりすることがある。。
最悪AS番号でもう一回whois引きせばいいのだろうけれど、面倒だなぁ。。

RDAP

Whoisの後継とされているサービス。
https://www.nic.ad.jp/ja/newsletter/No64/0660.html

応答上の書式が整理されている、、というコンセプトは聞くのですけれど、

$ curl -L http://rdap.apnic.net/ip/54.64.187.122 2>/dev/null| yq e -P
rdapConformance:
  - rdap_level_0
  - cidr0
  - arin_originas0
notices:
  - title: Terms of Service
    description:
      - By using the ARIN RDAP/Whois service, you are agreeing to the RDAP/Whois Terms of Use
    links:
      - value: https://rdap.arin.net/registry/ip/54.64.187.122
        rel: about
        type: text/html
        href: https://www.arin.net/resources/registry/whois/tou/
  - title: Whois Inaccuracy Reporting
    description:
      - 'If you see inaccuracies in the results, please visit: '
    links:
      - value: https://rdap.arin.net/registry/ip/54.64.187.122
        rel: about
        type: text/html
        href: https://www.arin.net/resources/registry/whois/inaccuracy_reporting/
  - title: Copyright Notice
    description:
      - Copyright 1997-2021, American Registry for Internet Numbers, Ltd.
handle: NET-54-64-0-0-1
startAddress: 54.64.0.0
endAddress: 54.95.255.255
ipVersion: v4
name: AMAZON-2011L
type: DIRECT ALLOCATION
parentHandle: NET-54-0-0-0-0
events:
  - eventAction: last changed
    eventDate: "2021-02-10T09:46:12-05:00"
  - eventAction: registration
    eventDate: "2014-06-20T11:04:13-04:00"
links:
  - value: https://rdap.arin.net/registry/ip/54.64.187.122
    rel: self
    type: application/rdap+json
    href: https://rdap.arin.net/registry/ip/54.64.0.0
  - value: https://rdap.arin.net/registry/ip/54.64.187.122
    rel: alternate
    type: application/xml
    href: https://whois.arin.net/rest/net/NET-54-64-0-0-1
entities:
  - handle: AT-88-Z
    vcardArray:
      - vcard
      - - - version
          - {}
          - text
          - "4.0"
        - - fn
          - {}
          - text
          - Amazon Technologies Inc.
        - - adr
          - label: |-
              410 Terry Ave N.
              Seattle
              WA
              98109
              United States
          - text
          - - ""
            - ""
            - ""
            - ""
            - ""
            - ""
            - ""
        - - kind
          - {}
          - text
          - org
    roles:
      - registrant
    remarks:
      - title: Registration Comments
        description:
          - "All abuse reports MUST include:\r"
          - "* src IP\r"
          - "* dest IP (your IP)\r"
          - "* dest port\r"
          - "* Accurate date/timestamp and timezone of activity\r"
          - "* Intensity/frequency (short log extracts)\r"
          - '* Your contact details (phone and email) Without these we will be unable to identify the correct owner of the IP address at that point in time.'
...

いや、長いって。
トップのnameを引き抜けばいいのかな。
RADbの方のがスッキリしていて、かつdescriptionもわかりやすい。

現状、あえてこちらを使いたいという感触はないかなぁ。。

MaxMind Geo IP

まず真っ先に思いつく、Splunkなどの分析サービスの中にも取り込まれてるあれですね。
無償版のGeoLight2というのがありますが、、

利用にはアカウントをちゃんと作らないと行けないので、気軽に使うときにはちとめんどい。。
今回は見送りで。

ipinfo.io

自分のIPアドレスを調べるときによく紹介されたりするやつですね。
こんなん。

$ curl ipinfo.io

IPの検索サービスもやってくれてるのですけれど、無償版はなし。。

番外編 クラウドサービスのIPレンジ

ガッツリ公開してくれている人もいる。全く公開してくれない人もいる。
https://docs.aws.amazon.com/ja_jp/general/latest/gr/aws-ip-ranges.html
https://www.microsoft.com/en-us/download/details.aspx?id=56519

他にも色々あるけれど

ブラウザでのアクセスを前提としていたり、広告ゴテゴテなものも多いので、良さげなのは今の所見つけられてないですね。。
あるいは良さげだけど、管理者の素性が追えないものとか。

とりあえずは、RADbを継続利用させていただくか。。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1