Domain name for Raspberry pi
Solution 1:
If you just want to use the simpler command to establish ssh connection you can try to make a config
file:
$ cat ~/.ssh/config
Host pi4
HostName 192.168.88.252
User ak
IdentityFile ~/.ssh/id_ecdsa
Host pi3
HostName 192.168.88.248
User ubuntu
IdentityFile ~/.ssh/id_ecdsa
And If you want to use domain names, you must assign them to your raspberry somehow. I use MikroTik, so I just add static DNS records:
[admin@MikroTik] > ip dns static print
Flags: D - dynamic, X - disabled
# NAME REGEXP ADDRESS TTL
0 router.lan 192.168.88.1 1d
1 pi4.local 192.168.88.252 1d
2 pi3.local 192.168.88.248 1d
As an alternative, you can edit hosts
file on your machine like that:
$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 pi4
192.168.88.252 pi4.local
192.168.88.248 pi3.local
P.S But of course, you need to make sure that your raspberry have a static IP address if you don`t want to edit all this configs every time