Previous - Up - Next

10.1   Accessing Host Ethernet Interfaces

When connecting to a real network using other connection types than port forwarding, Simics needs low-level access to the simulation host's Ethernet interfaces to send and receive packets. However, operating systems do not usually allow user programs low-level access to Ethernet interfaces. You therefore have to configure the simulation host to allow Simics low-level access.

This can be done in two ways. You can give administrative privileges to a small helper program called openif, which will access the simulation host's Ethernet interface for Simics. This is called raw access in Simics. Or, you can create a virtual Ethernet (TAP) interface that Simics can access with user privileges. This is called TAP access in Simics.

Different connection types can use different access types. Ethernet bridging connections can use either raw or TAP access, IP routing connections can only use raw access, and host connections can only use TAP access.

To tell Simics to use raw or TAP access when creating an Ethernet bridging connection, specify raw or tap as the host-access argument to connect-real-network-bridge.

10.1.1   Raw Access

With raw access, Simics uses a small helper program, openif, to access the simulation host's Ethernet interfaces. openif is launched from Simics and executes with administrative privileges. This way you do not need administrative privileges to connect Simics to the real network once openif has been installed. Simics Installation Guide contains instructions for installing openif.

If openif is not installed in its default location, you can use the command network-helper to tell Simics where to find it. This command needs to be issued before connecting to the real network, for example:

simics> network-helper /usr/local/sbin/openif

Note: If openif is not installed so that it will run with administrative privileges, the connection to the real network will fail.

Usually, an Ethernet interface only receives packets addressed to the host itself, and ignores other packets. However, when you use Ethernet bridging without MAC address translation and raw access, the interface also needs to receive packets addressed to the simulated machines. This can be achieved be enabling promiscuous mode on the interface. On Linux, this is done by specifying the promisc argument to ifconfig, which requires administrative privileges. For example, if you want to use the eth0 interface:

computer# ifconfig eth0 promisc

Enabling promiscuous mode on an interface means that the operating system will have to process all incoming packets. On a network with a lot of traffic, this may therefore cause a performance degradation on the simulation host. To disable promiscuous mode when it is no longer needed, use the -promisc argument to ifconfig:

computer# ifconfig eth0 -promisc

10.1.2   TAP Access

Note: TAP access is not supported on Solaris host.

With TAP access Simics will connect the simulated network to a virtual Ethernet (TAP) interface provided by the operating system. Accessing the TAP interface does not require administrative privileges, so once the TAP interface has been configured you can connect Simics to the real network without administrative privileges.

The TAP interface can either be bridged to a real Ethernet interface to create an Ethernet bridging connection, or configured with an IP address to create a host connection. Either way, creating a TAP interface that Simics can use is done in two simple steps. These commands require administrative privileges:

  1. Give the user running the simulation access to the /dev/net/tun device.

    computer# chmod 666 /dev/net/tun
  2. Create the TAP interface. Here the name of the user that will be using the TAP interface is assumed to be joe and the name of the TAP interface will be sim_tap0, but you should of course replace them with the correct user name and the name of the TAP interface that you want.

    computer# tunctl -u joe -t sim_tap0
    Set 'sim_tap0' persistent and owned by uid 4711

To remove a TAP interface when you are done with it, use the -d argument to tunctl. Again, this requires administrative privileges:

computer# tunctl -d sim_tap0
Set 'sim_tap0' nonpersistent

Note: The tunctl utility is usually not present in default Linux installations, so you may therefore have to install it yourself. It is usually included in the User Mode Linux package. For convenience, a pre-built version is included in [simics]/hosttype/sys/bin/ (replace hosttype with x86-linux or amd64-linux depending on your host type).

Previous - Up - Next