Modified function generate_mac_from_hostname

This commit is contained in:
Xavier Logerais (Numericable - Ingénierie Système) 2013-12-05 13:40:40 +01:00
parent 7ed2490ac2
commit 01610154db

View File

@ -20,6 +20,7 @@ function generate_mac_from_hostname ()
{
if test -e "$1" ; then echo "Usage : $0 hostname" ; return ; fi
IFS='.' read -a array <<< "$(ssh admin dig +search +short $1)"
printf " IP : %3d.%3d.%3d.%3d\n" ${array[0]} ${array[1]} ${array[2]} ${array[3]}
printf " IP HEXA : %02X %02X %02X %02X\n" ${array[0]} ${array[1]} ${array[2]} ${array[3]}
printf " MAC : 52:54:00:%02X:%02X:%02X\n" ${array[1]} ${array[2]} ${array[3]}
printf "DHCP CONFIG : host $1 { hardware ethernet 52:54:00:%02X:%02X:%02X; }\n" ${array[1]} ${array[2]} ${array[3]}