DEV Community

Matthew LaFalce
Matthew LaFalce

Posted on

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

Top comments (1)

Collapse
 
ducsiu profile image
Đức

Thank you so much.