0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

コマンドを使用したグローバルIPの確認方法いろいろ

Last updated at Posted at 2025-02-11

調べてみたらいろいろあったのでメモ。

# https://github.com/mpolden/echoip
# Star 3k
$ curl ifconfig.co
xxx.xxx.xxx.xxx
# https://ipinfo.io/about
$ curl ipinfo.io
{
  "ip": "xxx.xx.xx.xx",
  "hostname": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "city": "xxxxxxxx",
  "region": "xxxxxxxx",
  "country": "JP",
  "loc": "xxxxxxxxxxxxxxxx",
  "org": "xxxxxxxxxxxxxxxxxxxxxx",
  "postal": "xxxxxxx",
  "timezone": "Asia/Tokyo",
  "readme": "https://ipinfo.io/missingauth"
}

# グローバルIPのみ取得
$ curl ipinfo.io/ip
xxx.xxx.xxx.xxx
# IPv6でアクセスするとIPv6で帰ってくる
$ curl ifconfig.io

# 明示的にIPv4を指定するには -4 をつける
$ curl ifconfig.io -4
xxx.xxx.xxx.xxx
# IPv4のみに対応
$ curl ifconfig.me
xxx.xxx.xxx.xxx
# https://github.com/masahide/inet-ip.info
$ curl inet-ip.info
xxx.xxx.xxx.xxx
# https://github.com/masahide/inet-ip.info
$ curl ipecho.net/plain
xxx.xxx.xxx.xxx
# 応答がはやい
$ ipaddr.show
xxx.xxx.xxx.xxx
# Google
$ curl https://domains.google.com/checkip
xxx.xxx.xxx.xxx
# AWS
$ curl checkip.amazonaws.com
xxx.xxx.xxx.xxx

まとめ

AWSにもグローバルIPを確認できるサービスがあった。
以下が覚えやすく使いやすかった。

  • ipinfo.io
  • checkip.amazonaws.com
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?