Previous - Up - Next

4.10   Connect to a Real Network

A simulation can be connected to a real network. By doing this, simulated computers and real computers are able to communicate with each other.

Note: If you experience timing problems, for example TCP timeouts, when using real network, the simulation is running too fast. In these cases, slow it down by using the enable-real-time-mode command.

Before following the steps in this example, launch a new ebony-linux-firststeps.simics. Don't boot it yet.

Connecting a simulated machine to a real network is done with one command:

simics>  connect-real-network
No ethernet-link found, creating 'ethlink0'.
No service-node found, creating 'ethlink0_sn0' with IP ''.
Connecting device 'emac1' to 'ethlink0'
Connecting device 'emac0' to 'ethlink0'
NAPT enabled with gateway on link ethlink0.
Host TCP port 4021 −> on link ethlink0
Host TCP port 4023 −> on link ethlink0
Host TCP port 4080 −> on link ethlink0
Real DNS enabled at on link ethlink0.
simics>  continue

Note: Note that the IP address specified in the connect-real-network command is the IP address of the simulated machine

This command will create a new ethernet-link, connect it to both the simulated network cards, and to the real network. It will also enable NAPT, network address port translation. Finally, it will forward ports 4021, 4023 and 4080 to the simulated machine's telnet, FTP and HTTP ports.

To actually make the real network accessible from the simulated machine, the simulated system must be configured. These commands set up the service node as gateway and domain name server:

root@firststeps: ~# route add default gw
root@firststeps: ~# echo nameserver > /etc/resolv.conf
root@firststeps: ~#

This tells the simulated system to direct all accesses outside the local network to the gateway at (which is the service node connect-real-network created for us).

Now, if your computer is connected to Internet, we can try to telnet to a real computer on Internet. In this example we use

root@firststeps: ~# telnet 80
<TITLE>301 Moved Permanently</TITLE>
<H1>Moved Permanently</H1>
The document has moved <A HREF="">here</A>.<P>
<ADDRESS>Apache/1.3.31 Server at Port 80</ADDRESS>
Connection closed by foreign host.
root@firststeps: ~#

Since connect-real-network forwards ports to the telnet, FTP and HTTP ports of the simulated machine, it is possible to telnet into the simulated machine, or access its web server from a web browser. To access the web server, enter the address http://localhost:4080 in a web browser on your real machine.

Figure 2. Montavista Linux HTTP server front page

In an new shell on your computer, you can also try to telnet into the simulated machine:

joe@computer: ~$ telnet -l root localhost 4023
Connected to localhost.localdomain.
Escape character is '^]'.

Welcome to MontaVista Linux 2.1, Professional Edition

BusyBox v0.60.2 (2002.08.28-16:54+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

# exit
Connection closed by foreign host.
joe@computer: ~$

You can read more about real network in chapter 10.

Previous - Up - Next