How to find outgoing IP addresses on your Linux machine.

matthewlafalce

Matthew LaFalce

Posted on March 9, 2022

How to find outgoing IP addresses on your Linux machine.

Here is a small post to help you find the outgoing IP address of you Linux machine.

  1. To find the outgoing internal IP address only
ip route get 8.8.8.8 | head -1 | gawk '{ print $7 }'
Enter fullscreen mode Exit fullscreen mode
  1. To find the outgoing internal IP address along with the interface name.
ip route get 8.8.8.8 | head -1 | gawk '{ print $5,$7 }'
Enter fullscreen mode Exit fullscreen mode
  1. In the case that your machine is connected to the internet, to find the outgoing external IP Address.
curl ifconfig.me
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
matthewlafalce
Matthew LaFalce

Posted on March 9, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related