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

ID 784383
Date 7/08/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

7.2.1. Port Forwarding

Port forwarding forwards traffic on TCP and UDP ports between the simulated network and the real network. It also allows forwarding DNS queries from the simulated network to the real network. Port forwarding can be used with any kind of IP network on the host; it is not limited to Ethernet networks.

Port forwarding is the easiest way to access the real network for simple TCP or UDP connectivity, for example, telnet or FTP usage. Intel® Simics® simulator does not need administrative privileges to run port forwarding, and neither the simulation host nor any other host needs to be configured in any way.

Port forwarding is managed by the Intel® Simics® Service Node connected to an Ethernet link. It is the service node that listens for traffic on both the real and simulated networks and forwards it to the other side. All port forwarding commands except connect-real-network therefore take as argument an Ethernet link with a connected service node.

There are four distinct parts in the port forwarding solution:

  • Forwarding of specific ports from the real network to the simulated network.
  • Forwarding of specific ports from the simulated network to the real network.
  • NAPT from the simulated network to the real network.
  • Forwarding DNS queries to the real network.

There is also a convenience command named connect-real-network that automatically sets up NAPT for outgoing traffic, forwarding of DNS queries to the real network, and incoming port forwarding for some common services. If there is no Ethernet link object, one is created and set up.

The connect-real-network-napt command is a subset of the connect-real-network command that only handles the NAPT part, and this is a preferred alternative to enable NAPT for accesses that are initiated from the simulation time. This command enables access to the host PC from target system without the need to configure the simulated machine with a real IP address.

The list-port-forwarding-setup command describes the current port forwarding setup: it lists all incoming and outgoing ports, as well as the NAPT and DNS forwarding status.

Note: Pinging between the simulated network and the real network does not work when using port forwarding, so ping must not be used to test if the connection is working. Ping uses the ICMP protocol, but only TCP and UDP traffic is supported with port forwarding.

The syntax for the connect-real-network-napt command is the following:

connect-real-network-napt ethernet-link [service-node]

NAPT (Network Address Port Translation) uses the IP address and a port number of the host that Intel® Simics® simulator is running on to perform the access. Replies are then translated back to match the request from the simulated machine. This command enables NAPT for accesses that are initiated from the simulated machine.

The following capture shows an example of the use of the connect-real-network and list-port-forwarding setup commands:

#Intel Simics simulator CLI

simics> list-port-forwarding-setup

simics> connect-real-network-napt ethernet-link=ethernet_switch0 service-
node = service_node_cmp0 
NAPT enabled with gateway 10.10.0.1/24 on link ethernet_switch0.link.
NAPT enabled with gateway fe80::2220:20ff:fe20:2000/64 on link ethernet_switch0.link.
simics> list-port-forwarding-setup 

NAPT enabled with gateway 10.10.0.1/24 on link ethernet_switch0.link.
NAPT enabled with gateway fe80::2220:20ff:fe20:2000/64 on link ethernet_switch0.link.

The output shows that a NAPT has been enabled on the Ethernet link. The service node in charge of the port forwarding needs to be configured according to the service required as shown in the next sections.

The following table defines the ports that are standardized for some of the services supported. These are used in the following sections that describe examples on how these services can be used with Intel® Simics® simulator.

Table 25.  Standardized Ports
Service Protocol Port number
FTP TCP 20, 21
SSH TCP 22
SCP TCP 22
Telnet TCP 23
HTTP TCP 80
gdb TCP 9123
TFTP UDP 69