Skip to content

Instantly share code, notes, and snippets.

@dcode
Last active September 22, 2018 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcode/8cd4cb572af1bbd4295d6abb66152c98 to your computer and use it in GitHub Desktop.
Save dcode/8cd4cb572af1bbd4295d6abb66152c98 to your computer and use it in GitHub Desktop.
Snippet to get local default interface IP using iproute
ip route get $(ip route get 1.1.1.1 | awk '{ print $3 }') | awk 'NR == 1 {print $5}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment