Created on
07-18-2023
04:13 AM
Edited on
09-30-2024
09:37 PM
By
Jean-Philippe_P
Description | This article describes how to use FortiGate as an SSH user to log in and access another host device. |
Scope | FortiGate. |
Solution |
Login to the FortiGate CLI console or through Putty using SSH or Telnet.
Use the below command syntax to log in to FortiGate.
execute ssh <user@host> [port]
Example:
execute ssh admin@172.16.0.254
In case, the SSH server is using customer port number (2202), then, it is necessary to execute the command as shown below:
execute ssh admin@172.16.0.254 2202
By default, FortiGate will check the routing table for the SSH server IP and select the egress interfaces IP as a source IP to connect the server.
FGT # execute ssh admin@172.16.0.254
FGT # get router info routing-table details 172.16.0.254 Routing table for VRF=0
FGT # show system interface port1 <- next
FGT # diagnose sniffer packet any host 172.16.0.254 and port 22 4 0 l
It is possible to set the source interface and source IP to force using a specific set option while initiating the communication.
FGT # execute ssh-options
If the SSH server IP is reachable via a logical interface like a tunnel, FortiGate uses the lowest index interface IP as the source. This will cause an issue if the same IP is not part of the phase2 selector or is not routable in a remote peer network.
In this case, it is necessary to set the source IP in ssh-options to SSH to a remote server connected via tunnel. The solution is to set the source IP while doing SSH.
FGT # execute ssh-options source 10.0.0.1 FGT # execute ssh admin@10.172.0.254
FGT # get router info routing-table database Routing table for VRF=0
ACTIVE # get vpn ipsec tunnel name tunnel1 gateway . .
FGT # diagnose sniffer packet any "host 10.172.0.1" 4 0 l
|
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.