Anda di halaman 1dari 31

Introduction to SITL

Objective
This tutorial provides a quick introduction to
System-in-the-Loop (SITL) functionality, which allows
physical hardware and a simulation to interact as a
unified system. It shows how you can use SITL to do
the following:
• Allow physical hardware to interact with a
simulation
• Allow multiple physical networks to communicate
through a simulation

After you finish this tutorial, you will know how to use
Modeler and SITL to incorporate physical hardware in
a simulation.

1
Before You Begin
To do this tutorial, you should:
• Know how to use Modeler to build network
models and run simulations
• Know how to configure Ethernet interfaces and
firewalls on your computer

If you are new to Modeler, we suggest that you do one


or more basic tutorials (such as Small Internetworks)
before doing this one.

You will need the following items to complete this


tutorial:
• Modeler (Release 14.5 or later)
• SITL license
• A computer on which to run the software. This
computer needs one or more Ethernet interfaces:
— One dedicated interface is needed for the
real–sim scenario
— A second dedicated interface is needed for
the real–sim–real scenario

2
— A third interface might be needed to let
Modeler contact an OPNET license server
(not needed if a license server is running on
the local computer or if Modeler is running in
Standalone license mode)
Note—Each network interface card (NIC) used for
a SITL interface must be compatible with the
Pcap library that SITL uses to capture and send
packets. You can check for supported cards at the
website for the Pcap library used by SITL:
Winpcap on Windows (www.winpcap.com) and
libpcap on Linux (www.tcpdump.org). (SITL prints
the Pcap library version being used at the
beginning of each simulation.)
• One or two additional computers to represent the
physical hardware in the simulations

3
Tasklist
The tasks you will perform in this tutorial comprise the
following procedures:
• Task 1—Preparing the simulation environment
— Preparing the hardware
— Preparing the Modeler software
• Task 2—Creating a Real–Sim Scenario
— Creating the simulated network
— Running the simulation
— Sending packets through the simulation
• Task 3—Creating a Real–Sim–Real Scenario
— Creating the simulated network
— Running the simulation
— Sending packets through the simulation

4
Preparing the Simulation Environment
In this task, you will set up Modeler and the computers
to be used so that they are ready to run a SITL
simulation.

Prepare the Hardware

1 Select two, three, or four computers to use, as


follows:
Hardware for SITL Simulation

License
server

Real 1 SITL Real 2

• Real1—Represents a physical network or


piece of hardware. Required.
• SITL—Runs the Modeler and SITL software.
Required.

5
• Real2—Represents a second physical network
or piece of hardware. Required only for the
Real–Sim–Real scenario.
• License server—Required only if Modeler
needs a remote license server. (We
recommend using a local license server or
running Modeler in Standalone license mode.)
Note the following:
• All computers must be able to communicate
with each other as indicated by the links in the
preceding figure. The links are Ethernet
connections, either direct or through a network.
• The SITL computer must be running a version
of Windows or Linux supported by Modeler and
SITL. Real1 and Real2 can be running any
operating system.

2 Set up the Ethernet interfaces on the SITL


computer.

2.1 At a minimum, set the IP address, mask, and


gateway for each SITL interface. Each IP
address must be unique on the connected
network. The mask and gateway should be
appropriate for connection to the physical
hardware.

6
2.2 If the SITL computer is running Windows,
disable Netbios over TCP/IP and all items on
the connection except “Internet Protocol
(TCP/IP)”.

3 Set up a firewall on the SITL computer for the


interfaces that are going to be used in the SITL
simulation. The firewall should not allow any
exceptions, so as to prevent the operating system
from interfering with SITL.
On Windows, you can use the built-in firewall or
other firewalls installed on your system. Some
third-party firewalls (such as ZoneAlarm) interfere
with Pcap, however; if you have one of those, you
will have to disable it and use the Windows
firewall instead.
Note—Do not put a firewall on the interface to a
remote license server, if any.

7
Prepare the Modeler Software
SITL models are not included in the default repository,
so you must disable the use of repositories. This will
cause all models to be rebuilt the first time you run a
simulation.

1 Start Modeler.

2 Choose Edit > Preferences.

3 Locate the Network Simulation Repositories


preference and delete the stdmod entry.

4 Close the Preferences Editor.

8
Real–Sim Scenario
This scenario models communications between two
computers. One computer is the physical computer
Real1. The other computer is a workstation modeled in
a simulation running on the SITL computer. The
simulation will comprise two nodes, one representing
the connection to the physical computer and the other
being the simulated workstation.
Real–Sim Scenario

Real 1 SITL

9
Build and Configure the Simulated Network
You already have the Real1 and SITL computers
connected to each other. Now you’ll create the
simulated network that will run on the SITL computer.

1 Create a new project with an empty scenario. In


the Startup Wizard:

1.1 Name the project SITL_Sample and the


scenario real_sim.

1.2 Select the Office network scale and use the


default size.

1.3 Include the ethernet_advanced and SITL


model families.

2 Open the Object Palette.

3 Locate the node model called


sitl_virtual_gateway_to_real_world. Drop an
instance of this model into the workspace and
rename it sitl.

4 Locate the node model called


ethernet_wkstn_adv. Drop an instance of this
model into the workspace and rename it wkstn.

10
5 Locate the link model called sitl_virtual_eth_link
and use it to connect the sitl gateway node to the
wkstn node.
➥ The network model should now resemble the
following figure.
Real–Sim Model

6 Close the Object Palette.

7 Edit the attributes on the sitl node:

7.1 Choose your interface from the Source IP


and Ethernet Mac Address pull-down list.
This should be the NIC you are using for this
simulation.
Choosing the Interface

11
7.2 Set the Incoming Packet Filter String
attribute to (arp or icmp) and ether src
<SOURCE_MAC_ADDRESS>, where
<SOURCE_MAC_ADDRESS> is the MAC
address of the interface on Real1 that will be
sending packets to SITL.

Note—This is NOT the interface used by the


computer running Modeler. It resides on the
external computer (Real1) that is connected
to the SITL interface.

7.3 Close the Attributes dialog box.

8 Edit the attributes on the wkstn node:

8.1 Expand the IP > IP Host Parameters >


Interface Information tree and set the
Address and Subnet Mask attributes.
• The address must be unique in both the
physical and simulated networks (that is,
it must be different from the addresses
used by the Real1 and SITL computers).
• The address must be in the same subnet
as Real1.

12
8.2 Expand the Ethernet > Ethernet
Parameters tree and set the Address
attribute to 3 (or any single-digit number
greater than zero). Some real systems don’t
like zero for Ethernet addresses and using a
small number will be useful in debugging
later on. Like all Ethernet addresses, this
should be unique in your system.

8.3 Close the Attributes dialog box.

13
Run the Simulation
You now are ready to configure and run the simulation.
While the simulation is running, you will test it by
pinging the simulated workstation from the external
computer (Real1) and observing the response.

1 Open the Configure/Run DES dialog box. If


necessary, click the Detailed… button to display
the detailed version of the dialog box.

2 Set Simulation Kernel to Development.


You can run SITL simulations in optimized or
development mode. We’ll use development here
in case you want to examine the internal
operation of the simulation.

3 Modeler uses various techniques to make


discrete event simulations more efficient (such as
pre-assigning routing tables instead of computing
them). To prevent these techniques from affecting
the simulation, you should disable simulation
efficiency for the protocols you will be using with
SITL. To do so:

3.1 In the left pane, expand the tree to Inputs >


Global Attributes.

14
3.2 In the Global Attributes pane, expand
Simulation Efficiency and disable
ARP Sim Efficiency.

Note—You can click on the question mark to


see a description of this Sim Efficiency
technique.

4 Because we want to coordinate the simulation


with real hardware, we must constrain it to run at
a real-time speed.

4.1 In the left pane, expand the tree to


Execution > Advanced >
Kernel Preferences.

4.2 In the Kernel Preferences pane, set


Real-time execution ratio to 1.

5 Click Run.
➥ After the model library has been recompiled,
the simulation runs. You should get output
similar to the following figure.

15
Simulation Progress Output

Also, you can look in the Simulation Console to


verify that your SITL gateway was successfully
matched to the physical interface, as shown in
the following figure.

16
Simulation Console Output

17
Send Packets Through the Simulation
To demonstrate that the physical hardware and
simulated workstation are working together as a single
network, ping the simulated workstation from Real1
and view the response.

1 On Real1, enter the ping command:


Windows: ping -t <wkstn_addr>
Linux: ping <wkstn_addr>
where <wkstn_addr> is the IP address you
entered when you configured the wkstn node.
This will cause ICMP echo request packets to be
sent to the simulated workstation via SITL.
➥ Ping replies appear on Real1.

2 When you are finished looking at the replies, stop


the simulation.

If you don’t get any replies to the ping, verify that you
have configured everything correctly. If necessary, look
at the Troubleshooting SITL Simulations section in the
SITL User Guide. You can observe the packets being
sent with a packet capture utility such as Wireshark or
by running the simulation with the OPNET Simulation
Debugger (ODB) enabled and turning on SITL tracing
(with the ltrace sitl command).
18
Real–Sim–Real Scenario
This scenario models communications between two
physical nodes by way of a simulated network. The
model will comprise three nodes, two representing the
physical hardware (with a SITL interface for each) and
the third being a simulated network switch.
Real–Sim–Real Scenario

Real 1 SITL Real 2

Note—If you do not have two dedicated Ethernet


interfaces available in the SITL computer, skip this
scenario and go to the Summary.

19
Build and Configure the Simulated Network
To create the simulated network for this scenario, you’ll
duplicate the previous scenario, change the
workstation to a switch, and add a second SITL
interface to connect to the Real2 computer.

1 Duplicate the real_sim scenario and name it


real_sim_real.

2 Rename the sitl node to sitl1.


If you are using the same computer for Real1 as
in the previous scenario, this node needs no
further configuration. If you are using a different
computer, change the Incoming Packet Filter
String attribute to include the MAC address of the
new computer.

3 Edit the attributes of the wkstn node:


• Change name to switch.
• Select the Advanced checkbox, then change
model to ethernet16_switch_adv.

4 Open the Object Palette.

20
5 Locate the node model called
sitl_virtual_gateway_to_real_world and drop a
new instance of this model into the workspace.
Name it sitl2.

6 Locate the link model called sitl_virtual_eth_link


and use it to connect switch to sitl2.

7 Close the Object Palette.


➥ The network model should now resemble the
following figure.
Real–Sim–Real Model

8 Edit the attributes on the sitl2 node:

8.1 Choose your interface from the Source IP


and Ethernet Mac Address pull-down list.
This is the interface on the SITL computer
that connects (either directly or through a
network) to Real2. Do not use the same
interface used by the sitl1 node.

8.2 Set the Incoming Packet Filter String


attribute to (arp or icmp) and ether src
<SOURCE_MAC_ADDRESS>, where
21
<SOURCE_MAC_ADDRESS> is the MAC
address of the interface on Real2 that will be
sending packets to SITL.

Note—This is NOT the interface used by the


computer running Modeler. It resides on the
external computer (Real2) that is connected
to this SITL interface.

8.3 Close the attributes dialog box.

22
Run the Simulation
You now are ready to configure and run the simulation.
While the simulation is running, you will test it by
streaming video through the simulated switch from one
external computer to the other.

1 Open the Configure/Run DES dialog box. If


necessary, click the Detailed… button to display
the detailed version of the dialog box.

2 Set Simulation Kernel to Development.

3 Confirm that the simulation will run at a real-time


speed:

3.1 In the left pane, expand the tree to


Execution > Advanced >
Kernel Preferences.

3.2 In the Kernel Preferences pane, verify that


Real-time execution ratio is set to 1.

4 Click Run.
➥ The simulation runs. You should get output
similar to the following figure.

23
Simulation Progress Output

Also, you can look in the Simulation Console to


verify that both SITL gateways were
successfully matched to physical interfaces, as
shown in the following figure.

24
Simulation Console Output

25
Send Packets Through the Simulation
To demonstrate that the simulated switch is routing
traffic between the two physical computers, you can
stream video from Real1 to Real2 through the SITL
simulation.

Note—If you prefer, you can skip the steps in this


section and demonstrate connectivity simply by
pinging Real2 from Real1 or Real1 from Real2.

To use video streaming, you need applications that


can stream and receive video. This tutorial uses VLC
media player, a free program available at
http://www.videolan.org/. However, you can use any
suitable program you have available.

1 On computer Real2, install and start VLC media


player. We’ll call this instance of the program
MP2.

2 Configure MP2 to receive and play a video stream


by listening on UDP port 1234 (or any other
available UDP port).

2.1 Choose File > Open Network Stream…

2.2 Select the UDP/RTP radio button and set


Port to 1234.
26
VLC Media Player Setup for MP2: Open Network Stream

2.3 Click OK.

3 On computer Real1, install and start another


instance of VLC media player (called MP1).

4 Configure MP1 to play a video file (or DVD) and


stream the video to computer Real2, using the
same UDP port you set up for MP2.

4.1 Select the video source:


• To play a video file, choose File >
Open File…, click Browse…, and select
a video file.

27
VLC Media Player Setup for MP1: Open File

• To play video from a DVD, choose File >


Open Disc… and enter the device name.

4.2 Select the Stream/Save checkbox and click


Settings…
➥ The Stream output dialog box opens.

4.3 Select the UDP checkbox.

4.4 Set Address to the physical IP address of


computer Real2 and Port to 1234.

28
VLC Media Player Setup for MP2: Streaming Video

4.5 Click OK twice to close both dialog boxes.


➥ You should see the video being played in MP2
on computer Real2.
Note—If you don’t see video, make sure MP1
and MP2 are not paused.
29
5 When you are finished with the video, stop MP1
and MP2, then stop the simulation.

30
Summary
You’ve seen how to use System-in-the-Loop
functionality to map physical interfaces to addresses in
a simulated network. In this tutorial, you have
• Build and run a SITL system in which physical
hardware interacts with a simulation
• Build and run a SITL system that allowed multiple
physical networks to communicate through a
simulation

For further information about SITL, read the SITL User


Guide in the online documentation.

31

Anda mungkin juga menyukai