This is for personal use, I have a debian running on a VM. I would like to know if BIND9 is required to be able to SSH using the hostname from host machine or modifying the /etc/hosts and resolv.conf will be sufficient?
1 Answer
No, you do not need BIND or any other DNS service running or available to connect to or from SSH servers so long as you are content to connect using either network addresses, hostnames configured in /etc/hosts, or host aliases in e. g. ~/.ssh/config configuration files.
If there is a DNS service available from another host, having it properly configured in resolv.conf will allow hostname resolution via DNS for SSH clients just as for other network utilities or applications.
-
I'm confused. I have configured both /etc/hosts and ~/.ssh/config files on the VM but SSH from the host machine to this VM using the hostname still doesn't work. I had to configure the hosts file on my host machine for it to kind of work but still not what I want to achieve. If I configure the hosts file on the host machine, I still need to use "ssh [email protected]" which is not what I want. My goal is to use only the VM hostname in Putty or use "ssh hostname" to connect to the VM. I have the feeling I'm missing something or looking at the wrong things.totalnewbie– totalnewbie2022-06-29 08:19:05 +00:00Commented Jun 29, 2022 at 8:19
-
If you want to use
ssh hostnameto connect to a host, there are three options: 1> Add an entry forhostnamein/etc/hostson the client pointing to the network address of that host. 2> Add aHoststanza to your user's.ssh/configfile with aHostNamedirective specifying the network address of the host. 3> If you are relying on DNS resolution and the FQDN of the host ishostname.example.com., addsearch example.comto/etc/resolv.confon the client host.DopeGhoti– DopeGhoti2022-06-30 14:33:35 +00:00Commented Jun 30, 2022 at 14:33 -
I want to HOST --> SSH --> DEBIAN VM. I read that whenever .ssh/config is configured in the guess machine, this ssh configuration is read when I am SSH'ing to the guest VM but it doesn't seem to do thattotalnewbie– totalnewbie2022-07-04 09:37:53 +00:00Commented Jul 4, 2022 at 9:37