LoginSignup
9
9

More than 5 years have passed since last update.

グローバルIP、プライベートIPだけを出力するワンライナー

Last updated at Posted at 2013-06-21

グローバルIP
/sbin/ifconfig eth0 | grep "inet addr:" | cut -f2 -d : | cut -f1 -d " "

プライベートIP
/sbin/ifconfig eth1 | grep "inet addr:" | cut -f2 -d : | cut -f1 -d " "

chefでのサーバ自動構築を試している時に、
欲張って別のミドルウェアサーバへの接続も自動化できないか、と試みたときに作ったものです。
結局そこまで手が回らなかったのですが、何かの折に役に立てば。

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