Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 GitHub - abidmuin/ns-2: Network Simulator 2 (NS-2.35) is a popular discrete event simulator for network research, but it often fails to compile on modern systems. This Docker image provides a plug-and-play environment with full GUI support, eliminating the setup hassle.
Nothing Special   »   [go: up one dir, main page]

Skip to content
/ ns-2 Public

Network Simulator 2 (NS-2.35) is a popular discrete event simulator for network research, but it often fails to compile on modern systems. This Docker image provides a plug-and-play environment with full GUI support, eliminating the setup hassle.

License

Notifications You must be signed in to change notification settings

abidmuin/ns-2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Run NS-2.35 in Docker with Full NAM GUI (X11 Support)

Run Network Simulator 2 (NS-2.35) with NAM GUI inside Docker. Zero setup, 100% reproducible. Perfect for students, researchers, or legacy network labs.

Network Simulator 2 (NS-2.35) is a popular discrete event simulator for network research, but it often fails to compile on modern systems. This Docker image provides a plug-and-play environment with full GUI support, eliminating the setup hassle.

Project Stats

Docker Pulls GitHub stars GitHub forks Repo Views Last Commit License: MIT

Table of Contents

Quick-start (1-Minute Setup)

By default, the host directory for ns-2 script is $HOME/workspace/ns-2/scripts. If the directory is not present in your machine, the following command will create one for you and it will be auto mounted to /root/scripts in the container.

Note: NAM uses a GUI. Ensure your system supports X11 forwarding (e.g. X11/XWayland on Linux).

On your host machine:

docker pull abidmuin/ns-2.35 && \
git clone https://github.com/abidmuin/ns-2.git && \
cd ns-2 && \
mkdir -p $HOME/workspace/ns-2/scripts && \
chmod +x run-ns2.sh && \
./run-ns2.sh \

Then, inside the container:

cd /root/scripts
ns sample.tcl && nam out.nam

NAM GUI Running in Docker

NAM running in Docker

NAM GUI displaying a running simulation inside Docker with X11 forwarding.


Features

  • Pre-configured NS-2.35 with NAM GUI.
  • Lightweight Docker container.
  • GUI support even on Wayland via X11 forwarding.
  • Mount host directory to /root/scripts for running your .tcl or .cpp script simulations.
  • Includes patch for known ls.h compilation issue.
  • Two usage options: pre-built image or build it yourself.

Usage Options: Two Ways to Use NS-2

Option 1: Use Pre-Built Docker Image (Recommended)
  1. Pull the image from Docker Hub
   docker pull abidmuin/ns-2.35
  1. Clone this repo to get the run script
    git clone https://github.com/abidmuin/ns-2.git && cd ns-2
  1. Run NS2 with GUI support
    ./run-ns2.sh

This script will:

  • Grant X11 access for GUI (NAM)
    • Mounts your local $HOME/workspace/ns-2/scripts directory into the container at /root/scripts for easy access to simulation files. The location can be modified in the run-ns2.sh script by changing HOST_SCRIPTS_DIR value.
Option 2: Build the Image Locally
  1. Clone the repository
    git clone https://github.com/abidmuin/ns-2.git && cd ns-2
  1. Build the image
    docker build -t abidmuin/ns-2.35 .
  1. Run it
    ./run-ns2.sh

Running Simulations

A working sample.tcl is included in the scripts/ directory for testing.

Inside the container:

cd /root/scripts
ns sample.tcl && nam out.nam

All your .tcl or .cpp simulation scripts go into your host-side directory: $HOME/workspace/ns-2/scripts

Wayland Support (X11 via XWayland)

Even if your host uses Wayland (echo $XDG_SESSION_TYPE returns wayland), the container uses X11 via XWayland, and GUI applications like NAM work as expected. GUI access is granted using xhost.

xhost +local:root
docker run ...
xhost -local:root

This is already handled in run-ns2.sh. If NAM fails to launch, ensure xhost +local:root was successful and your Docker host allows X11 forwarding.

Note: xhost +local:root is required for GUI apps in Docker, but remember to run xhost -local:root afterward to restore security.

Project Structure

.
├── Dockerfile           # Docker build script
├── run-ns2.sh           # Launch script (GUI + mount setup)
├── README.md            # You're reading it!
└── scripts/             # (Optional) Your simulation scripts

Why Use Docker for NS2?

Without Docker With Docker
Old GCC, OTcl, Tk issues Pre-installed & configured
Platform-specific bugs Works on any Docker platform
GUI breaks on Wayland GUI patched & tested
Manual patching required Auto-patched in Dockerfile

Troubleshooting

  • NAM doesn’t launch / GUI errors

    • Make sure X11 forwarding is working and xhost +local:root was successful.
    • On Wayland, ensure you have XWayland installed.
  • Permission denied when mounting host directory

    • Try running with sudo, or ensure your user has Docker permissions.

Maintainer

Abid Hasan Muin
Email: muin.739@gmail.com
GitHub
Docker Hub

Feel free to open an issue if you encounter any problem or have suggestions.

Show Your Support

If this project saved you time or simplified your workflow, feel free to:

  • Star this repo.
  • Share it on LinkedIn or with your classmates/research group.

Credits

License

This project is licensed under the MIT License.

About

Network Simulator 2 (NS-2.35) is a popular discrete event simulator for network research, but it often fails to compile on modern systems. This Docker image provides a plug-and-play environment with full GUI support, eliminating the setup hassle.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0