Skip to content

Instantly share code, notes, and snippets.

@Jimmy-Xu
Forked from djKianoosh/interfaces.groovy
Created September 27, 2016 16:50
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 Jimmy-Xu/9330652ec7dc7699b7b358c78e895a66 to your computer and use it in GitHub Desktop.
Save Jimmy-Xu/9330652ec7dc7699b7b358c78e895a66 to your computer and use it in GitHub Desktop.
List out network interfaces
def interfaces = NetworkInterface.getNetworkInterfaces()
while (interfaces.hasMoreElements()) {
def addresses = interfaces.nextElement().getInetAddresses()
while (addresses.hasMoreElements()) {
println addresses.nextElement().getHostAddress()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment