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

ID 784383
Date 7/08/2024
Public
Document Table of Contents

7.2.1.1. Incoming Port Forwarding

Incoming port forwarding allows to forward a port on the host machine to a port on the simulated target machine. The following diagram shows this mechanism.

Figure 10. Incoming Port Forwarding

The command used to set up the incoming port forwarding is connect-real-network-port-in. The syntax for this command is the following:

connect-real-network-port-in (target-port|"service") ethernet-link 
     [service-node] ["host-ip"] [host-port] ["target-ip"] [-tcp] [-udp] [-f]

Here, the ethernet-link argument corresponds to the ethernet link associated to the port (normally, an ethernet switch). You also need to provide the IP of the target device and the target port to which you want to forward the incoming messages from the host.

An IP address and preferred port can be selected for incoming traffic on the simulation host using the host-ip and host-port arguments. If these arguments are not provided, Intel® Simics® simulator selects a port automatically and prints it on the Intel® Simics® simulator console, and receives all IPv4 traffic (i.e., IP 0.0.0.0) from that port. To forward multicast traffic, specify that multicast address (for example, specify 239.255.255.253 to forward IPv4 SLP traffic).

The connect-real-network-port-in command can also take the flags -tcp and -udp, which specify whether forwarding is set up for a TCP or a UDP port. If neither is provided, forwarding is set up for both the TCP and UDP ports.

The service node acts as a proxy for incoming traffic, so to initiate a connection to a specific port on the simulated target machine, a real machine must contact the corresponding open port on the PC host. The PC host is not a gateway to the simulated network.

Any UDP packets sent to a port on the PC host are forwarded to the specified port and IP address on the simulated network. For the simulated target machine to be able to return UDP packets to the real network, a separate forwarding rule must be set up using the connect-real-network-port-out command.

Any TCP connections to the port on the PC host are forwarded to the specified port and IP address on the simulated network. Since TCP connections are two-ways, once a connection has been established, data can be sent in both directions.

Note: You have to manually add the incoming ports to your host based software firewall if you want to access the simulated network from another machine. Tracking down network problems when you forget to update the firewall is annoying as the packets tend to get dropped silently without a log.

The FTP protocol needs to open additional ports when transferring files. Intel® Simics® simulator handles this by automatically opening outgoing ports for FTP when needed, so FTP works if it is in the active mode.

In the following section, an example is presented of a SSH connection that uses the connect-real-network-port-in command.

Note: To set up forwarding ports, the simulation must be in stop state.