Created
April 27, 2017 21:16
-
-
Save mpontillo/397da95888ac2de4bf83669931481daa to your computer and use it in GitHub Desktop.
Gets a list of DHCP servers based on the current running DHCP clients.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ps auxwwww | grep dhclient | grep -o '\-lf .*' | awk '{ print $2 }' \ | |
| xargs -n 1 grep -o 'dhcp-server-identifier [A-Za-z0-9\.:]*' 2> /dev/null \ | |
| sort -u | awk '{ print $2 }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment