LoginSignup
12
12

More than 5 years have passed since last update.

curlでグローバルIPアドレスを確認する方法

Last updated at Posted at 2017-10-17

はじめに

curlでグローバルIPアドレスを確認する方法についてまとめました。(類似の記事は多数ありますが、自分用にまとめました。)

ipconfig.me

  • ifconfig.meというネットワークの接続情報を表示してくれるウェブサービスがあります。そこに curl をするとグローバルIPを返してくれます。
  • https://ifconfig.co/https://ipinfo.io/ipなどの類似サービスもあります。 (@lo48576 さんより共有)
$ curl http://ifconfig.me/
xxx.xxx.xxx.xxx

Amazon EC2

EC2では、インスタンスに関するデータをメタデータで管理しています。各種情報を参照できますが、グローバルIPはpublic-ipv4で確認できます。詳しくはこちら

$ curl http://169.254.169.254/latest/meta-data/public-ipv4
xxx.xxx.xxx.xxx
12
12
2

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
12
12