Psimulator2 is a basic graphical network simulator created and used by the Czech Technical University in Prague, Faculty of Information Technology to teach basic networking topics. It will run on any system that supports Java, including Windows, Mac OS, and Linux.
Each node created in the Psimulator2 network is a Java program that implements the functionality of a host, switch, or router. Once a network simulation scenario is started, the user can connect to each virtual node using telnet and enter configuration or test commands. However, only a sub-set of normal networking functionality is supported by the software emulation the node.
Read on to see how to set up a network using the Psimulator2 graphical user interface and run the simulation.
UPDATE: Psimulator2 forked
Updated November 16, 2016: Roland Kuebert forked the psimulator2 network simulator project from the original, seemingly discontinued source and made the new version available at https://github.com/rkuebert/psimulator.
See Roland’s announcement, which includes details about how to build the new version of psimulator2.
Install Psimulator2
To install Psimulator2, download the latest ZIP archive from the Psimulator web site and use the Archive Manager utility to unpack the files into a new folder. I chose to unpack the files into a folder: $HOME/Psimulator2.
NOTE: The Psimulator2 Google Code web site is now read-only and there appears to be a new version (or it may just be an archive of the current version) at https://gitlab.fit.cvut.cz/psimulator2/Psimulator2.
Java
Psimulator2 requires a Java run-time environment, but Java is not installed by default in Xubuntu. To install Java, search for default-jre in the Ubuntu Software Center application. Install this package using the Software Center or using the following command:
$ sudo apt-get install default-jre
This will install all the required packages to support Java 7 on the Linux host computer.
To install Java in Windows or Mac OS, go to the Oracle Java web site for instructions.
Telnet
Psimulator2 also requires a Telnet client. Telnet is installed by default in Linux and Mac OS but, if you are using Windows, you should install the Putty Telnet/SSH client program.
Psimulator architecture
Psimulator2 is divided into two parts – the front-end and the back-end. The front-end is the graphical user interface that helps the user to create a network topology and, after the simulation is started, it displays sent or dropped packets in network, using simple animations. The back-end runs the simulation based on information in the XML file generated by the front-end.
The Psimulator2 developers proposed a scenario in which the front-end can run on one computer and the back-end can run on another computer. But, in normal use, both the front-end and back-end run on the same computer.
The front end and the back end work together to run a simulation.
Create new network simulation scenarios
To create and run a network simulation in Psimulator2, follow these steps:
- Start the front end
- Use the GUI to create a network topology with nodes and links
- Save the topology as an XML file
- Start the back end so it will use the previously-created XML file to create the simulated nodes
- Connect the front-end to the running back-end simulation so you can use the front-end GUI to demonstrate networking features in the simulation.
Re-use saved network simulation scenarios
To run a previously saved network simulation in Psimulator2, follow these steps:
- Start the front-end
- Use the GUI to open the previously saved network topology XML file
- Start the back-end so it will use the same previously-saved network topology XML file you opened in the front-end.
- Connect the front-end to the running back-end simulation so you can use the front-end GUI to demonstrate networking features in the simulation.
Start Psimulator2 front-end
To start the Psimulator2 front-end application, navigate to the folder in which you unpacked the Psimulator2 files (or include this folder in your $PATH). Then, execute the command:
$ java -jar psimulator2_frontend.jar
This will start the front-end GUI. From this first screen, you may create a new network topology or open an exisiting network topology file.
Create a new network topology
To create a new network topology, click on the New Project button. The Psimulator2 GUI will enter Edit Mode and you will see a blank canvas with some tool bars.
The user interface is relatively intuitive. The tool bar along the left side of the window offers tools to add network elements such as hosts, routers, switches, and network links. It also offers some tools to organize elements on the canvas.
Add network nodes
To add network elements, right-click on the node type in the tool bar (example: the router) and then click on one of the router types that appear in the pop-up menu (example: Linux router).
Then, click on the location in the canvas you want the node to appear. Cliuk again if you want to add more than one of the same node type.
You can select elements already on the canvas and move them around.
Configure interfaces
To configure the interfaces on the network element, click on it on the canvas and select Properties from the pop-up menu.
The Properties dialogue box will appear. You can change the name of the node and configure the IP addresses of each interface. You can also add more interfaces if you need them. You can configure the interfaces at any time but in this case we are configuring them first.
The configuration for one of the PC nodes is shown below:
One of the router configurations is shown below. This router has four interfaces but we plan to use only two of them. I chose to use the lowest-numbered interfaces to connect to local networks and the highest-numbered interfaces to connect to other routers.
Interface IP addresses
In this example, the IP addresses for each node in the network should be configures as follows:
Node | Interface | IP Address |
---|---|---|
PC 0 | eth0 | 10.0.100.2/24 |
PC 1 | eth0 | 10.0.100.3/24 |
Router 0 | eth0 | 10.0.100.1/24 |
eth3 | 10.0.1.1/24 | |
Router 1 | eth0 | 10.0.200.1/24 |
eth3 | 10.0.1.2/24 | |
PC 2 | eth0 | 10.0.200.2/24 |
Ethernet links
To add links between nodes. Click on the Links tool, then click on each node that will form an endpoint of the link.
You need to specify which interface to use on devices with multiple interfaces, like routers. To choose an interface, right-click on the node, then click the interface from the pop-up menu.
Canvas properties
As you add links, more information about the interfaces is displayed on the canvas. Eventually, the canvas gets cluttered with information.
You can change the Psimulator2 preferences so that less information is displayed. Click on the Preferences menu item. In this case, we chose to display only interface names and IP addresses on each interface.
Now the canvas is easier to read.
Save the topology XML file
Save the network topology. Click on the menu command File → Save.
In our case, we chose to save the file with the name test-topology.xml.
Start the back-end
Start the back-end Psimulator2 server with the network topology we previously created and saved using the front-end GUI, test-topology.xml. Enter the command:
$ java -jar psimulator2_backend.jar test-topology.xml
Pay attention to the output on the terminal screen. The back-end server displays the port numbers that each node is listening to. This is the port number we will use later to telnet into a node. Also note the port number for the packet flow server. This is the port to which we must connect the Psimulator2 front-end (Port number 12000 is the default).
Starting Psimulator2, build 2014-01-29
[IMPORTANT] TELNET: TELNET LISTENING PORT: : Device: pc0 listening port: 11000 (pc0)
[IMPORTANT] TELNET: TELNET LISTENING PORT: : Device: router1 listening port: 11001 (router1)
[IMPORTANT] TELNET: TELNET LISTENING PORT: : Device: pc1 listening port: 11002 (pc1)
[IMPORTANT] TELNET: TELNET LISTENING PORT: : Device: pc2 listening port: 11003 (pc2)
[IMPORTANT] TELNET: TELNET LISTENING PORT: : Device: router0 listening port: 11004 (router0)
[IMPORTANT] NETWORK_MODEL_LOAD_SAVE: config.configTransformer.Loader: Configuration succesfully loaded from: test-topology.xml
[IMPORTANT] EVENTS_SERVER: PACKET FLOW SERVER: : Server successfully started, listening on port: 12000
Ensure front-end and back-end run the same file
Psimulator2 will not give you a warning if you run different files in the front-end GUI and the back-end server. For example, if you start Psimulator2 and open the test-topology.xml file and then start the back-end server with a file that contains a different topology, such as wrong-topology.xml, there is no indication of a problem until you start trying to use the simulation.
So, ensure you run the same topology XML file in both the front-end GUI and the back-end server.
Connect front-end GUI to back-end server
Now, in the front-end, start the server (default 127.0.0.1:12000)
In the front-end GUI, switch to Simulator Mode. Click on the Simulator button in the top-left corner of the GUI. We see the simulator controls appear on the left side of the GUI. Click on the Connect to Server button.
The Connect to server dialogue box appears. The default settings will work. The IP address 127.0.0.1 is the loopback address of the host computer (you would only use a different IP address is you were running the back-end Psimulator2 server on another machine) and the port number that the Psimulator2 back-end server is listening to is 12000.
Now click the Connect to server button. The nodes that appear on the front-end GUI are now “running” via the processes supported by the back-end server. We can connect to each node, configure it, and run tests.
Open a terminal window for each node
To connect to a node while Psimulator2 is in simulator mode, right-click on the node and select Open telnet from the pop-up menu. This will start a Java terminal connected to that node.
I found that the Java terminal was not reliable. Sometimes, Java terminal freezes, especially when connected to the Cisco Router device. Cut-and-paste does not work well. When I try to copy-and-paste text from the Java terminal, it generates extra copies of all the lines I copied. It is better to launch an Xterm — one for each node to which you intend to connect — and then telnet
to each node from an Xterm window.
For example, to connect to node PC 0, I entered the following command in an Xterm window:
$ telnet localhost 11000
Configure the network nodes
To configure the network so that data can be routed from any element to any other element, follow the procedure below:
- Enable IP Forwarding on the two routers
- Create static routes on each router
- Create a default route on each PC
Enable IP Forwarding on routers
To enable IP Forwarding on each router, write the value of “1” to the file /proc/sys/net/ipv4/ip_forward. Normally, this would be done using the echo
command but Psimulator2 would not accept that command.
To edit the file, use the editor command on each router. On Router 1 and Router 2, enter the command:
# editor /proc/sys/net/ipv4/ip_forward
In the file, delete the number “0” and replace it with the value “1”. Save the file.
Create static routes on each router
On Router 0, create a static route to network 10.0.200.0/24:
# ip route add 10.0.200.0/24 via 10.0.1.2
On Router 1, create a static route to network 10.0.100.0/24:
# ip route add 10.0.100.0/24 via 10.0.1.1
Create a default route on each PC
On PC 0, create a default route point to Router 0:
# ip route add default via 10.0.100.1
On PC 1, create a default route point to Router 0:
# ip route add default via 10.0.100.1
On PC 2, create a default route point to Router 1:
# ip route add default via 10.0.200.1
Verify the configuration
Check that the IP addresses on each node are correct. In the Xterm window connected to each mode, execute the following command to list the interface IP addresses and ensure they are correct:
# ip addr show
Verify the route table on Router 0. Enter the command:
# ip route show
10.0.200.0/24 via 10.0.1.2 dev eth3
10.0.100.0/24 dev eth0
10.0.1.0/24 dev eth3
#
Verify the route table on Router 1. Enter the command:
# ip route show
10.0.100.0/24 via 10.0.1.2 dev eth3
10.0.200.0/24 dev eth0
10.0.1.0/24 dev eth3
#
Capture data packets
Now the network configuration is complete. We can run some test traffic in the network and capture data packets.
Ping
First, click on the Capture button on the Simulator tool panel.
Send some data traffic from PC 0 to PC 1. Psimulator2 only supports the ping
and traceroute
commands so we will use the ping
command.
On the PC 0 terminal window, execute the command:
# ping 10.0.100.3
PC 0 starts sending ICMP echo messages to PC 1 and we see packets being captured in the simulator’s data capture window. After a few seconds, stop the traffic with ctrl-C
.
We see packets in the Event List section of the Psimulator2 window. We can click on each packet to inspect some of the details. We can also “play back” the packets by click on the first packet in the event list (or on the packet you want to use as the starting point), then pressing the Play button.
Psimulator2 will start playing the events and will animate the data moving through the simulated network by showing envelope icons moving through the GUI representation of the network. The envelopes are color-coded to match the same color of each event type in the event list.
You can change the speed at which Psimulator2 plays back events by moving the speed slider. You can run the animation sequentially or according to the event time-stamps by selecting the appropriate button on the GUI.
Traceroute
Start capturing packets by clicking on the Capture button.
Run the traceroute
command and capture the traffic generated. Then, play it back to see how the command executes it’s network tests and how each node in the network responds.
For example: on PC 1, trace the route to PC 2 by entering the command:
# traceroute 10.0.200.2
On the PC 1 terminal window, we see the output of the traceroute command shows that the path from PC 1 to PC 2 crosses three networks.
# pc1:/#traceroute 10.0.200.2
# traceroute 10.0.200.2
traceroute to 10.0.200.2 (10.0.200.2), 30 hops max, 60 byte packets
1 10.0.100.1 (10.0.100.1) 25.064 ms 15.272 ms 11.69 ms
2 10.0.1.2 (10.0.1.2) 19.507 ms 28.932 ms 25.112 ms
3 10.0.200.2 (10.0.200.2) 27.459 ms 28.578 ms 30.476 ms
#
Stop the capture and then play back the events using the event Play controls.
Save node configurations
The configuration changes you make on each node can be saved using the save
command. To save the configuration of every node in the network, you need only execute this command on any one node. Execute the following command at the command prompt in any node’s terminal window.
# save
The project documentation does not make it clear if this save
command is the same as using the GUI File → Save menu command. So, I would recommend doing both to save a project.
Getting help
On each node, the help-en
command will display the commands available on that node.
For example, the commands supported on a simulated Linux Router are listed below:
# help-en
For help in czech type: help
This command is not present on real computer with Linux. Here is only for information, which Linux commands are supported by this simulator.
Simulator has these commands, which are not present on real computer:
save saves virtual network configuration to file
for example: save ./konfiguraky/sit.xml - saves in relative
path to path, where is simulator running
help print this help in czech
help-en print this help in english
rnetconn command to manage connection of simulator to real network
for help in english type: rnetconn help
These linux commands are supported in simulator
ifconfig parameters address, netmask, up, down
route actions add, del; parameters -net, -host, dev, gw, netmask
iptables only masquerade
for example: iptables -t nat -A POSTROUTING -o eth1 -j MASQUERAD
ping options -c, -i, -s, -t
traceroute for example: traceroute 1.1.1.1
exit
ip podprikazy addr a route
echo, cat jen na zapisovani a cteni souboru /proc/sys/net/ipv4/ip_forward
#
Psimulator2 project
Psimulator2 was most recently updated in May 2012.
Activity in the Psimulator2 forum on Google Groups is low, suggesting that the user community is small. But, since the supported functionality is very basic and the user documentation is adequate, it is also possible that users would have less reasons to post to the forum to get help.
Conclusions
Psimulator2 provides a visual network simulation experience suitable for basic IP networking studies. It can be used to demonstrate the effects of executing basic configuration commands on Linux PCs, Linux routers, and Cisco routers in a simulated data network.
Psimulator2 supports only a small sub-set of networking commands that would be available on a Linux system or on a Cisco router. It supports only static routing. The only commands available to generate traffic are ping
and traceroute
so the only packet types a student gets to inspect are ARP messages and ICMP messages.
The most interesting feature in Psimulator2 is the animation feature that shows packets traversing the network, which should be very helpful when teaching basic networking concepts. In my opinion, this animation feature is the main reason one might consider using Psimulator2.
Because it uses the Java Runtime Environment, Psimulator2 can run on any operating system the supports Java. This cross-platform support is another benefit of Psimulator2.
Thanks!!!
Nice simulator! I needed something just to check some routing tables in a network, all other solutions found seemed to require immense configuration.
If i had one request it would be to be able to set up dhcp/ip addresses also in the GUI, maybe extend it to also include other configurations.
Err, I just realized now this was probably not Psimulators own website…
*Runs away ashamed and blushing*
If you’re looking for more functionality while still keeping configuration to a minimum, try the CORE Network Emulator. It’s more complex because it runs real routing software on virtual network nodes in containers running on the host system. But, if you just use the GUI, you can set up IP addresses, DHCP configuration, and routing protocols and inspect the resulting routing tables from the GUI.
Can you help me? I have a question is that possible to create new network simulator…I need to make new open sourse network simulator. Can I change it???
Hi Nurbek,
I suggest you contact the Psimulator2 team and ask how you can contribute. All the simulators I cover in this blog have source code available under an open-source license. So you can contribute or you can create your own fork, according to the conditions of the license.
Brian
I’m not able to connect the backend.jar
Exception :
05.04.2015 01:29:20 config.configTransformer.Loader:
java.lang.NullPointerException
at config.configTransformer.Loader.findSwitchportFor(Loader.java:457)
at config.configTransformer.Loader.connectCablesV2(Loader.java:408)
at config.configTransformer.Loader.loadFromModel(Loader.java:94)
at psimulator2.Main.main(Main.java:97)
I too:
[INFO] NETWORK_MODEL_LOAD_SAVE: config.configTransformer.Loader: XML configuration file is corrupted:
config.configTransformer.LoaderException: Could not find Device with id=41 a for Switchport with id=44
at config.configTransformer.Loader.findSwitchportFor(Loader.java:457)
at config.configTransformer.Loader.connectCablesV2(Loader.java:408)
at config.configTransformer.Loader.loadFromModel(Loader.java:94)
at psimulator2.Main.main(Main.java:97)
[ERROR] NETWORK_MODEL_LOAD_SAVE: config.configTransformer.Loader: XML configuration file is corrupted. Exiting. config.configTransformer.LoaderException: Could not find Device with id=41 a for Switchport with id=44
I am having a problem with this step: “Enable IP Forwarding on routers”. How to do this in Windows 7?
I tried changing IPEnableRouter value from 0 to 1. That should be enough to enable IP forwarding in Windows 7 but it doesn’t help.
I get this message in the backend window:
Dropping packet: ip_forward is not set.
Can someone help me? I don’t know what to do.
Hi Nemanja,
I have not used Psimulator in Windows 7 but it is a Java program so it should work the same on any platform. Sorry I can’t be more helpful.
Brian
Hello Brian, thanks for the quick response.
It is working on Windows 7. It works fine except for that one issue.
For example, routing packets betweeen two PCs connected to one switch works fine.
The only problem is that the routers can’t forward packets they receive. And that’s because i can’t “Enable IP Forwarding on routers”. You gave the instruction for Linux and I am trying to figure out how to do that on Windows. I found several methods online but nothing helps.
I will keep trying.
Thanks for your time.
Hello Brian, I have another question and I’m sorry to bother you.
Do you remember if it’s possible to use OSPF(Open Shortest Patf First) protocol in Psimulator2? Or any other protocol?
In your example here you used static routes for routers. I was wondering if maybe this simulator had the option for using some other protocols for routers.
With regards,
Nemanja Pavlovic.
Psimulator2 only supports static routing
Thank you very much Brian.
error in connecting
there is a problem while connecting to the network
connecting through the ip 127.0.0.1 and port 12001
Is there a specific version of Java needed for running under OS X? When launching in the terminal i am getting error Unsupported major.minor version 51.0. A java -version shows that the version running is 1.6.0_65. Any ideas? Note that if i run the fronted directly from Finder it will launch, but that doesn’t help with running the backend. Thanks again.
You’re using Java 6. Java 7 worked for me in Linux. For Mac OS X, you may install Java 7 or Java 8.
Thanks for the info Brian. I was able to get it “functional” installing Java 8. I am running into an interesting problem though. Whenever i place a device in my configuration with no cable attachments and save my xml config and run it, i can start up the backend server with no issues. The minute that i connect up devices (router to router or router to PC, etc) save and try to start up the server i get an error that there is a corruption in the XML file. It starts to kick off the listening process but never finishes the process. I am curious if anyone else has seen this and been able to correct the issue.
Yeah I have this same problem. It also states that it “could not find device with id=2 a for switchport with id=3”
It was a Java thing. Java 8 breaks the server backend when using an xml configuration with any connections. Java 7 works great.
Thanks! I am glad you solved the problem.
So have another question….is there any setting that will prevent ifconfig from automatically creating a route? I am trying to replicate performing the exact steps to add the interface and then the route. Everything else works great.
I do not know. I suspect not.
Hi all,
just a heads up, I forked the project from the original, seemingly discontinued source and it is available at https://github.com/rkuebert/psimulator .
I have fixed the issue preventing the use of Java 8, but I have yet to look into making a release on GitHub. You can, however, clone the repository and use gradle to build jar files – I recommend using ‘gradle shadowJar’ to create jar files which can be run without specifying any further dependencies.
For the frontend, use ‘java -jar java -jar frontend/build/libs/psimulator-frontend-master-*.jar’ (replace the asterisk/* with the exact name, the star represents the git commit you used to checkout).
For the backend, use ‘java -jar backend/build/libs/psimulator-backend-master-*-all.jar’ (replace the asterisk/* with the exact name, the star represents the git commit you used to checkout).
Cheers
Roland
Hi Roland,
Thanks for letting us know. I’ll add a note to this post and the my network simulators page.
Brian
please, how to download and install through linux terminal