Sunday 29 December 2013

FreePBX Install Guide (CentOS v5.x, Asterisk v1.6.x, FreePBX)

UPDATED for Asterisk v1.6.2 and FreePBX v2.8
Includes every detail in the form of step by step instructions from bare metal to a running VoIP PBX in about 2 hours.

When installing Linux, do NOT install a GUI such as Gnome or KDE.  We only want to be running in console text mode not GUI graphics mode.  If you already have a desktop or server GUI installed you will want to exit to console mode.  You do that by typing init 3 from a terminal or console window.  You will need to be logged in as root in order to do this so if not you can su root.  All instructions in this guide are assuming you are always logged in as root.

This guide has been tested using:
CentOS 5.5
Asterisk 1.6.2.13
FreePBX 2.8.0
For printer friendly version of this guide create an account and login.  It will only take a few minutes.

Step By Step Guide To Install JunOS on GNS3 [Part 1]

This article explain you how to emulate Juniper JunOS on a PC using Qemu. This is an updated and enhanced
version of excellent howtos from Juniper Clue and Internetwork Pro as well asHimawan Nugroho’s blog. I mainly focused on Qemu, so if you wish to install JunOS on a real PC or using VMware, please have a look at the Juniper Clue article for more information (and of course Google).
So what’s new you would say? First, I chose to use the latest version of Qemu: the 0.11.0 which supports the Intel e1000 network card emulation since version 0.10.0. and includes several fixes for it. I have modified and adapted the old patch for Qemu 0.11.0, it includes the UDP tunnel (connection to dynamips/GNS3), PCAP and LCAP support. Also, the patch allows multicast traffic with the e1000, i82557b and i82559er Qemu emulated network cards.


Moreover, this article show how to emulate JunOS on multiple operating systems: Mac OS X, Windows XP and Linux Ubuntu 9.04 without using an untrustworthy obscure binary downloaded from a forum you can’t even read the language.
 
Disclaimer
Please note that JunOS is not provided and will not be. So please don’t ask. Also, I do not take any responsibility on what happen on your PC, keep in mind this howto requires some patience and that is not for complete beginners. Moreover, this howto doesn’t necessarily present the best and/or easiest way to emulate JunOS. This is the cleanest and less intrusive for me but please feel free to give me constructive comments and tell what worked or didn’t worked for you.


Installation
Requirements
· JunOS runs on top of
FreeBSD. So you need to download the mini installation ISO, version >= 4.5 because earlier versions don’t support the Intel e1000 interface (em driver). Personally, I used the FreeBSD 4.11 mini-inst ISO but you could use FreeBSD 6 or 7.
· JunOS itself. If you are smart and patient you will find it. I used jinstall-8.5R1.14-domestic-signed.tgz for my installations.
· Qemu source code. Again, I used
Qemu 0.11.0. You can choose to download it later with wget (I’ll show you how).
· Download
OpenVPN to create TAP interfaces (Windows only, optional).
· More stuff whether you compile Qemu on Mac OS X, Windows or Linux.

Qemu compilation and patching on Mac OS X

The following procedure has been tested on Mac OS X Snow Leopard.
First you have to
install the MacPorts and its dependencies (e.g. latest Apple’s Xcode Developer Tools).
Open a terminal window and install zlib, wget and libpcap via the MacPorts:


sudo port install zlib wget libpcap 

Unzip qemu somewhere (e.g. in Documents/JunOS). Then from the qemu directory, patch and compile qemu:
Because FreeBSD hanged a few times when I was installing it inside Qemu, I applied a patch (qemu-0.11.0-macosx) which apparently fixed the problem (this is totally optional, maybe you won’t have any issue if not applied).

wget http://download.savannah.gnu.org/releases/qemu/qemu-0.11.0.tar.gz
tar xvzf qemu-0.11.0.tar.gz
cd qemu-0.11.0

wget http://downloads.sourceforge.net/gns-3/qemu-0.11.0-macosx.patch?download
patch -p1 -i qemu-0.11.0-macosx.patch wget http://downloads.sourceforge.net/gns-3/qemu-0.11.0-olive.patch?download

patch -p1 -i qemu-0.11.0-olive.patch
./configure --disable-aio --disable-kvm --disable-kqemu --disable-sdl \
--target-list=i386-softmmu

make
sudo make install


Qemu compilation and patching on Windows
If you do not want to compile Qemu on Windows (I can understand that I provide a static version that you can download here.
First some dependencies must be installed, I chose to almost compile everything:

· Download
MinGW and install it (choose custom installation with g++ and make included). The file I downloaded was MinGW-5.1.6.exe
· Download MSYS and install it, answer yes to post-installation questions and put the correct path to MinGW directory (should be C:\MinGW). The file I downloaded was MSYS-1.0.11.exe.
· Download ,
zlib, SDL, MSYS coreutils into your MSYS home directory (e.g. c:\Msys\public\username). I downloaded zlib-1.2.3.tar.gz, SDL-1.2.14.tar.gz and coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2. MSYS coreutils is necessary because Qemu signrom.sh uses tools such as dd, od, expr, cp and printf which are included in coreutils.
· Download and install
Winpcap Developer Pack: extract the contents of \lib and \include folders into \lib and \include folders of your MinGW installation location (should be C:\MinGW\lib and C:\MinGW\include)
· Start MSYS.
· Compile and install zlib:

cd
tar -xzvf zlib-1.2.3.tar.gz
cd zlib-1.2.3

./configure --prefix=/mingw
make
make install


Compile and install SDL
tar -xzvf SDL-1.2.14.tar.gz
cd SDL-1.2.14
./configure --prefix=/mingw

make
make install


· Install coreutils

tar -xvjf coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2


Copy the content of coreutils-5.97-MSYS-1.0.11-snapshot in the MinGW directory (e.g. C:\MinGW). You can also compile and install
wget in MSYS or simply use your preferred browser to download Qemu and the patch in the correct directories.

wget http://download.savannah.gnu.org/releases/qemu/qemu-0.11.0.tar.gz
tar -xvzf qemu-0.11.0.tar.gz
cd qemu-0.11.0

wget http://downloads.sourceforge.net/gns-3/qemu-0.11.0-olive.patch?download
patch -p1 -i qemu-0.11.0-olive.patch
./configure --target-list=i386-softmmu

make
make install


Qemu compilation and patching on Linux

Compiling Qemu on Linux (Ubuntu) is quite simple.First install the dependencies: ncurses, zlib, libpcap-dev and SDL libraries. SDL is optional, you can still use Qemu in a console with the –ncurses option. Then apply the patch and compile Qemu.

sudo apt-get install libncurses5-dev zlib1g-dev libsdl-dev libpcap-dev

wget http://download.savannah.gnu.org/releases/qemu/qemu-0.11.0.tar.gz
tar xvzf qemu-0.11.0.tar.gz
cd qemu-0.11.0

wget http://downloads.sourceforge.net/gns-3/qemu-0.11.0-olive.patch?download
patch -p1 -i qemu-0.11.0-olive.patch
./configure --target-list=i386-softmmu

make
sudo make install

Qemu acceleration
Qemu provides some ways to speed up the emulation, I’ll talk about 2 of them: Kqemu and KVM. Kqemu can be used on both Windows and Linux. KVM is only for Linux. I do not know if something exists for Mac OS X.
For more details about Kqemu, please have a look at the
documentation. For KVM, see thewebsite.
The installation of Kqemu on Windows is relatively easy:

1. Download
Kqemu.
2. Unzip it.
3. Locate kqemu.inf and install it (right-click and select Install). In Windows Vista, install Kqemu using the CMD prompt and this command: rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 kqemu.inf
4. Start Kqemu from the CMD prompt: net start kqemu

Kqemu on Linux (Ubuntu):
1. Install kqemu with: sudo apt-get install kqemu-source
2. If you do not want to use sudo each time you start Qemu, give the permissions to /dev/qemu with the following command:


sudo chmod o+rw /dev/kqemu

For manual installation or other Linux distributions, please see the documentation.

KVM on Linux:

Qemu requires your kernel version to be >= 2.6.29 to enable the KVM support. You have to ensure this is ok before you compile Qemu.
Don’t forget to add the -kernel-kqemu or -enable-kvm command line options when starting Qemu (I didn’t do it in this tutorial). I would recommend to activate Kqemu only when you have your Olive image ready and working.

Step By Step Guide To Install JUNOS on GNS3 [Part 2]

FreeBSD installation
Now that we have qemu installed, we can create the image for installing FreeBSD. Run this command to create it and allocate 4 GB:

qemu-img create -f qcow2 olive-base.img 4G
Launch Qemu to install FreeBSD on the image:


qemu -m 256 -hda olive-base.img -cdrom 4.11-RELEASE-i386-miniinst.iso \
-boot d -localtime


Qemu window will pop up (remember, by default press CTRL + ALT to release the cursor in Qemu):

 
Skip Kernel configuration:

Once Qemu has booted the FreeBSD installation image, you can select standard installation:

When you see the FDISK Partition Editor, press A to allocate the entire disk for FreeBSD and then Q to confirm:
Select “install a standard MBR” and when you see the FreeBSD Disklabel editor, press C to create the following partitions:

ad0s1a / 1024M
ad0s1b swap 1024M
ad0s1e /config 12M
ad0s1f /var rest



Choose “User” distribution type and answer no for the question “Would you like to install the FreeBSD ports collection?”. Exit the menu and install from a FreeBSD CD/DVD: 
Wait until all the files are installed in your image:
Once the files are copied, the installer program will ask you many user confirmation questions (Ethernet/SLIP config, gateway, inetd, FTP, NFS, security, console, linux compatibility, set time, etc). Just answer no for each of them. You will also be asked to enter a root password, just do and remember it. Now you should see the starting menu of the FreeBSD installer, exit by choosing X Exit Install. While FreeBSD CD is rebooting, quit Qemu by by pressing Ctrl-Alt-2, then type: quit.

JunOS installation

Now it’s time to install JunOS our FreeBSD image. I used JunOS 8.5R1.14 but your are free to try other versions even if it is usually recommended to have a version less than 8.5. Boot the image and attach a Intel e1000 virtual network card to Qemu:

qemu -m 256 -hda olive-base.img -boot c -localtime \
-net nic,macaddr=00:aa:00:60:01:01,model=e1000 -net user


FreeBSD should start and after login with the root password, you are ready to enter commands:


Ensure you get an IP address and find out what is your default gateway IP address. Ping it just to be sure it’s working:

dhclient em0
netstat -r
ping 10.0.2.2

You can use FTP or SCP (or any other way you may think about) to download JunOS in FreeBSD. Here I chose to use SCP. On Mac OS X, don’t forget to activate “Remote login” in System Preferences -> Sharing.

scp user@10.0.2.2:~/Desktop/jinstall-8.5R1.14-domestic-signed.tgz /var/tmp

The jinstall file after 7.4 version has a binary called checkpic. This binary will fail and the image cannot be installed. Replacing this binary with /usr/bin/true fixes the issue. Also, it is needed to recalculate MD5 and SHA1 checksums before archiving them back. Finally, you can install JunOS with pkg_add.

cd /var/tmp
mkdir jinst-signed
cd jinst-signed
tar zxvf ../jinstall-8.5R1.14-domestic-signed.tgz

mkdir jinst
cd jinst
tar zxvf ../jinstall-8.5R1.14-domestic.tgz

mkdir pkgtools
cd pkgtools
tar zxvf ../pkgtools.tgz
cd bin
cp /usr/bin/true ./checkpic
cd ..
tar zcvf ../pkgtools.tgz *
cd ..
rm -rf pkgtools
md5 -q jinstall-8.5R1.14-domestic-signed.tgz >


jinstall-8.5R1.14-domestic-signed.tgz.md5
openssh sha1 jinstall-8.5R1.14-domestic-signed.tgz >
jinstall-8.5R1.14-domestic-signed.tgz.sha1

tar zcfv /var/tmp/jinstall-8.5R1.14-domestic-olive.tgz *

pkg_add -f /var/tmp/jinstall-8.5R1.14-domestic-olive.tgz

Once the jinstall package installed, you can stop FreeBSD by using the halt command and then Qemu by pressing Ctrl-Alt-2, then type: quit. The jinstall above really just installed a bootstrap environment so you need to boot up FreeBSD one more time to finish the installation (depending on your version). If you just restarted your guest above you will notice that you will get no output on your screen. This is because a real Juniper router has no VGA out and redirects everything to the serial port. No worries for us since QEMU will redirect the serial port to either stdio or a telnet port. To do so, launch Qemu with the stdio parameter:

qemu -m 256 -hda olive-base.img -boot c -localtime -nographic -serial stdio

On Mac OS X -nographic is not understand, so just ignore the Qemu window and look at your terminal.
Wait while the bootstrap process completes. The virtual olive will reboot itself automatically and nothing is needed. At the end of this process we will be sitting at a login prompt. Login as root and issue the halt command (CTRL + L if you do not see the prompt) and kill your Qemu proccess.



On Mac OS X, my terminal was kind of “broken”. To fix this, issue the reset command in your terminal.

How to build a voice lab with GNS3 and VMWare

Is it possible to build a voice lab without actual hardware? The answer is yes and no. You can build a very good lab using GNS3 and VMWare but it is not possible to build a complete lab. The underlying emulation engine for GNS3 (dynamips) does not support digital signal processors (dsps) or voice cards.
Over the next few months, I will show you how to build a very good lab without any hardware. If you want a more complete lab, you will need to obtain at least one router with dsps and voice cards. I have a 2611XM router with DSPs, a vic-2fxs card, a vic-2fxo card and an ATA-186.




watch video
Disclaimer and Due Credit:
This tutorial series is heavily based on by Jayanm of Chicago, IL.  Jaynam has obtained the following Cisco Certifications: CCIE (Voice) – CCVP – CCSP – CCNA – CQS (PIX,VPN,IDS) – VMWare Certified Professional.

I really appreciate the ground breaking research by Jaynam.
Updates and Videos in the series:
I will include future videos in this section as they are created. It is a good idea to bookmark this particular post or subscribe to our RSS Feed if you would like to keep up on all future tutorials.
Hardware
I am using a fairly basic pc with a 3Ghz hyperthreading CPU and 2GB Ram. By today’s standards, it is nothing special.
Update 1/19/09: I have added Dell 750 server with 4GB RAM for virtual servers at the Headquarters location.
Optional Hardware
As I mentioned before, I have a 2611XM router with a couple voice cards and some dsps. This is not manditory but I will include this hardware with the lab series for those that would like to purchase the hardware to follow along.
Emulated Hardware
I will be emulating 3725 routers because they will be seen on the CCIE lab. Although the 3725s call for 256 MB requirements, I have found that they only actually use ~192MB ram on my PC.
Jaynam and others have opted to use 2691′s. You may find this works better for you also.
Software
I have chosen to use Ubuntu Linux for my host operating system due to better performance over XP, stability, availability, ease of use and price.
Host OS: Ubuntu 8.0.4
PC Emulation: VMWare Server v1.0.6 or 2.x
Router Emulation: GNS3 v0.5 / v0.6
IOS: c3725-adventerprisek9_ivs-mz.124-15.T6.bin
What is possible without hardware?
It is possible to test lots of  different Cisco VOIP Technologies. Here is a short list. I am sure I will make mistakes with this list or leave things out. Feel free to email me or make a comment to help me get a more complete list.
Call Manager Features
  • Call Routing – Partitions, CSS, Time of Day routing, Route Groups, Route Lists, Route patterns, Translation Patterns, Line Groups, Hunt Lists, Hunt Pilots, 4 digit dialing
  • Media Resources – Software Based Media Resources only – Music on Hold, Software Conference Bridge
  • IP Phone registration and dialing
  • Redundancy – SRST, AAR
  • Call Admission Control – Locations based and Gatekeeper
  • Unity Integration
  • Extension Mobility
  • Attendant Console
  • IPMA

SIP Trunking
SIP-UA.com offers free SIP trunks for voice labs.

IOS Features
  • Call manager Express
  • Gatekeeper
  • IPIPGW
  • Digit manipulation
  • Auto Attendant
  • TCL Scripts
  • Voicemail Integration from CME to Unity
  • WAN QOS
  • Frame Relay
  • Class of Restriction (COR)
  • SRST
What is not possible without hardware?
  • Xcoder registration and testing
  • Hardware based conference bridges
  • Router based MOH
  • voice port configuration
  • t.37 fax store and forward
  • Fax relay
  • MGCP
  • Anything related to hardware not emulated, VG248, ATA, CAT6500, Catalyst 3550 switch.

watch video

GNS3 Installation Hypervisor Load Balancing - 2

PART 7: START GNS3 ON THE SERVER AND CREATE SIMPLE TOPOLOGY














UNIX Tutorial Eight

8.1 UNIX Variables

Variables are a way of passing information from the shell to programs when you run them. Programs look "in the environment" for particular variables and if they are found will use the values stored. Some are set by the system, others by you, yet others by the shell, or any program that loads another program.
Standard UNIX variables are split into two categories, environment variables and shell variables. In broad terms, shell variables apply only to the current instance of the shell and are used to set short-term working conditions; environment variables have a farther reaching significance, and those set at login are valid for the duration of the session. By convention, environment variables have UPPER CASE and shell variables have lower case names.

8.2 Environment Variables

An example of an environment variable is the OSTYPE variable. The value of this is the current operating system you are using. Type
% echo $OSTYPE
More examples of environment variables are
  • USER (your login name)
  • HOME (the path name of your home directory)
  • HOST (the name of the computer you are using)
  • ARCH (the architecture of the computers processor)
  • DISPLAY (the name of the computer screen to display X windows)
  • PRINTER (the default printer to send print jobs)
  • PATH (the directories the shell should search to find a command)

Finding out the current values of these variables.

ENVIRONMENT variables are set using the setenv command, displayed using the printenv or env commands, and unset using the unsetenvcommand.
To show all values of these variables, type
% printenv | less

8.3 Shell Variables

An example of a shell variable is the history variable. The value of this is how many shell commands to save, allow the user to scroll back through all the commands they have previously entered. Type
% echo $history
More examples of shell variables are
  • cwd (your current working directory)
  • home (the path name of your home directory)
  • path (the directories the shell should search to find a command)
  • prompt (the text string used to prompt for interactive commands shell your login shell)

Finding out the current values of these variables.

SHELL variables are both set and displayed using the set command. They can be unset by using the unset command.
To show all values of these variables, type
% set | less

So what is the difference between PATH and path ?

In general, environment and shell variables that have the same name (apart from the case) are distinct and independent, except for possibly having the same initial values. There are, however, exceptions.
Each time the shell variables home, user and term are changed, the corresponding environment variables HOME, USER and TERM receive the same values. However, altering the environment variables has no effect on the corresponding shell variables.
PATH and path specify directories to search for commands and programs. Both variables always represent the same directory list, and altering either automatically causes the other to be changed.

8.4 Using and setting variables

Each time you login to a UNIX host, the system looks in your home directory for initialisation files. Information in these files is used to set up your working environment. The C and TC shells uses two files called .login and .cshrc (note that both file names begin with a dot).
At login the C shell first reads .cshrc followed by .login
.login is to set conditions which will apply to the whole session and to perform actions that are relevant only at login.
.cshrc is used to set conditions and perform actions specific to the shell and to each invocation of it.
The guidelines are to set ENVIRONMENT variables in the .login file and SHELL variables in the .cshrc file.
WARNING: NEVER put commands that run graphical displays (e.g. a web browser) in your .cshrc or .login file.

8.5 Setting shell variables in the .cshrc file

For example, to change the number of shell commands saved in the history list, you need to set the shell variable history. It is set to 100 by default, but you can increase this if you wish.
% set history = 200
Check this has worked by typing
% echo $history
However, this has only set the variable for the lifetime of the current shell. If you open a new xterm window, it will only have the default history value set. To PERMANENTLY set the value of history, you will need to add the set command to the .cshrc file.
First open the .cshrc file in a text editor. An easy, user-friendly editor to use is nedit.
% nedit ~/.cshrc
Add the following line AFTER the list of other commands.
set history = 200
Save the file and force the shell to reread its .cshrc file buy using the shell source command.
% source .cshrc
Check this has worked by typing
% echo $history

8.6 Setting the path

When you type a command, your path (or PATH) variable defines in which directories the shell will look to find the command you typed. If the system returns a message saying "command: Command not found", this indicates that either the command doesn't exist at all on the system or it is simply not in your path.
For example, to run units, you either need to directly specify the units path (~/units174/bin/units), or you need to have the directory~/units174/bin in your path.
You can add it to the end of your existing path (the $path represents this) by issuing the command:
% set path = ($path ~/units174/bin)
Test that this worked by trying to run units in any directory other that where units is actually located.
% cd
% units
To add this path PERMANENTLY, add the following line to your .cshrc AFTER the list of other commands.
set path = ($path ~/units174/bin)

GNS3 Installation Hypervisor Load Balancing - 1

THIS PROCEDURE MADE UP WITHIN MULTIPLE PARTS:

1. Directory structure 2. GNS3 configurations
3. Configure Hypervisor
4. Edit Dynamips on the client
5. Edit Dynamips on the Server
6. Start Dynamips on SVR and Client
7. Start GNS3 and create simple topology




PART 1: DIRECTORY STRUCTURES
Step 1: Directory to work with… etc.

let’s create some directories in the server, remote PC and call it “GNS3”
Server: C:\GNS3 and remote pc(s): C:\GNS3
Step 2: Image directory… etc.
Server: C:\GNS3\images\ and remote pc(s): C:\GNS3\images\
Copy all the images you are planning use to both directories
Step 3: Folder for “work area” … etc.
Server: C:\GNS3\workarea\ and remote pc(s): C:\GNS3\workarea\
Step 4: Folder for router initial configurations… etc.
Server: C:\GNS3\inital_config\ and remote pc(s): C:\GNS3\inital_config\
Step 5: Folder for Dynamips work area… etc.
Server: C:\GNS3\workarea\dynamips-work-dir\ and remote pc(s): C:\GNS3\workarea\dynamips-work-dir\
Step 6: Folder for your project directory… etc.
Server: C:\GNS3\workarea\project-dir\ and remote pc(s): C:\GNS3\workarea\project-dir\
Step 7: Folder for capture directory… etc.
Server: C:\GNS3\workarea\wireshark\ and remote pc(s): C:\GNS3\workarea\wireshark\
Your directory should look like this or what is best works for you…





PART 2: CONFIGURE GNS3
Step 1: Configure Preferences General… etc.
Select  -- >   Edit -->   Preferences






Select--> General, fill out the required fields apply, OK








Step 2: Configure Preferences Dynamips; fill out the required fields, test, apply and OK.



 Step 3: Configure Preferences Capture; fill out the required fields apply, OK.



Step 4: Configure hypervisor…… etc.
Select; Edit IOS images and hypervisor




Select the image file, platform, model and uncheck default image… box and leave rest default, apply, OK.


PART 3: CONFIGURE HYPERVISOR
Step 1: Configure hypervisor… etc.
Select; Edit IOS images and hypervisor and click on “External Hypervisor” tab
Host: Your remote PC, to add more host, simply follow same steps, change IP, Port, UDP and console port
Note: XP SP2 or SP3 users; either turn of your firewall or create exceptions for dynamips and ports!
Select; Start Control Panel Windows Firewall; click on Exception tab. Click on “Add Program” for dynamips and
click on “Add Port”
After filling out rest of the fields, click on “save” and click on “IOS Images” tab





PART 4: EDIT DYNAMIPS FILE ON THE CLIENT

Step 1: Remote or login the remote PC and Start Run type “C:\Program Files\GNS3\”
Find “dynamips-start.cmd” edit with your favorite editor;
Change line five where it says 7200 to 7220

Recommend creating a shortcut for “dynamips-start.cmd” to on your desktop, because your going to use this quite frequently because everything
stop the router, you need to shutdown and restart it 



PART 5: EDIT DYNAMIPS FILE ON SERVER



Step 1: Remote or login the remote PC and Start Run type “C:\Program Files\GNS3\”

Find “dynamips-start.cmd” edit with your favorite editor;
Change line five where it says 7200 to 7221





PART 6: START DYNAMIPS ON SERVER AND CLIENT
Server:

Step 1--> Double on dynamips shortcut on the server’s desktop;
Clients:
Step 2 --> Double on dynamips shortcut on the remote PC’s desktop