In this section we demonstrate transferring data from the host to the target using regular networking.
Intel Simics simulator can let the target machine connect to any network that the host system has access to. This can be achieved in several ways, where NAPT is the simplest option. The simulator then acts similarly like a regular home router, performing network address translation between the simulated network and the network that the host is connected to. The service node DNS server can also act as a proxy for real DNS.
Follow the preparation steps to launch the simulator and reach prompt in the target machine.
Enable real time mode, to avoid network timeouts. This makes sure that the simulator will not run the simulation faster than real time.
simics> enable-real-time-mode
Real-time mode enabled.
Connect to real network using NAPT.
simics> connect-real-network-napt ethernet-link = ethernet_switch
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.
Set up a simple HTTP server on the host. This command can naturally also be
executed in any host shell, but here we use the shell command from within
CLI.
simics> $python = (lookup-file "%simics%/bin/mini-python")
simics> $imgs = (lookup-file "%simics%/targets/common/images")
simics> shell -bg ($python + " -m http.server --directory " + $imgs)
For easier access of the host system from the target, we add the host IP address to the service node DNS.
simics> service_node.sn.add-host name = "host0" ip = (sim->host_ipv4)
Adding host info for IP 10.123.242.138: host0.network.sim
Start the simulation.
simics> run
running>
Before downloading the agent, we will demonstrate how to enable real DNS and test that it works.
First enable real DNS from CLI.
running> service_node.enable-real-dns
Real DNS enabled.
Test the DNS from the target console.
# host www.intel.com
www.intel.com has address 104.81.114.201
Host www.intel.com not found: 4(NOTIMP)
Host www.intel.com not found: 4(NOTIMP)
Download the simics_agent_binaries.zip from the host using curl in the target console.
# curl -s http://host0:8000/simics_agent_binaries.zip \
--output simics_agent_binaries.zip
On the target machine, we can verify that the file has been transferred.
# ls simics_agent_binaries.zip
simics_agent_binaries.zip
# unzip -q simics_agent_binaries.zip
# ls ./simics_agent_x86_linux64
./simics_agent_x86_linux64
In this example we only connected to the host itself, but in fact the same technique can be used to connect to any other system that the host can access. Also note that the HTTP server we open on the host will be accessible by any web browser.