4.2.1 Port Forwarding 4.2.3 Host Connection
Ethernet Networking Technology Guide  /  4 Connecting to a Real Network  /  4.2 Connection Types  / 

4.2.2 Ethernet Bridging

Simics can act as a bridge between simulated Ethernet networks and the real Ethernet networks of the host. With this type of connection, the simulated machines will appear as directly connected to the real network, both to the simulated machines and to the hosts on the real network. For that reason, the simulated machines should be configured with IP addresses from the same subnet as the real hosts.

Since the simulated machines appear to be located on the real network, there is no need to configure routes on real hosts that communicate with it. They can find the simulated machines by sending ARP requests, just like they would find other real hosts.

When using a bridged connection, it is recommended to use a dedicated host network interface for the bridge, not the interface that the host uses for general network access. Otherwise, special configuration of the bridge interface is necessary for any kind of network access for the host. The details about this configuration will not be covered in this manual. See section 4.3 for how to set up TAP access.

To create a bridged connection to the real network, use the connect-real-network-bridge command. It takes an interface argument that specifies which host TAP interface that should be used.

4.2.2.1 Example

This example assumes that the simulation is starting from the checkpoint prepared in section 4.1, and that a TAP bridge has been set up as described in section 4.2.2.2.

To set up an Ethernet bridging connection between the real network and the simulated network, run the connect-real-network-bridge command. This will automatically create an Ethernet link, connect it to the simulated machine and set up bridging to the real network:

simics> connect-real-network-bridge
No Ethernet link found, created default_eth_switch0.
Connected board.mb.sb.eth_slot to default_eth_switch0
[rn0.rn info] Connecting to existing TAP device 'sim_tap0'
'default_eth_switch0' connected to real network.

When using Ethernet bridging, the simulated machine should be configured with an unused IP address and netmask from the real network. In this case we use 10.0.0.241 and 255.255.255.0. Replace it with an unused IP address and netmask from the real network:

~# ifconfig eth0 10.0.0.241 netmask 255.255.255.0

Note: As the target machine will appear as a real machine in the net, its gateway and DNS server should be correctly set according to the host settings, this step can be verified through pinging the gateway and DNS server IP. In some corner conditions, it's worth trying to reset (disable and then enable) the target Ethernet adapter if the gateway or DNS server are unreachable.
The simulated machine is now connected to the real network. Any kind of IP traffic is bridged between the simulated network and the real network. It should be possible to ping any real host from the simulated machine. Replace 10.0.0.240 with the address of a host on the real network:

~# ping 10.0.0.240 -c 3
PING 10.0.0.240 (10.0.0.240): 56 data bytes
64 bytes from 10.0.0.240: seq=0 ttl=64 time=10.285 ms
64 bytes from 10.0.0.240: seq=1 ttl=64 time=0.349 ms
64 bytes from 10.0.0.240: seq=2 ttl=64 time=0.323 ms

--- 10.0.0.240 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.323/3.652/10.285 ms

Of course, it should also be possible to ping the simulated machine from the real host.

Running traceroute on the simulated machine shows that it is connected directly to the real network; there are no routers between it and the real host. Again, replace 10.0.0.240 with a host on the real network:

~# traceroute 10.0.0.240
traceroute to 10.0.0.240 (10.0.0.240), 30 hops max, 38 byte packets
 1  10.0.0.240 (10.0.0.240)  10.106 ms  0.371 ms  0.347 ms

If the IP address of the simulated machine itself is printed and !H is printed after the response times, it means the simulated machine can not reach the real host, and the configuration is incorrect.

4.2.2.2 Setting up TAP for Ethernet Bridging

To use TAP access with the connect-real-network-bridge command, the operating system must be configured to act as a bridge between the virtual interface and the real interface. Follow the steps below to set it up.

Note: When setting up bridging between a TAP interface and a real Ethernet interface, the host will no longer accept traffic on the real interface. All connections the host has open on the interface will be lost. One consequence of this is that if this is being done from a remote console, the connection might be lost before the bridge is fully configured. We therefore strongly recommend that bridging is only set up on dedicated host interfaces.
Linux:

  1. Create a TAP interface, as described in section 4.3.1
  2. Create a bridge interface and connect the TAP interface and the real interface. Turn off STP (Spanning Tree Protocol) in the bridge as well, otherwise there will be STP traffic from the bridge into both the simulated and the real network. Here the name of the created bridge interface is sim_br0 and the interface used is eth1, but other names and interfaces can be used.

    computer# brctl addbr sim_br0
    computer# brctl addif sim_br0 sim_tap0
    computer# brctl addif sim_br0 eth1
    computer# brctl stp sim_br0 off
    

  3. Bring up the TAP interface and the bridge interface.

    computer# ifconfig sim_tap0 promisc up
    computer# ifconfig sim_br0 promisc up
    

  4. Bring up the Ethernet interface.

    computer# ifconfig eth1 up
    

To remove the bridging when finished, do the following:

  1. Bring down the TAP interface and the bridge interface.

    computer# ifconfig sim_tap0 down
    computer# ifconfig sim_br0 down
    

  2. Delete the bridge interface.

    computer# brctl delbr sim_br0
    

Note: The brctl utility is usually not present in default Linux installations. It is usually included in the bridge-utils package.
Windows:

  1. Open the Network Connections folder of Control Panel.
  2. Select the OpenVPN TAP interface and the real interface to bridge to at the same time.
  3. Right-click on the OpenVPN TAP interface to bring up a context menu, and select Bridge Connections.

Windows will now set up bridging between the OpenVPN TAP interface and the real interface. If successful both the OpenVPN TAP and real interfaces will seem to disappear as they are now contained in the new bridge interface. To undo the bridging, go to the Network Connections folder, right-click on the bridge and select Delete.

Note: Perhaps you want to disable the spanning tree algorithm (STA). To do that you must add or edit the DisableSTA registry key to 1. Disabling STA will minimize the time to allow packages over the bridge. Rebooting Windows is required.
Windows 7 has the key at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BridgeMP\DisableSTA while Windows 10 and later has the key at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MsBridge\DisableSTA.

4.2.1 Port Forwarding 4.2.3 Host Connection