Using port forwarding, the target can also be accessed from the host, and potentially from any system that can access the host, so this should be used with care. Here is an example of transferring a file to the target from the host over ssh.
This assumes that the host has ssh installed.
Install ssh on your host, if not already present.
Follow the preparation steps to launch the simulator and reach prompt in the target machine.
Enable real time mode, to avoid network timeouts.
simics> enable-real-time-mode
Real-time mode enabled.
Inspect the service node DNS to find the IP address of the target machine.
simics> service_node.sn.list-host-info
┌───────────┬───────────────────┬─────────────────┐
│ IP │ name.domain │ MAC │
├───────────┼───────────────────┼─────────────────┤
│10.10.0.1 │simics0.network.sim│20:20:20:20:20:00│
│10.10.0.100│board.network.sim │00:17:a0:00:00:00│
└───────────┴───────────────────┴─────────────────┘
Set up port forwarding to the target. By default, this opens a few ports on the host corresponding to FTP, SSH, Telnet and HTTP, and connects them to the target. Other ports can also be opened by specifying parameters to the command.
simics> connect-real-network target-ip = 10.10.0.100
NAPT enabled with gateway 10.10.0.1/24 on link ethernet_switch.link.
NAPT enabled with gateway fe80::2220:20ff:fe20:2000/64 on link ethernet_switch.link.
Host TCP port 4021 -> 10.10.0.100:21
Host TCP port 4022 -> 10.10.0.100:22
Host TCP port 4023 -> 10.10.0.100:23
Host TCP port 4080 -> 10.10.0.100:80
Warning: This can expose the target system on the host local network.
Real DNS enabled at 10.10.0.1/24 on link ethernet_switch.link.
Real DNS enabled at fe80::2220:20ff:fe20:2000/64 on link ethernet_switch.link.
Now we can transfer the agent to the target machine over ssh. Note that we connect to the host itself and make use of the port forwarding.
simics> $fn = "%simics%/targets/common/images/simics_agent_binaries.zip"
simics> $fn = (lookup-file $fn)
simics> shell -bg "scp -P 4022 " + $fn + " simics@localhost:agent.zip"
Start the simulation.
simics> run
running>
On the target machine, we can verify that the file has been transferred.
# ls agent.zip
agent.zip
# unzip -q agent.zip
# ls ./simics_agent_x86_linux64
./simics_agent_x86_linux64
In this example we only copied a file, but using port forwarding, we can connect to other network service available on the target, such as web servers.