Multiple SSID on OpenWRT with bandwidth limit


If you’re a network junkie and not been living under the rocks, you must have heard of OpenWRT. It’s a Linux distribution for embedded devices (routers) and gives you power to do things usually impossible or difficult with inbuilt router firmware. Wireless Freedom indeed.

This was my scenario: I had to create two wireless APs, one for the guests (no password but bandwidth limited) and another for myself (password protected but no limit on bandwidth). That way the visitors will have free wireless internet, but with limited bandwidth. The office staffs will have to connect to a password protected wifi for unrestricted bandwidth.

The requirements for the APs are,

Free Wifi for visitors
– SSID: ShadhinFree
– Password: none
– Bandwidth limit: 256Kbps uplink, 128Kbps downlink

For myself
– SSID: Shadhin
– Password: 1234567890
– Encryption: WPA2
– Bandwidth limit: none

Here’s how I did it on OpenWRT. Connect to OpenWRT shell.

1. First create two wireless APs with above configuration. Add the following lines to /etc/config/wireless (Remove any existing ‘wifi-iface’ configurations)
#myfi

config wifi-iface
option device ‘radio0’
option network ‘lan’
option mode ‘ap’
option ssid ‘7uxBo7’
option key ‘tuxfi123’
option encryption ‘psk2’

#free

config wifi-iface
option device ‘radio0’
option network ‘lan’
option mode ‘ap’
option ssid ‘7uxBo7-free’
option key ‘457tththgh’
option encryption ‘none’

As simple as that! Now to enable the wifi, go to shell and 

# wifi down; wifi up

2. Now to limit bandwidth, we’ll be using wondershaper. To install:

# opkg update
# opkg install wshaper


3. Now find which interface is the FreeWifi assigned to

# iwconfig

On mine, it was on wlan0

4. Modify /etc/config/wshaper and start wondershaper

config 'wshaper' 'settings'
option 'network' 'wlan0-1'
option 'downlink' '256'
option 'uplink' '128'


Now, start wondershaper.

# /etc/init.d/wshaper start

5. By default, wshaper isnt enabled at startup. so,

# ln -s /etc/init.d/wshaper /etc/rc.d/S99wshaper

Skype 4.2 audio problem on ubuntu 13.10


After upgrading my Ubuntu 13.10 Skype don’t capture my audio input. here is the error

ALSA lib conf.c:4694:(snd_config_expand) Unknown parameters CARD=MID
ALSA lib control.c:953:(snd_ctl_open_noupdate) Invalid CTL default:CARD=MID

Solution:

Installing ‘libasound2-plugins:i386’

sudo apt-get install libasound2-plugins:i386

Some ideas presented here: http://community.skype.com/t5/Mac/Debian-7-0-Skype-crashed-when-making-call/td-p/1371149

 

Install conky & conky theme seamod-mix on linux


Conky is a free software system monitor for the X Window System. It is available for Linux, FreeBSD, and OpenBSD.Conky is highly configurable and is able to monitor many system variables including the status of the CPU, memory, swap space, disk storage, temperatures, processes, network interfaces, battery power, system messages etc.

Install conky on Linux machine:

For ubuntu,mint,debian:
using apt-get or the Synaptic GUI.

sudo apt-get install conky-all

For fedora,opensuse,centos etc rpm base:

sudo yum install conky-all

For ArchLinux:

pacman conky-all

Now install conky theme seamod-mix.But to get all things work we need to install couple more packages(lm-sensors,hddtemp,dmidecode). you can install it via your package manager. OR visit below links.

lm-sensors

hddtemp

dmidecode

After installing above packages you need to change permission of following packages

sudo chmod u+s /usr/sbin/hddtemp
sudo chmod u+s /usr/sbin/dmidecode

*other wise hdd temperature & main board info & temperature won’t work.

Now for pretty look we need to install 2 fonts STYLBCC.ttf and Poky.ttf. if don’t know how to install it,then follow this link.

Now go to http://weather.yahoo.com and search you city
you will get a zip code of your city like ‘1915035’ into urls.
Now copy the zip code and open ‘weather’ file from downloads.
file the line ‘http://xml.weather.yahoo.com/forecastrss?w=1915035&u=c’
replace code numbers with yours & save the file.

Then open conky-startup.sh file and replace below line with ur conky files location

cd “/home/penguin/mybin/conky”

save the file.now add the ‘xxx.sh’ to start up application.

Enjoy 🙂

Screenshot from 2014-01-03 00:33:55

conky-seamod-mix theme download link: here

Get your computer hardware information in UNIX like systems(nix*)


Dmidecode reports information about your system’s hardware as described in your system BIOS according to the SMBIOS/DMI standard (see a sample output). This information typically includes system manufacturer, model name, serial number, BIOS version, asset tag as well as a lot of other details of varying level of interest and reliability depending on the manufacturer. This will often include usage status for the CPU sockets, expansion slots (e.g. AGP, PCI, ISA) and memory module slots, and the list of I/O ports (e.g. serial, parallel, USB).

Supported OS:

  • Linux i386, x86-64, ia64
  • FreeBSD i386, amd64
  • NetBSD i386, amd64
  • OpenBSD i386, amd64
  • BeOS i386
  • Cygwin i386
  • Solaris x86
  • Haiku i586

Install it with your package manager base on your OS. here i’m mention on ubuntu

$sudo apt-get install dmidecode

run it

$dmidecode

Screenshot from 2014-01-04 00:56:46

Install and configure lm-sensors on Linux


What is lm-sensors?
lm_sensors (Linux-monitoring sensors), is a free open source software-tool for Linux that provides tools and drivers for monitoring temperatures, voltage, humidity and fans.[more]

Install lm-sensors on Linux machine:

For ubuntu,mint,debian:
using apt-get or the Synaptic GUI.

sudo apt-get install lm-sensors

For fedora,opensuse,centos etc rpm base:

sudo yum install lm-sensors

For ArchLinux:

pacman lm_sensors

Configure lm-sensors: run below command on terminal and answer all questions ‘yes’ including last one.

sensors-detect

Lm-sensors

Now start the service

service kmod start

run the sensors to get desire output

sensors

Screenshot from 2014-01-03 23:37:41

if you want to view the result on GUI then install “Psensor’ on Ubuntu.
Enjoy:)

How to migrate a SQL Server database to a lower version


Problem

After recently upgrading a SQL Server instance to SQL Server 2012 a few days ago, you noticed that your application is not functioning properly. You decided to roll back the upgrade by downgrading the SQL Server database engine to SQL Server 2008 R2.  After the downgrade of the database engine, you are unable to attach the databases or restore the backups of the databases, even though the database compatibility level is set to the downgraded version of SQL Server. You receive the following error message, when you attempt to restore the database:

Msg 1813, Level 16, State 2, Line 1
Could not open new database ‘DatabaseName’. CREATE DATABASE is aborted.
Msg 948, Level 20, State 1, Line 1
The database ‘DatabaseName’ cannot be opened because it is version 655. This server supports version 611 and earlier. A downgrade path is not supported.

This error message is generated because SQL Server automatically upgrades the database, when you restore or attach the database from lower version to higher version.  SQL Server does not allow you to restore or attach a database from a higher version of SQL Server to a lower version  of SQL Server. In this tip, we will look at a one time procedure which we can follow to downgrade the database from a higher version (SQL Server 2012) of SQL Server to a lower version (SQL Server 2008 R2) of SQL Server.

Solution

The error message in the problem statement occurs because the SQL Server database files (*.mdf, *.ndf and *.ldf) and backups are not backward compatible.  Backward compatibility is why we cannot restore or attach a database created from a higher version of SQL Server to a lower version SQL Server. However, there are a few options that can help us to downgrade the database from a higher version of SQL Server to a lower version SQL Server. These options include:

  • Generate Scripts wizard of SQL Server Management Studio
  • SQL Server Integration Services
  • Custom scripting and BCP

In this tip we will use the Generate Scripts wizard of SQL Server Management Studio.  Here are the basic steps we need to follow:

  • Script the database schema in higher version of SQL Server by using the Generate Scripts wizard of SQL Server Management Studio interface.
  • Connect to the lower version of SQL Server, and then run the SQL scripts that were generated in the previous step, to create database schema and copy data.

In the next section, I will demonstrate the steps for downgrading a SQL Server 2012 database to SQL Server 2008 R2 database.

Note: For demonstration purpose, I’ll be downgrading the OUTLANDER database hosted on my SQL Server 2012 instance (IITCUKDEV01) to SQL Server 2008 R2 instance (IITCUKSQLSERVER2008).

Step-by-Step Demo: Downgrading a SQL Server 2012 database to SQL Server 2008 R2

Step-1: Script the schema of the OUTLANDER database on the SQL Server 2012 instance (IITCUKDEV01) using the Generate Scripts wizard of the SQL Server Management Studio interface.

In Object Explorer connect to IITCUKDEV01, right-click OUTLANDER database, expand Tasks and choose “Generate Scripts…”.

In Object Explorer, right-click OUTLANDER database, expand Tasks and choose “Generate Scripts…”

This launches Generate and Publish Scripts wizard. Click Next, to skip the Introduction screen and proceed to the Choose Objects page.

SQL Server Management Generate and Publish Scripts Wizard - Introduction Screen

On the Choose Objects page, choose option “Script entire database and all database objects”, and then click Next to proceed to “Set Scripting Options” page.

Choose option Script entire database and all database objects in the SQL Server Management Studio Generate Scripts Wizard

On the Set Scripting Options page, specify the location where you want to save the script file, and then choose the Advanced button.

Choose option Specifying scripting options in the SQL Server Management Studio Generate Scripts Wizard

In Advanced Scripting Options dialog box, set Script Triggers, Indexes and Primary Key options to True, Script for Server Version to SQL Server 2008 R2, and Types of data to script to Schema and Data.  This last option is key because this is what generates the data per table.

Choose option Set scripting options including scripting the Schema and Data

Once done, click OK, to close Advanced Scripting Options dialog box and return to Set Scripting Options page. In Set Scripting Options page, click Next to continue to Summary page.

After reviewing your selections on Summary page, click Next to generate scripts.

Generate and Publish Scripts - Summary Interface

Once scripts are generated successfully, choose the Finish button to close the Generate and Publish Scripts wizard.

Generate and Publish Scripts wizard iterating through each object

Step-2: Connect to the SQL Server 2008 R2 instance (IITCUKSQLSERVER2008), and then run the SQL scripts that were generated in Step-1, to create the OUTLANDER database schema and copy its data.

In Object Explorer connect to IITCUKSQLServer2008, then in SQL Server Management Studio, open the SQL Server script you saved in Step-1.

SSMS
Opening SQL Script to install OUTLANDER database
Opening SQL Script to install OUTLANDER database

Modify the script, to specify the correct location for the OUTLANDER database data and log files. Once done, run the script to create the OUTLANDER database on IITCUKSQLServer2008 instance.

Restoring OUTLANDER database

Upon successful execution, refresh the Database folder in Object Explorer. As you can see in the following image OUTLANDER database has been successfully downgraded.

Verifying OUTLANDER database downgrade

Next Steps

  • To avoid this issue, always make sure that you perform a full backup of the database before you upgrade the SQL Server and database to a higher version of SQL Server.  In addition, be sure to thoroughly test the application prior to releasing the application to the users.
  • Consider this downgrade option as your last option to rollback from an upgrade because the time and storage needed can be very large.
  • With a very large database be sure you have sufficient storage to support the data needs.
  • Be sure to verify row and object counts as well as test your application before releas