Você está na página 1de 7

Tutorial: Building GNS3 Multiuser Environment

By: Jaakko Rautanen v1.1

This tutorial show you how to build GNS3 multiuser environment. Following GNS3 features are tested in this setup: Users can create, save and open their own labs regardless other users Projects can be used Packet Capture can be used with WireShark

GNS3 Server

VNC VNC

VNC

In this tutorial we don't use remote hypervisor functionality because of it's limitations. Projects cannot be used with remote hypervisors. This is too big problem so I decided to implement this other way. Basic idea is to run GNS3 locally on server. Users connect to server via Remote Desktop connection (VNC).

Installing Linux
First you have to install some operating system. Here we use Ubuntu 8.10 desktop. Well, install operating system ;) In this distro default username is user. If you wan't to use some other username you have to replace user in all commands with username you are using. Enable root account: System -> Administration -> Users and Groups

Installing and configuring VNCserver


Second step is to install VNC server. VNC gives opportunity to connect to the server using VNC viewer. It's remote desktop program like Windows Remote Desktop but it's free. By default you can connect to one user's desktop at the same time using VNC. In this case multiple users need to connect to their own desktops at the same time. VNC-server need to be installed and configured. After this you can use VNC-viewer to connect this server and you'll get standard ubuntu login screen. Multiple users can be logged in simultaneuosly to their own desktops.

Enable Remote Access (XDMCP)


System Administration Login Window Tab Remote Style: Same as Local Button Configure XDMCP > Uncheck (disable) Honor indirect requests Edit /etc/X11/gdm/gdm.conf
sudo vi /etc/X11/gdm/gdm.conf

Find the [xdmcp] section in the file, set: Enable=True


Find:
# The greeter for xdmcp logins, usually you want a less graphically intensive # greeter here so it's better to leave this with gdmlogin # RemoteGreeter=/usr/lib/gdm/gdmlogin

And uncomment the RemoteGreeter line

Install vnc4server and xinetd


sudo apt-get install vnc4server xinetd

Add VNC Service to xinetd


sudo vi /etc/xinetd.d/Xvnc (probably creates a new file)

Add this:
service Xvnc { type = UNLISTED disable = no socket_type = stream protocol = tcp wait = yes user = nobody server = /usr/bin/Xvnc server_args = -inetd :1 -query localhost -geometry 1024x768 -depth 16 -once fp /usr/share/fonts/X11/misc -DisconnectClients=0 -NeverShared passwordF ile=/root/.vncpasswd -extension XFIXES -SecurityTypes none port = 5901 }

Restart xinetd
sudo /etc/init.d/xinetd stop sudo killall Xvnc sudo /etc/init.d/xinetd start

Installing GNS3
Install GNS3 to the server by following tutorial GNS3-0.5-tutorial.pdf. Tutorial can be found at GNS3 website. Follow steps 1 and 2 in chapter GNS3 Quick Start Guide for Linux Users. After that steps 1 and 2, copy whole GNS3 directory to the /usr/local and chage it's owner.
sudo cp /home/user/Desktop/GNS3-0.6-src/ /usr/local/ -R sudo chown root /usr/local/GNS3-0.6-src/ -R

You can remove GNS3 directory and downloaded package from user's desktop. Create laucher on users desktop:

Right-Click on users desktop -> select Create Launcher


Name: GNS3 browse and select gns3 file in GNS3-0.6-src directory

Install wireshark
Open Package Manager (System -> Administration -> Synaptic package manager) Search using keyword wireshark Select wireshark

Mark for installation Press mark and Install with apply button

Adding Users
Because of multiple dynamips processes running on the same server at the same time you have to modify some GNS3 settings. You have to ensure that following things are not overlapping between users: Hypervisor ports UPD ports Ports for Console connections

Following settings have to be equal for all users: IOS image directory dynamips directory ...

Configuring first user's settings Create new textfiles to users home directory. Paste following Scripts into files:
new_GNS3_user.sh
# This script adds new GNS3 user to the system. User specific settings and directorys are created. ##### Asking New username and other user specific info: echo 'Please type new username:' read UserName echo 'Please type hypervisor base port:' read HV_port echo 'Please type hypervisor base UDP port:' read HV_base_UDP echo 'Please type hypervisor base Console:' read HV_base_console

# Creating linux account useradd $UserName passwd $UserName

# Creating user home directory mkdir /home/$UserName/ chown $UserName /home/$UserName/

# Creating project directory mkdir /home/$UserName/GNS3_labs/ chown $UserName /home/$UserName/GNS3_labs

# Creating Dynamips Working Directory mkdir /home/$UserName/GNS3_labs/.dynamips_wd chown $UserName /home/$UserName/GNS3_labs/.dynamips_wd

# Creating directory for GNS3 Configuration file mkdir /home/$UserName/.gns3 chown $UserName /home/$UserName/.gns3 touch /home/$UserName/.gns3/gns3.ini

# Creating Directory for Capturefiles mkdir /home/$UserName/GNS3_labs/.capture_files chown $UserName /home/$UserName/GNS3_labs/.capture_files

# Copying Laucher to the Desktop mkdir /home/$UserName/Desktop chown $UserName /home/$UserName/Desktop cp /home/user/Desktop/GNS3.desktop /home/$UserName/Desktop/GNS3.desktop chown $UserName /home/$UserName/Desktop/GNS3.desktop

###### Creating gns3.ini file ####### ./new_GNS3_ini.sh $HV_port $HV_base_UDP $HV_base_console $UserName >> /home/ $UserName/.gns3/gns3.ini

# Correct rights to gns3.ini chown $UserName /home/$UserName/.gns3/gns3.ini

new_GNS3_ini.sh

# This script creates gns3.ini file content

### HV_port=$1 HV_base_UDP=$2 HV_base_console=$3 UserName=$4

###### Creating gns3.ini file ####### echo "[GNS3]" echo "project_directory=/home/$UserName/GNS3_labs" echo "ios_directory=/usr/local/GNS3-0.6-src/images"

echo "[Dynamips]" echo "hypervisor_path=/usr/local/GNS3-0.6-src/dynamips-0.2.8-RC2x86.bin" echo "hypervisor_port=$HV_port" echo "hypervisor_baseUDP=$HV_base_UDP" echo "hypervisor_baseConsole=$HV_base_console" echo "hypervisor_udp_incrementation=100" echo "hypervisor_working_directory=/home/ $UserName/GNS3_labs/.dynamips_wd"

echo "[IOS.images]" echo "4\filename=/usr/local/GNS3-0.6-src/images/c7200-a3jk9s-mz.12421a.bin" echo "4\chassis=7200" echo "4\platform=c7200" echo "4\hypervisors=" echo "4\default_ram=256" echo "4\idlepc=0x60659264" echo "4\default=true"

echo "[Capture]" echo "working_directory=/home/$UserName/GNS3_labs/.capture_files"

One IOS is added here. You should replace this with your IOS image and place your image to this folder. Change permissions of script files to executable

You have to manually make text file where port numbers are allocated.
User ------test1 test2 test3 Hypervisor base port -------------------7210 7220 7230 UDP NIO base port ---------------11000 12000 13000 BaseConsole ----------2000 2100 2200

When you want to add new user run new_gns3_user.sh as root Try to login and greate lab! (Connect VNC session to port 5901) You may have to change session settings when logging in VNC first time. Select gnome session from settings menu in standard ubuntun login screen.

Impovements in the future


Script for adding new IOS image to all users after installation Enhanced new_gns3_user.sh sricpt witch keep table of portnumbers for all users and automatically allocates ports for new user.

Você também pode gostar