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

ID 784383
Date 11/16/2024
Public
Document Table of Contents

7.1. Network Simulation and Service Node

Among many features that the Intel® Simics® simulator offers, it can also simulate a network of target machines. For this, Intel® Simics® simulator includes a component named service node which acts like a separate machine on the simulated network, with its own IP address. The service node can expose common useful network services, such as TFTP (tftp server), FTP (ftp server), NFS (nfs server), DHCP, and DNS.

The Intel® Simics® simulator also includes a GDB server that can be used to debug target software from the host system. The Intel® Simics® simulator also supports the port forwarding feature that can be used to support connectivity with the host PC with the simulated network enabling services such as SSH, telnet, TFTP, HTTP, SCP. For this, the service node can be used to automatically configure the port forwarding.

The following figure describes the Intel® Simics® simulator network capabilities. Here, the Intel® Simics® Service Node is used to interface in the simulated network the target systems with each other acting as Gateway. The Intel® Simics® Service Node can be configured to have any IP address. In the figure, it is configured with the 10.10.0.1 IP address. The simulated network and the Intel® Simics® Service Node work essentially as an ethernet network, but the Intel® Simics® Service Node can support DHCP and ICMP protocols in the simulated network side. This means that the Intel® Simics® Service Node can assign an IP address to the target systems connected to the network (DHCP) and it can also respond to pings issued from these target systems (ICMP, pings to the Intel® Simics® Service Node IP).

When the Intel® Simics® Service Node interacts with port forwarding or NAPT to connect with the host PC or a PC in the real network, it only supports TCP and UDP protocols. This means that the connection between the target systems and the host PC (or other PC in a real network) only supports services that rely on these 2 protocols. ICMP between host PC (or any other PC in the real network) and a target system in the simulated network is not supported, so pings between them are not supported. This also can be seen in the following figure:

Figure 9.  Intel® Simics® Simulator Network Capabilities
The following Intel® Simics® simulator CLI capture shows the command that can be used to get some information about the Intel® Simics® Service Node. The object that corresponds to the service node is service_node_cmp0. For this, you can:
  • Get the MAC address and IP assigned to this component.
  • Observe the ARP table.
  • Change the verbosity level of the service node
  • Get more information about what is going on in the simulation.
  • Obtain more information about the network services enabled, forwarding ports configuration and other configuration parameters used in the network simulation.
  • Obtain information about the TFTP sessions active and size of the IP pool in for the DHCP service.
#Intel Simics simulator CLI 

simics> service_node_cmp0.list-host-info 
----------------------------------------------------
IP              name.domain            MAC 
----------------------------------------------------
10.10.0.1   simics0.network.sim  20:20:20:20:20:00
----------------------------------------------------
simics> service_node_cmp0.arp

Host   IP                      HWaddress                     Interface
    10.10.0.100               ba:f0:87:6e:59:94   service_node_cmp0.snd[0]
    fe80::b8f0:87ff:fe6e:5994 ba:f0:87:6e:59:94   service_node_cmp0.snd[0]

simics> service_node_cmp0.log-level 4
[service_node_cmp0] Changing log level in component: 0 -> 4

simics> service_node_cmp0.sn.info
Information about service_node_cmp0.sn [class service-node]
===========================================================
 
Interface 'service_node_cmp0.snd[0]':
                   Network : <the eth-switch-link 'ethernet_switch0.link'> (via
                             ethernet_switch0.ep7d4650d67bfa86be)
               MAC address : 20:20:20:20:20:00
              IP addresses : 10.10.0.1/24
                             ff02::1:2/64
                             fe80::2220:20ff:fe20:2000/64
                       MTU : 1500
 
Services:
                      DHCP : enabled
                     DHCP6 : enabled
                       DNS : enabled
                       NTP : disabled
                      RARP : disabled
                       RPC : enabled
                      TFTP : enabled
 
DHCP:
        Maximum lease time : infinite
 
TFTP:
                 Directory : none
 
Port forwarding:
      All tcp output ports : Forwarded with NAPT
      All udp output ports : Forwarded with NAPT
    Input tcp 0.0.0.0:4080 : Forwarded to 10.10.0.100:80

simics> service_node_cmp0.sn.status
Status of service_node_cmp0.sn [class service-node]
===================================================
 
TFTP sessions:
 
Host pools:
     : IP           Name  Domain       Size
     : 10.10.0.100  dhcp  network.sim  100

The following capture shows some basic network commands exercised from the Linux shell. First, the ifconfig command is used to get the target system IP. Then, the route command is used to get the Linux kernel routing tables, showing that the service node corresponds to the gateway. Finally, a ping is done to try to reach the service node. In this case, you can confirm the connectivity between the target system and the Intel® Simics® Service Node.

# Target Serial Console 

root@psgdevice:~# ifconfig 
eth0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
   inet 10.10.0.100  netmask 255.255.255.0  broadcast 10.10.0.255
   inet6 fe80::b8f0:87ff:fe6e:5994  prefixlen 64  scopeid 0x20<link>
   inet6 11:2233:4455:6677:b8f0:87ff:fe6e:5994  prefixlen 64  scopeid 0x0<global>
   ether ba:f0:87:6e:59:94  txqueuelen 1000  (Ethernet)
   RX packets 567  bytes 82396 (80.4 KiB)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 790  bytes 124958 (122.0 KiB)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
   device interrupt 21  base 0x2000  

root@psgdevice:~# route -n

Kernel IP routing table
Destination  Gateway      Genmask         Flags Metric Ref    Use Iface
0.0.0.0      10.10.0.1    0.0.0.0         UG    10     0        0 eth0
10.10.0.0    0.0.0.0      255.255.255.0   U     0      0        0 eth0
10.10.0.1    0.0.0.0      255.255.255.255 UH    10     0        0 eth0
root@psgdevice:~# ping 10.10.0.1 -c 1

PING 10.10.0.1 (10.10.0.1): 56 data bytes
64 bytes from 10.10.0.1: seq=0 ttl=31 time=0.268 ms

The following capture shows the log observed in the Intel® Simics® simulator CLI after 1 single Ping when the verbosity of the service node was increased. From this capture, you can identify the messages that are being transmitted and received as part of the ICMP protocol:

#Intel Simics simulator CLI  
running> 
[service_node_cmp0.sn info] ETH: dhost=20:20:20:20:20:00 shost=ba:f0:87:6e:59:94 type=0x800 (length 102)
[service_node_cmp0.sn info] IP: hl=5 v=4 tos=0 len=84 id=44935 off=16384 ttl=64 p=1 sum=0x76a9 src=10.10.0.100 dst=10.10.0.1
[service_node_cmp0.sn info] ICMP: type=8 code=0 len=64
[service_node_cmp0.sn info] Incoming ICMP ECHO request from 10.10.0.100
[service_node_cmp0.sn info] Sending ICMP reply. Type 0 Code 0
[service_node_cmp0.sn info] IP: outgoing packet to 10.10.0.100
[service_node_cmp0.sn info] Routing to 10.10.0.100 through service_node_cmp0.snd[0]; next hop 10.10.0.100
[service_node_cmp0.sn info] Sending IP packet to network ethernet_switch0.epead67f45b7c9355 - next hop 10.10.0.100
[service_node_cmp0.sn info] ETH: dhost=20:20:20:20:20:00 shost=ba:f0:87:6e:59:94 type=0x806 (length 68)
[service_node_cmp0.sn info] ARP: Who is 10.10.0.1? Tell 10.10.0.100 (ba:f0:87:6e:59:94)
[service_node_cmp0.sn info] ARP: Adding 10.10.0.100 -> ba:f0:87:6e:59:94
[service_node_cmp0.sn info] Received ARP request from ba:f0:87:6e:59:94. 
[service_node_cmp0.sn info] Sending ARP reply to '10.10.0.100'.
Note: Intel® Simics® provides support to use standard tools to monitor network traffic with the tcpdump and wireshark Intel® Simics® simulator commands.