How it works...

Starting with the wildcard host entry (Host *), this is a global entry. Settings within this block will apply to all hosts (except CentOS2-V6, which we'll get to soon):

Host * !CentOS2-V6 IdentityFile ~/.ssh/id_ed25519 Port 22

Here, we've said that each and every host in this file will use our Ed25519 key to connect, and we will always connect on port 22. This block should be used for global settings in general. You can also omit it entirely if you desire:

Host CentOS2-V4 Hostname User vagrant

In our first specific host block, which we've called CentOS2-V4, we specify the IPv4 address of the host, and the user to use.

Connecting to this entry with verbosity turned up looks like this:

[vagrant@centos1 ~]$ ssh ...

Get Linux Administration Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.