Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
jefazo92
Contributor

Can an SSH connection to a Fortigate be stablished with a hostname (not an IP address)?

Hi, I want to connect to my Fortigate using its hostname via SSH with PuTTY. However, the documentation only mentions establishing a session via IP address and whenever I try to connect by writing the hostname in the Hostname (or IP address) field, it gives me the error host does not exist. Session is established successfully without any errors if I use the the MGMT port's IP address instead.

1 Solution
Hatibi
Staff
Staff

Yes it should work. It is probably a DNS issue.

Can you ping the Fortigate by hostname through cmd?

Try adding Hostname to IP relation in your windows hosts file at C:\Windows\System32\drivers\etc\hosts.

View solution in original post

3 REPLIES 3
Hatibi
Staff
Staff

Yes it should work. It is probably a DNS issue.

Can you ping the Fortigate by hostname through cmd?

Try adding Hostname to IP relation in your windows hosts file at C:\Windows\System32\drivers\etc\hosts.

jefazo92

@Hatibi It worked by adding the hostname to the hosts file as you mentioned above! I was able to both ping and SSH into my device using the hostname. There was no need for me to enable DNS Server on the MGMT interface. Thank you very much!

Hatibi
Staff
Staff

In this case you simply need to make sure that your DNS server, configured for your local host (PC), is able to resolve the Hostname to an IP. 

No need to enable DNS in MGMT port.

 

Try the following:

 

In your PC edit the "hosts.txt" file located in C:\Windows\System32\drivers\etc\  and add an entry for the FortiGate hostname.

The Hosts file acts as a local DNS cache/resolver.

Example:

10.10.10.1 FortiGateLab   <---- In your case replace "FortiGateLab" with the hostname you have.

 

This external guide explains hosts file is: https://en.wikiversity.org/wiki/Hosts_file/Edit#:~:text=The%20hosts%20file%20is%20a,be%20modified%20....

Announcements

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Labels
Top Kudoed Authors