add function for test ip adresses

This commit is contained in:
Jakobus Schürz 2021-10-19 11:49:51 +02:00
parent 517f8fe246
commit 1d09e7368d
2 changed files with 21 additions and 0 deletions

View file

@ -1016,4 +1016,24 @@ vgrename_full () {
sed -i "s/${altevolumegroup}/${neuevolumegroup}/g" /etc/initramfs-tools/conf.d/resume
update-initramfs -c -k all
}
getfreeip () {
local N=$1
sudo nmap -v -sn -n $1 -oG - | awk '/Status: Down/{print $2}'
}
getusedip () {
local N=$1
local DNS=$2
sudo nmap -v -sn -n $1 -oG - | awk '!/Status: Down/{print $2}'|while read i;do
echo "$i: $(dig "${DNS:+@}${DNS}" -x $i +short +search)"
done
}
#EOF

View file

@ -5,3 +5,4 @@ $(getbashrcfile) ~/.aliases
${MSC_BASE}/aliases
${MSC_BASE}/PS1
${MSC_BASE}/bash_completion.d/*
${MSC_BASE}/bin/getfreeip