Saturday, 19 January 2013

Howto add FTP server in ESXi 5.x to support Fast Download/Upload of VM / Images

Post : Howto add FTP server in ESXi 5.x to support Fast Download/Upload of VM / Images
URL : http://aacable.wordpress.com/2012/12/12/howto-add-ftp-server-in-esxi-5-x-to-support-fast-downloadupload-of-vm-images/
Posted : December 12, 2012 at 3:59 PM
Author : Syed Jahanzaib / Pinochio~:)
Tags : cuteftp, esxi ftp, esxi slow copy, proftpd with ESXI
Categories : VMware ESXi Related
Yesterday I was trying to upload a 450GB VMDK file to ESXi host. (Actually it was VHD file and I converted it to VMDK using starwind converter), and it was uploading dead slow and showed countless hours to complete the upload.  After some googling I found that generally it takes too much time to Upload/Download any VM/ISO File FROM/TO ESXi host. I also tried VEEAM FASTSCP free tool but no avail. It still works very slow.
However if you add FTP service to your ESXi server, and use ftp client to upload/download files, then the upload/download will be much faster.  ProFTPD runs good in ESXi 5.x and offers high transfer rate over normal transfers.
As showed in the image below . . .
Upload to ESXi Host using Vsphere Client
http://aacable.files.wordpress.com/2012/12/9-8mb.png&h=143
Upload to ESXi Host using FTP Client [After adding FTP service in ESXi]
http://aacable.files.wordpress.com/2012/12/27mb.png&h=146
.
To add FTP Service, use the following method.
First We have to Enable SSH in ESXi . Connect to your ESXi host,
Goto Configuration
Goto Security Profiles,
Click on Properties
http://aacable.files.wordpress.com/2012/12/enable-ssh1.png&h=146
http://aacable.files.wordpress.com/2012/12/2-enable-ssh.png&h=300
.
http://aacable.files.wordpress.com/2012/12/3-enable-ssh.png&h=300
SSH service is now enabled on ESXi.
Now Connect to your ESXi host using any ssh client like putty.
Navigate to your datastore folder. For example the datastore on my ESXi host name is 1TB,
 cd /vmfs/volumes/1TB/
[Change the 1TB to match your datastore name]
Create any folder where your FTP Service files can be downloaded from the internet or any other source.
[make sure internet service is enabled so file can dierctly download to esxi host, if its not possible then download the package on your client PC, then upload it using Vsphere client and skip to esxcli software install section below . . . ]
mkdir ftp
cd ftp
Now download proftpd by using wget
wget  http://esxi-customizer.googlecode.com/files/ProFTPD-1.3.3-8-offline_bundle.zip
Now install it by using esxcli
esxcli software vib install --no-sig-check -d /vmfs/volumes/1TB/ftp/ProFTPD-1.3.3-8-offline_bundle.zip
[Change the 1TB to match your datastore name]
Later if you decide to remove proftp , simply issue following command
To uninstall the package run the following command
esxcli software vib remove -n ProFTPD
Now test it by using simple dos ftp command
ftp 10.0.0.1
http://aacable.files.wordpress.com/2012/12/ftp.png&h=71
Or using any ftp client like   CUTEFTP PRO
http://aacable.files.wordpress.com/2012/12/4-ftp-cute.png&h=148


































Monday, 10 December 2012

DMASOFTLAB Radius Manager: Install + Backup + Restore [Short Reference Guide]

Post : DMASOFTLAB Radius Manager: Install + Backup + Restore [Short Reference Guide]
URL : http://aacable.wordpress.com/2012/11/30/dmasoftlab-radius-manager-install-backup-restore-short-reference-guide/
Posted : November 30, 2012 at 3:19 PM
Author : Syed Jahanzaib / Pinochio~:)
Categories : Uncategorized
http://aacable.files.wordpress.com/2011/10/ubuntu.png&h=116
http://aacable.files.wordpress.com/2011/11/dmalogo.jpeg&h=53
Following is a short reference guide for DMASOFTLAB Radius Manager
Part-  1)         Installation Of RM,
Part- 2)         Complete Backup,
Part- 3)         Restore RM Data to new Installation.
.
.
Part-1 # Installation of Radius Manager 4.x on Ubuntu 10.4
DMASOFTLAB Radius Manager 4.0 Short reference manual guide for UBUNTU 10.4
After you have installed Ubuntu, configure IP address and enable internet access on it.
Now open Terminal Window and issue the below command to install required Modules.
apt-get install mc wget rcconf make gcc mysql-server mysql-client libmysqlclient15-dev libperl-dev curl php5 php5-mysql php5-cli php5-curl php5-mcrypt php5-gd php5-snmp
wget http://www.dmasoftlab.com/cont/download/libltdl3_1.5.24-1ubuntu1_i386.deb
wget http://www.dmasoftlab.com/cont/download/libltdl3-dev_1.5.24-1ubuntu1_i386.deb
dpkg -i libltdl3_1.5.24-1ubuntu1_i386.deb
dpkg -i libltdl3-dev_1.5.24-1ubuntu1_i386.deb

IONCUBE Installation:
First Download ioncube library
wget http://www.dmasoftlab.com/cont/download/ioncube_loaders_lin_x86.tar.gz
Untar it in any temp folder for example /temp/ioncube
tar zxvf ioncube_loaders_lin_x86.tar.gz
Create new folder for ioncube in usr/local
mkdir /usr/local/ioncube
and copy the whole folder in /usr/local
Now Add the appropriate ionCube loader to your php.ini
For example
Add this line on top
zend_extension=/usr/local/ioncube/ioncube_loader_lin_5.3.so
in following files.
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
Installation procedure of FreeRadius
==============================
wget http://www.dmasoftlab.com/cont/download/freeradius-server-2.1.8-dmamod-3.tar.gz
tar zxvf freeradius-server-2.1.8-dmamod-3.tar.gz
cd freeradius-server-2.1.8-dmamod-3
./configure
make
make install
ldconfig
Now test RADIUS by issuing following command:
radiusd -X
You will see something like below . . .
http://aacable.files.wordpress.com/2012/11/radius-ready1.png&h=100
Set the correct ownership on FreeRadius configuration files
================================================
chown www-data /usr/local/etc/raddb
chown www-data /usr/local/etc/raddb/clients.conf
TIP:
Review and edit (if required) the MySQL credentials in /usr/local/etc/raddb/sql.conf
(Just in case you have mentioned different password/id for mysql)
Creating MySQL databases with MySQL command line tool
===============================================
mysql -u root -ppassword
CREATE DATABASE radius;
CREATE DATABASE conntrack;
CREATE USER 'radius'@'localhost' IDENTIFIED BY 'welcome2agp';
CREATE USER 'conntrack'@'localhost' IDENTIFIED BY welcome2agp';
GRANT ALL ON radius.* TO radius@localhost;
GRANT ALL ON conntrack.* TO conntrack@localhost;
exit
 Time to Install RADIUS MANAGER 4.0.4
=================================
Copy the radius manager radiusmanager-4.0.4.tgz (or your version) in any temp folder
now extract it using
tar zxvf radiusmanager-4.0.4.tgz
cd radiusmanager-4.0.4.tgz
chmod +x install.sh
Execute the installation Script . . .
./install.sh
Now the install script will ask few questions . . . Select answers as per your local design.
For example:
Select the Operating  System
2
(For Ubuntu)
Select Installation type:
1
(New Installation)
WWW root path:
Press Enter to select the Default , which is /var/www
Radius Database host:
Press Enter to select the Default , which is localhost
Radius Database username:
Press Enter to select the Default , which is radius
Radius Database password:
Press Enter to select the Default , which is radius123
CTS Database host:
Press Enter to select the Default , which is localhost
CTS database username:
Press Enter to select the Default , which is conntrack
CTS database password:
Press Enter to select the Default , which is conn123
Freeradius UNIX User:
Press Enter to select the Default , which is root
Httpd Unix User:
Press Enter to select the Default , which is www-data
Create rmpoller service:
Press Enter to select the Default , which is y (yes)
create rmconntrack service:
Press Enter to select the Default , which is y (yes)
Backup Radius database:
Press Enter to select the Default , which is y (yes)
Now it will ask if you want to start the installation
Press y and press ENTER to continue the installation.
and at the end you will INSTALLATION COMPLETE!
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/11/radius-installation-complete.png&h=776
Now copy the two license files (that you receive from DMASOFTLAB) in /var/www/radiusmanager
lic.txt
mode.txt
Now access the admin panel from your browser
http://yourip/radiusmanager/admin.php
> TIPS:
>
1# : If you see the following error while accessing admin.php
Could not connect to localhost
Make sure your passwords for radius and conntrack hosts are set correctly in
/etc/radiusmanager.cfg
/var/www/radiusmanager/config/system_cfg.php
2# : If you see blank page while accessing admin.php , following could be wrong.
1- Your license files are not valid or expired.
2- you have not installed ioncube library correctly.
To test if your license is valid, tail the /var/log/apache2/access.log and error.log , they will show you if your license have issues.
To test IONCUBE LIBRARY , Open Terminal and Type
php-v
& you should see something similar to below . . . (Focu on Last line that says with the ioncube php loader . . .)
root@zaib-desktop:~# php -v
PHP 5.3.2-1ubuntu4.18 with Suhosin-Patch (cli) (built: Sep 12 2012 19:33:42)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd.
To be continued . . .
:)




















































































Howto change MAC address of VM hosted in VM-Workstation

Post : Howto change MAC address of VM hosted in VM-Workstation
URL : http://aacable.wordpress.com/2012/12/04/howto-change-mac-address-of-vm-hosted-in-vm-workstation/
Posted : December 4, 2012 at 9:02 AM
Author : Syed Jahanzaib / Pinochio~:)
Categories : General IT Related
http://aacable.files.wordpress.com/2012/06/vmware.jpg&h=84
http://aacable.files.wordpress.com/2012/12/ethernet_mac_address.jpg&h=112

Manually Assigning a MAC Address For VM
To make sure that the same MAC address is assigned to a given virtual machine every time, even if the virtual machine is moved, you can assign the address manually instead of allowing VMware Workstation to assign it automatically. To assign the same, unique MAC address to any virtual machine manually, use a text editor to remove three lines from the configuration file and add two lines. The configuration file has a .vmx extension at the end of the file name.
To change MAC address of any virtual machine running under VM Workstation, Follow the below . . .
1- Make sure that the target VM is turned off.
2- Browse to folder where your VM is available. For example
F:\VM-WARE-IMAGES\UBUNTU
3- Now open VMX file in NOTEPAD , the name would be something like machine_name.VMX
4- Remove the three lines from the configuration file that begin with:
    ethernet0.generatedAddress
    ethernet0.addressType
    ethernet0.generatedAddressOffset
[Note: Change the ethernet0 to match your's]
Now Add a new static MAC address line to the configuration file with help of the following entries:
ethernet0.addressType = "static"
ethernet0.address = "00:11:22:33:44:55"
5- Now Save the configuration file. & Start the VM

















Cisco 3750: Howto enable err-disabled ports

Post : Cisco 3750: Howto enable err-disabled ports
URL : http://aacable.wordpress.com/2012/12/07/cisco-3750-howto-enable-err-disabled-ports/
Posted : December 7, 2012 at 2:09 PM
Author : Syed Jahanzaib / Pinochio~:)
Tags : cisco 3750, howto enable ports on switch 3750, show interfaces status err-disabled
Categories : Cisco Related
Personnel Reference Guide:
http://aacable.files.wordpress.com/2012/12/3750.png&h=85
To enable err-disabled ports on Cisco 3750 switch series. Follow the below . . .
First make telnet connection with the switch
> telnet 10.0.0.1
(change the ip as required,)
Enter Password to continue.
To view Disabled Ports:
> show interfaces status err-disabled
e.g:
> NOC_SWITCH>show int status err-disabled
>
> Port      Name               Status                    Reason               Err-disabled Vlans
> Gi2/0/10                     err-disabled         link-flap
>
> NOC_SWITCH>
To Enable Port:
> enable
> config t
> int G2/0/10
> no switchport port-security
> shut
> no shut
> exit
Change the interface name to match your. In above example I had two 2750 models in stack mode. so its showing G2, you may get G1 if you have single switch.
















[New post] HyperV to VMware conversion

Post : HyperV to VMware conversion
URL : http://aacable.wordpress.com/2012/12/07/hyperv-to-vmware-conversion/
Posted : December 7, 2012 at 4:53 PM
Author : Syed Jahanzaib / Pinochio~:)
Tags : hyperv to vmware, hyperv to vmware conversion, vmware vcenter converter
Categories : VMware ESXi Related
http://aacable.files.wordpress.com/2012/02/virtualization-with-hyper-v.png http://cdn4.steadfast.net/images/vmware.jpg
Howto convert Hyper-V hosts to Vmware ESXi
First Download Vmware Vcenter convertetr 5.x from following location.
You must have vmware account to download the utlity, you can rgister it free.
> http://downloads.vmware.com/d/details/converter5/dHclYnRqZEBiZEAldw== (http://downloads.vmware.com/d/details/converter5/dHclYnRqZEBiZEAldw==)
After installation Done. Execute it. You may see following screen.
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/12/1-vmconverter.png&h=174
.
Now click on CONVERT MACHINE
In Source Type , Select HYPER-V
In Server, type your Hyper-V IP
In User Name/Password , type your Administrator ID and password
and click NEXT to continue . . .
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/12/2-convert-hyperv-machione.png&h=226
If you receive the following error
Unable to contact the specified host 'x.x.x.x' . The host might not be available on the network, there might be a network configuration problem, or the management services on this host are not responding
then disable the firewall on HYPERV Windows 2008 by using following command (at hyper v server command prompt)
> netsh firewall set opmode disable
Now it will ask you for the agent deployment,
click YES to continue.
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/12/3-agent.png&h=232
.
.
In next screen of  SOURCE SERVER , It will give you the list of machines hosted on source Hyper-V server.
Select your desired machine ,
and click NEXT to continue
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/12/4-select-source-vm-hyperv1.png&h=232
.
.
In Next Screen of  DESTINATION SYSTEM , select the destination VMWARE ESXi Server
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/12/5-select-destination-server.png&h=233 .
.
In the next screen of  DESTINATION VIRTUAL MACHINE , Click NEXT to continue (Or you can change the machine name label here)
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/12/6-select-name1.png&h=232 .
.
In the next screen of  DESTINATION LOCATION , Select the datastore location (the drive where you want upload the vm)
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/12/7-select-datastore1.png&h=232 .
.
In the next screen , it will show you all the options before finally start converting, review all the options and modify if any required. then Click NEXT , and then FINISH to start converting the machine
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/12/8-final.png&h=231
.
.
Finally it will start conversion of the hyper v machine into Vmware Esxi.
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/12/9-status.png&h=65 .
.




































[New post] Vritualization: 3 in 1 > Using Mikrotik + Squid Proxy + Radius on single machine to save resources :)

Post : Vritualization: 3 in 1 > Using Mikrotik + Squid Proxy + Radius on single machine to save resources :)
URL : http://aacable.wordpress.com/2012/12/10/vritualization-3-in-1-using-mikrotik-squid-proxy-radius-on-single-machine-to-save-resources/
Posted : December 10, 2012 at 1:12 PM
Author : Syed Jahanzaib / Pinochio~:)
Tags : mikrotik with ESXi, Vmware Virtual Switch, Vritualizing mikrotik
Categories : IBM Related, Mikrotik Related, Radius Manager, VMware ESXi Related
http://nguoidentubinhduong.files.wordpress.com/2011/09/virtualized_by_vmware1.jpg&h=181 Virtualizing Mikrotik + Squid + Radius
3 in 1 using ESXi
~ By Syed Jahanzaib ~
http://aacable.files.wordpress.com/2012/12/virtual-network.png (http://aacable.wordpress.com/?attachment_id=2846)
.
Recently I did an installation of a network where they were low in hardware resources but still they wanted to utilize the benefits of Mikrotik Router OS with external Squid proxy server and also the Radius Billing Server . So in total they required at least 3 physical machines, but I managed to install all of them on single server using Virtualization technology of VMWARE ESXi 5.x (64bit) and it worked so great :)
Here is how I did it.
> Note: Because of some time shortage, I am just giving you an idea how it can be done, I am not writing in pin point details on how to connect every machine with Virtual/Physical switches. I will write about it soon.
Hardware Used for the Example:
64bit Server Class machine
Multiple SATA HDD's (the more Faster drives (like 10-15krpm) you have, the better result you will be able to achieve. Preferably in RAID mode, either 10 or 0, depend on your management and goals, in this example I used 7200krpm SATA HDD, I dedicate each hdd for each OS, I tested it on IBM xseries with RAID0 and found RAID 0 much more faster with 15krpm but its not redundant, one drive fail and your whole RAID will go down, so if you want redundancy, go with at least RAID 5 or RAID 10 , Raid 1 is also good as it mirrors each drive, but requires additional drives and also for proxy, its useless to use mirroring as it would be requiring more read/write burden on controller, oh GOD, in which argument I got into :p)
16GB RAM (Mikrotik doesn't requires much RAM in fact it officially supports maximum of 2G, but Radius and Squid do requires some good amount of RAM, I dedicated 8 GB to SQUID, 4GB to Radius, 2 GB to Mikrotik)
4 Network Adapters ( In this article, dueto time shortage, I have only mentioned howto add two network adapters for LAN and WAN link using virtual Switch tech)
Software Used:
1) Vmware ESXi 5.x  64bit as a Virtual Hyper-visor Server
Guest OS installed in it are as following
2) Mikrotik Router-OS 5.22
3) Ubuntu 10.4 for SQUID Proxy (2.7)
4) Ubuntu 10.4 for Radius Manager Billing System
First install Vmware ESXi. You can get its free edition from www.vmware.com  , just register and download the latest version , it would be in .iso format, Simply burn it to CD, and install it on your server , its very simple to install the ESXi, nothing more then just clicking NEXT NEXT :)
After ESXi installed, configure IP address on it, so you can manage it using its client called Vsphere client.
To shorten the story I am using only two interfaces for the mikrotik, LAN and WAN. in this example (shorten version) ESXi have two interfaces connected , one with the LAN user switch and other interface connected with the WAN (physically)
Creating Virtual Switch and bind Network Adapters with this switch.
Goto Configuration tab
From the list appear in Hardware section, click on Networking and click on ADD Networking
As showed in the image below , , ,
http://aacable.files.wordpress.com/2012/12/add-virtual-switch.png&h=118
http://aacable.files.wordpress.com/2012/12/2-add-network-wizard.png&h=218
http://aacable.files.wordpress.com/2012/12/3-add-network-wizard.png&h=220
http://aacable.files.wordpress.com/2012/12/4-add-network-wizard.png&h=220
http://aacable.files.wordpress.com/2012/12/5-add-network-wizard.png&h=219
Ok, our virtual switch is created.
Now its time to bind our WAN adapter in this switch. (So it can later be used for WAN for all hosts we will requiring for)
Click on the Properties
http://aacable.files.wordpress.com/2012/12/6-add-network-wizard.png&h=204
http://aacable.files.wordpress.com/2012/12/7-add-network-wizard.png&h=220
Done.
Creating Mikrotik in VM and assigning network adapters.
Now create new Virtual Machine for your Mikrotik.
Select necessary hardware that you required as required per user load. for example
Mikrotik = 1 CPU / 1 GB RAM / 10 GB HDD /
In Network Adapter Section, by default only one adapter is added, You have to add another adapter by selecting the number of adapters in drop down listing.
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/12/8-adding-lan-wan-in-host.png&h=285
Once the configuration is completed. Simply install the Mikrotik in newly created hosts you just created in above steps.
After configuration is complete, review once again the host settings,
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/12/9-mikrotik-network-adapters.png&h=266
After the installation is done, Connect to mikrotik with WINBOX  and look for interfaces
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/12/mikrotik-interface.png&h=113
.
I will write more on it later.

































Wednesday, 28 November 2012

DMASOFTLAB Radius Manager SMS Notification Configuration


DMASOFTLAB Radius Manager have a very nice feature of SMS notification for Account Expiry / New Account Activation Message, New Account Activation Code / Password Recovery and many other cool functions that can be done using this feature, however activating it is a bit complex thing to do. As radius manager supplies clickatell HTTP gateway API with there default installation, and I really didn't wanted to purchase the clickatell account because it would be expensive for any mid-large size network, even a small network wouldn't want to pay extra amount. So I decided to create my own HTTP gateway which is connected with my GSM Modem. Following is the complete guide on how you can create your own SMS HTTP GATEWAY.
> http://aacable.wordpress.com/2012/11/26/howto-configure-your-local-http-gateway-using-kannel-on-ubuntu/ (http://aacable.wordpress.com/2012/11/26/howto-configure-your-local-http-gateway-using-kannel-on-ubuntu/)
Once you have a working HTTP gateway , you can move on to RM configuration section.
Howto configure API to make it work with your Local SMS HTTP gateway.
Login to your RM box using terminal.
Open the api.php file by
nano /var/www/radiusmanager/api/api.php
(Change the path if you have RM installed at some other folder)
Now remove all lines and replace them with the following.
<?php
/*****************************************************************************
**        Name: api_sendsms
**
** Description: This function is used to send a SMS messages to a mobile phone.
**        You can call your SMS gateway to send a message to a mobile phone.
**        The function includes an example code of integrating the
**        clickatell.com HTTP -> SMS gateway.
**
** >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
**  Syed Jahanziab > I have changed it to use my local sms gateway running on KANNEL , Configured on same box where RM is installed and connected TELTONIKA GSM MODEM with it in VM.
** >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
**
**       Input: $mode - SMSMODE_ACCVERIFY: send verification code
**            SMSMODE_WELCOME: send account data
**            SMSMODE_PSWCODE: send new password activation code
**            SMSMODE_NEWPSW: send new password
**        $username - RADIUS user name
**        $password - RADIUS password
**        $firstname - first name of user
**        $lastname - last name of user
**        $address - postal address of user
**        $city - city of user
**        $zip - zip code of user
**        $country - country of user
**        $state - state of user
**        $phone - phone number of user
**        $mobile - mobile number of user
**        $email - email address of user
**        $srvid - associated service id
**        $verifycode - the verification code to send
**        $errmsg - pointer to error message returned by the gateway
**
**      Output: True if API succeeded or false
*****************************************************************************/
function api_sendsms($mode, $username, $password, $firstname, $lastname, $address, $city, $zip, $country, $state, $phone, $mobile, $email, $srvid, $verifycode, &$errmsg)
{
// enter your local sms http gateway credentials here
$api_user     = "kannel";
$api_password = "kannel";
switch ($mode)
{
case SMSMODE_ACCVERIFY:
$body = "Enter the following verification code in UCP: $verifycode";
break;
case SMSMODE_WELCOME:
$body = "Welcome new user! Your user name is $username, your password is $password";
break;
case SMSMODE_PSWCODE:
$body = "New password activation code: $verifycode";
break;
case SMSMODE_NEWPSW:
$body = "Your new password: $password";
break;
}
// return success (uncomment the following lines in testing environments only)
//  print $body;
//  return true;
// implement your own SMS gateway in the following block
$body = rawurlencode($body);
$ch = curl_init();
// change the IP and id password in the below line to match your local config. syed jahanzaib
curl_setopt($ch, CURLOPT_URL, "http://101.11.11.250:13013/cgi-bin/sendsms?user=$api_user&password=$api_password&api_id=$api_id&to=$mobile&text=$body");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
curl_close($ch);
// uncomment this to see the result from clickatell.com HTTP->SMS gateway
//  print $res;
if (substr($res, 0 , 4) ==  "ERR:")
{
$errmsg = $res;
return false;
}
// SMS sent successfully
return true;
}
?>
That's It. Your RM is ready to send sms using your local SMS HTTP gateway.
.
Howto send Account Expiry Warning to User
Logon to RM Admin Panel,
Goto System/ System Settings
At the bottom of the page, You will see Notification's section.
At the Expiry warning: Type the number of days you want RM to send account expiry warning before the account expires.
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/11/sms-notifi-when-expir-setting.png&h=410
.
Howto Recover User Password via FORGOT PASSWORD link at user.php (ver 4.x or above)
User can recover his forgotten password using Forgot my password at (http://101.11.11.250/radiusmanager/passwd.php) user.php
For Example
http://aacable.files.wordpress.com/2012/11/forgot-password.png&h=323 .
http://aacable.files.wordpress.com/2012/11/forgot-password-2.png&h=303
After submission the mobile number, user will receive A code on his mobile number (If he have defined valid number while registering the account. Then after entering the code in the below screen, he will receive new password.
As showed in the image below . . .
http://aacable.files.wordpress.com/2012/11/enter-code.png&h=74
http://aacable.files.wordpress.com/2012/11/new-passwoprd-sms.png&h=78
.
.
Regard's
Syed Jahanzaib





































How to configure your Local HTTP Gateway using KANNEL on Ubuntu

 Howto configure your Local HTTP Gateway using KANNEL on Ubuntu

As per web defines: Kannel (http://www.kannel.org/) is one of the most popular open source WAP/SMS Gateway, because its very good performance to handle a huge SMS. Kannel supports many modem's brand even generic modem, also support multi modems (modem bank).
x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x
After some testing, I have found Kannel one of the best , fastest SMS and WAP gateway among other open source sms gateways , capable of handling several hundreds of requests per second". "
Following is a guide on how you can configure your own Local SMS HTTP gateway using KANNEL
(The aim of configuring kannel on my Ubuntu box was that I required it to send sms via DMASOFTLAB RADIUS MANAGER which uses API to send sms via clickatell HTTP gateway for New Account / Expiry Warning / Password recovery via sms , verification code and many other cool functions. It comes with the clickatell HTTP gateway API which off course require you to buy sms bundle package and do require handsome amount of $$ if you have a huge number of users, Therefore to save $$ money , I  created my own gateway)
O/S = Ubuntu 10.4
Hardware = Teltonika ModemUSB/E12 UM1400
First install KANNEL using apt-get (the easiest one ;) )
apt-get install libxml2
apt-get install kannel
NOTE:
Kannel works great with the Linux base distribution BUT there are some workarounds to make it run on Windows. Do some googling and you will find few links for it.
Now open the kannel config file by
nano /etc/kannel/kannel.conf
Remove all the lines and paste the following config
# Syed Jahanzaib
# http://aacable.wordpress.com
# aacable [at] hotmail.com
group = core
admin-port = 13000
smsbox-port = 13001
admin-password = zaibadmin
status-password = zaibstatus
log-file = "/var/log/kannel/bearerbox.log"
log-level = 0
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
group = smsc
smsc = at
modemtype = teltonika
device = /dev/ttyACM0 # change this to match your port, it could ACM1 , if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device, Jahanzaib)
speed = 19200
my-number = 0333302100000 # (put your sim number, not necessary)
group = modems
id = teltonika
name = "Teltonika e12"
detect-string = "Undefined"
enable-mms = true
init-string = "AT+CNMI=2,2,0,1,1"
speed = 115200
group = smsbox
bearerbox-host = localhost
sendsms-port = 13013
global-sender = 13013
sendsms-chars = "0123456789 +-"
log-file = "/var/log/kannel/smsbox.log"
log-level = 0
access-log = "/var/log/kannel/access.log"
group = sendsms-user
username = kannel
password = kannel
concatenation = true
max-messages = 3
group = sms-service
keyword = default
get-url = "http://localhost/kannel/receivesms.php?sender=%p&amp;text=%b"
accept-x-kannel-headers = true
max-messages = 3
concatenation = true
catch-all = true
Open two terminal windows and issue below commands in each terminal box
1. Start the BearerBox
bearerbox -v 0 /etc/kannel/kannel.conf
2. Start the SMSBox
smsbox -v 0 /etc/kannel/kannel.conf
[If you receive error that the address is already in use, first issue the command service kannel stop]
.
Now From your browse, type the following to make sure kannel is working fine :)
http://101.11.11.250:13000/status?password=zaibstatus
[change the ip and password to match your config]
and you may see the following screen , if your config is ok
http://aacable.files.wordpress.com/2012/11/kannel-status.png&h=209
.
.
Howto send SMS via http command
Open your browser and paste the following command.
http://101.11.11.250:13013/cgi-bin/sendsms?username=kannel&password=kannel&to=03333021909&text=ZAIB+KANNEL+WORK
Change the IP / ID + Password = and number to match your local configuration.
The result would be similar to the following . . .
http://aacable.files.wordpress.com/2012/11/kannel-test-ok-send-sms.png&h=169
& You will receive the sms on the target number very soon.
.
Regard's
Syed Jahanzaib










































Thursday, 22 November 2012

Mikrotik Hotspot Quick Setup Guide + Tips n Tricks for Hotspot !

A HOTSPOT is way to provide internet access to subscribers by means of an easy to use login interface as it does not require any client software/driver/dialer at user end. To log in, users may use almost any web browser , so they are not required to install additional software.It is also possible to allow users to access some web pages without authentication using Walled Garden feature.
In my personnel opinion, Hotspot is best suited for ad hoc situations, where you cannot control how the client has their machines configured. This is generally useful in Conference Rooms, Hotels, Cafe’s , Restaurants and likewise since people will come and go and you have few permanent users.
One big advantage of using hotspot is that HotSpot does not require any client software/driver/dialer. One disadvantage of using HotSpot is that its usually requires your client to open up his browser to log in before he can use your service . So users wanting to connect to your service using a router or some kind usually have a problem (as routers usually don’t support logging in via HTTP).
Following is a quick setup guide (CLI version) on how-to setup HOTSPOT server in Mikrotik using command interface.
This guide will help you in setting up . . .
HOTSPOT server,
# It will also configure DHCP to assign users IP Address from 172.16.0.1-172.16.0.255 ip pool .
Change it accordingly.
# I will add two Speed / Rate Limit Profiles, 256k and 512k, it will add a new user ‘zaib‘ password=test with 512k profile and user ‘test‘ Password=test with 256k  Limit.
# It will Add Default Route to internet which is DSL router ip 192.168.2.2 ,
Change it accordingly.
In this examples, Mikrotik have two interface cards.
Ether1 LAN = 172.16.0.1  / Connected with LAN/Hotspot users
Ether2 WAN = 192.168.2.1 / Connected with DSL router
DSL Router = 192.168.2.2
Script Starts Below.
01/ip address
02add address=172.16.0.1/24 comment=LAN disabled=no interface=ether1 network=172.16.0.0
03add address=192.168.2.1/24 comment=WAN disabled=no interface=ether2 network=192.168.2.0
04 
05/ip pool
06add name=hs-pool-1 ranges=172.16.0.10-172.16.0.255
07 
08/ip dns
09set allow-remote-requests=yes cache-max-ttl=1w cache-size=10000KiB max-udp-packet-size=512 servers=192.168.2.2
10 
11/ip dhcp-server
12add address-pool=hs-pool-1 authoritative=after-2sec-delay bootp-support=static disabled=no interface=ether1 lease-time=1h name=dhcp1
13 
14/ip dhcp-server config set store-leases-disk=5m
15 
16/ip dhcp-server network add address=172.16.0.0/24 comment="hotspot network" gateway=172.16.0.1
17 
18/ip hotspot profile
19 
20set default dns-name="" hotspot-address=0.0.0.0 html-directory=hotspot http-cookie-lifetime=3d http-proxy=0.0.0.0:0 login-by=cookie,http-chap name=default rate-limit="" smtp-server=0.0.0.0 split-user-domain=no use-radius=no
21 
22add dns-name=login.aacable.net hotspot-address=172.16.0.1 html-directory=hotspot http-cookie-lifetime=1d http-proxy=0.0.0.0:0 login-by=cookie,http-chap name=hsprof1 rate-limit="" smtp-server=0.0.0.0 split-user-domain=no use-radius=no
23 
24/ip hotspot
25add address-pool=hs-pool-1 addresses-per-mac=2 disabled=no idle-timeout=5m interface=ether1 keepalive-timeout=none name=hotspot1 profile=hsprof1
26 
27/ip hotspot user profile
28 
29set default idle-timeout=none keepalive-timeout=2m name=default shared-users=1 status-autorefresh=1m transparent-proxy=no
30 
31add address-pool=hs-pool-1 advertise=no idle-timeout=none keepalive-timeout=2m name="512k Limit" open-status-page=always rate-limit=512k/512k shared-users=1 status-autorefresh=1m transparent-proxy=yes
32 
33add address-pool=hs-pool-1 advertise=no idle-timeout=none keepalive-timeout=2m name="256k Limit" open-status-page=always rate-limit=256k/256k shared-users=1 status-autorefresh=1m transparent-proxy=yes
34 
35/ip hotspot service-port set ftp disabled=yes ports=21
36 
37/ip hotspot walled-garden ip add action=accept disabled=no dst-address=172.16.0.1
38 
39/ip hotspot set numbers=hotspot1 address-pool=none
40 
41/ip firewall nat add action=masquerade chain=srcnat disabled=no
42 
43/ip hotspot user
44add disabled=no name=admin password=123 profile=default
45add disabled=no name=zaib password=test profile="512k Limit" server=hotspot1
46add disabled=no name=test-256k password=test profile="256k Limit" server=hotspot1
47 
48/ip route
49add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.2.2 scope=30 target-scope=10
Basic HOSTPOT is now configured. Now goto client pc, Upon booting, it will automatically receive ip from hotspot dhcp server, Open your browser and try to open any web site, You will see Hotspot Login page asking for credentials.
or you can customize it to something that looks like this===
You can also make configuration changes via GUI.
Please read the following guide for easy n step by step guide on HOTSPOT setup.
http://wiki.mikrotik.com/wiki/Hotspot_server_setup

HOWTO CUSTOMIZE HOTSPOT LOGIN PAGE

You can use some fancy good looking login page. To customize the login page, Open Winbox , Goto Files , here you will see various fileslook at hotspot/login.html , Drag n Drop this file to Desktop. See the attached picture.



Now open it using any html editor, I always prefer FRONTPAGE for editing HTML pages due to its easy interface. Customize it according to your need, You must have some prior knowledge of some website / html editing. You can insert your logo , advertisement and lot more in this page. After you are done, simply Upload the file back from where you downloaded it. use drag n drop feature. For beginners, I recommend you not to change any default variable, just ad your logo n text , After you are familiarized with the structure, you can build your own fully customized login page.
Good examples of hotspot login page can be found at following link.

Howto Redirect User to your selected site after succesful Login

If you want that after successful login to hotspot , user must be redirected to your advertisement web site / any other web, then You will need to replace a variable on the hotspot/login.html document on the mikrotik router.
You must replace $(link-orig) with the url of the website you want them to get after login.
There are two links that you have to replace, and both look like this:
1<input type="hidden" name="dst" value="$(link-orig)">
Change them to
1<input type="hidden" name="dst" value="http://www.yoursite.com">
Now after successful login, user will automatically redirected to yoursite.com, you can also create your customized page showing users details using the variables available.

Howto Allow URL for some destinations for non authenticated Users

Sometimes it is required to allow access to some destinations / URLs for non authenticated users, for example if you have a web / radius server and you want that user can access it without login to hotspot, then you can add its ip address in walled garden.
1/ip hotspot walled-garden add dst-host=www.website.com
2/ip hotspot walled-garden ip add dst-address=192.168.2.2 action=accept
3OR
4/ip firewall nat add chain=pre-hotspot dst-address=192.168.2.2 action=accept

HOTSPOT users can’t communicate with each other or PROXY-ARP issue

If you face hotspot broadcast issue / arp-poisoning , problem, Remove the address pool from the Hotspot to turn off Universal NAT,
1/ip hotspot set <number> address-pool=none
2OR
3/ip hotspot set numbers=hotspot1 address-pool=none
4OR
5/ip firewall nat add chain=pre-hotspot dst-address-type=!local hotspot=auth action=accept

Howto Bypass authentication for Few Clients

This bypasses the hotspot by mac address.
1/ip hotspot ip-binding add mac-address=xx:xx:xx:xx:xx:xx type=bypassed
(change xx:xx:xx:xx:xx:xx with your user's mac address. You can also use the ip address to bypass.