The usual approach for this problem is to maintain a reference file, from where you map machine name with the ip & find the ip of the box from this file, but again after some time this solution seems to be not that efficient. Another solution is to have a DNS server where you can store such mappings & then you can access these machines using their names only, this is the idle solution but what if you don't have DNS server also still you have to execute the ssh command 'ssh user@machine".
I developed a simple solution for this problem, I created a utility script connect.sh, this script takes machine name as an argument & then we have multiple conditions statements which checks which ssh command to be executed for the machine name.
if [ "mc1" == $1 ]; then
elif [ "mc2" == $1 ]; then
elif [ "mc3" == $1 ]; then
This solution worked really well for me as now I'm saved from executing whole ssh command, also for machine name I've followed a convention i.e