Intel® Simics® Simulator for Intel® FPGAs: User Guide

ID 784383
Date 4/01/2024
Public
Document Table of Contents

7.2.1.1.1. Example of an SSH Connection with Incoming Port Forwarding

The following capture shows an example that creates an incoming port connection for a SSH connection.

HostPC | Target system
 Incoming    4022 ->  22
#Intel Simics simulator CLI 

simics> connect-real-network-port-in ethernet-link = ethernet_switch0 
target-ip=10.10.0.100 target-port = 22 host-port = 4022 -tcp

Host TCP port 4022 -> 10.10.0.100:22
Warning: This can expose the target system on the host local network.
simics> list-port-forwarding-setup 
Host TCP port 4022 -> 10.10.0.100:22
simics> run

In the above example, the Ethernet link is called ethernet_switch0. It is created during the network setup. The IP address of the target is 10.10.0.100, and the target port is 22, which is the standard for SSH connection. The host PC port is 4022 and because the SSH service uses TCP protocol, the -tcp argument is used. In this case, the incoming messages to the 4022 port is forwarded to 22 ports in the simulated target system. After the setup, you can list the forwarding ports and confirm that a new entry was created.

After this setup, you can exercise the SSH connection. Start an SSH connection from the Host PC using the port 4022 in the localhost (host PC). The user connected to the target system is root. This is shown in the following capture of the host PC terminal which runs on Linux. From this system, you can confirm that you are connected to the target system which also is running Linux:

# Host Terminal

/home/simicsUser/SimicsInstallDir/project-1$ ssh -p 4022 root@localhost
The authenticity of host '[localhost]:4022 ([127.0.0.1]:4022)' can't be established.
ECDSA key fingerprint is SHA256:x5hSN5WbVezANJl2YXzyIVI0p1CT2osAjZPW8QrG44E.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[localhost]:4022' (ECDSA) to the list of known hosts.
Last login: Thu Apr 28 17:44:21 2022
root@psgdevice:~# whoami
root
root@psgdevice:~# exit
logout
Connection to localhost closed.
/home/simicsUser/SimicsInstallDir/project-1$