MacOS – How to bind hostname with ip

dnsmacosNetworkvmware

There are 2 VMs running on VMWare on a remote server. For instance: devops-01 and devops-02. Both of them have SSH access enabled.
To access to the first one I do: ssh dev@devops-01. For the other one: ssh dev@192.168.80.y (y sometimes changes).

Normally I only used devops-01 and rarely the other one. Today, it all changed. Ideally I would like to access both VMs like this: ssh dev@devops-<ID>. But, I'm sure that involves calling the server guy and he's on vacations. So, I thought in "switching" my VMs settings.

I copied all the settings from System Preferes > Network > Ethernet from the devops-01 and pasted them to the devops-02 corresponding settings. (IP, Subnet Mask, Router, DNS Server, Search Domains are the same).
I also went to System Preferences > Sharing and edited the computer name on devops-02. (So now, it says devops-01).
Then, I stoped the old devops-01 VM. And now, I have the old devops-02 VM running, supplanting devops-01. BUT ping devops-01says that there is no route to it. Of course it works fine using the ip. But, that's not my intention.

What am I doing wrong?

Best Answer

Correct me if I'm wrong here, but you'd like a hostname to direct you to a specific IP address of your choice. If so, edit the hosts file located in /etc/hosts by adding a line like this below the localhost entry:

123.45.67.89 devops-01

Again, correct me if I'm misunderstanding you.