Thursday, February 21, 2013

Mikrotik RB493G + Unifi AP, public and guest network

1. Go to Unifi Controller Web page, sign in.
2. Open settings => Wireless Networks => Create

3. Select Security: Open, tick Guest Policy checkbox,
tick Use VLAN ID and for example put 200 for VLAN ID, click Create
4. Now open WinBox for Mikrotik setup

for my simple setup i've created bridge bridge1 for LAN, with this parameters:

 0  R name="bridge1" mtu=1500 l2mtu=1520 arp=enabled 
      mac-address=00:0C:42:A7:68:EC protocol-mode=none priority=0x8000 
      auto-mac=yes admin-mac=00:00:00:00:00:00 max-message-age=20s 
      forward-delay=15s transmit-hold-count=6 ageing-time=5m 

Saturday, February 9, 2013

Ubiquiti UniFi Controller under debian squeeze


# echo "deb http://www.ubnt.com/downloads/unifi/distros/deb/squeeze squeeze ubiquiti" >> /etc/apt/sources.list
# apt-key adv --keyserver keyserver.ubuntu.com --recv C0A52C50

# echo "deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen" >> /etc/apt/sources.list
# apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10

# apt-get update && apt-get upgrade
# apt-get install unifi

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  ca-certificates-java default-jre-headless java-common jsvc libcommons-daemon-java libjpeg62 liblcms1 libnspr4-0d libnss3-1d mongodb-10gen openjdk-6-jre-headless
  openjdk-6-jre-lib tzdata-java
Suggested packages:
  default-jre equivs java-virtual-machine liblcms-utils libnss-mdns sun-java6-fonts ttf-baekmuk ttf-unfonts ttf-unfonts-core ttf-sazanami-gothic ttf-kochi-gothic
  ttf-sazanami-mincho ttf-kochi-mincho ttf-wqy-microhei ttf-wqy-zenhei ttf-indic-fonts
The following NEW packages will be installed:
  ca-certificates-java default-jre-headless java-common jsvc libcommons-daemon-java libjpeg62 liblcms1 libnspr4-0d libnss3-1d mongodb-10gen openjdk-6-jre-headless
  openjdk-6-jre-lib tzdata-java unifi
0 upgraded, 14 newly installed, 0 to remove and 0 not upgraded.
Need to get 109 MB of archives.
After this operation, 244 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y



And it works https://SERVER_IP_ADDRESS:8443/


Some pictures from web interface:


Replacing degraded disk in RAID1 3ware LSI


server# tw_cli

//server> /c0 show

Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
------------------------------------------------------------------------------
u0    RAID-1    DEGRADED       -       -       -       465.651   OFF    OFF

VPort Status         Unit Size      Type  Phy Encl-Slot    Model
------------------------------------------------------------------------------
p0    DEGRADED       u0   465.76 GB SATA  0   -            ST3500320NS
p1    OK             u0   465.76 GB SATA  1   -            WDC WD5003ABYX-01WE

/* removeing degraded disk */

//server> /c0/p0 remove Removing /c0/p0 will take the disk offline. Do you want to continue ? Y|N [N]: Y Removing port /c0/p0 ... Done. //server> /c0 show Unit UnitType Status %RCmpl %V/I/M Stripe Size(GB) Cache AVrfy ------------------------------------------------------------------------------ u0 RAID-1 DEGRADED - - - 465.651 OFF OFF VPort Status Unit Size Type Phy Encl-Slot Model ------------------------------------------------------------------------------ p1 OK u0 465.76 GB SATA 1 - WDC WD5003ABYX-01WE

/* physically insert new hard disk and scan for this */

//server> /c0 rescan //server> /c0 show Unit UnitType Status %RCmpl %V/I/M Stripe Size(GB) Cache AVrfy ------------------------------------------------------------------------------ u0 RAID-1 DEGRADED - - - 465.651 OFF OFF VPort Status Unit Size Type Phy Encl-Slot Model ------------------------------------------------------------------------------ p0 OK - 465.76 GB SATA 0 - WDC WD5003ABYX-01WE p1 OK u0 465.76 GB SATA 1 - WDC WD5003ABYX-01WE

/* start rebuilding array */

//server> maint rebuild c0 u0 p0 Sending rebuild start request to /c0/u0 on 1 disk(s) [0] ... Done.

/* display status of rebuilding */

//server> info c0 Unit UnitType Status %RCmpl %V/I/M Stripe Size(GB) Cache AVrfy ------------------------------------------------------------------------------ u0 RAID-1 REBUILDING 5% - - 465.651 OFF OFF VPort Status Unit Size Type Phy Encl-Slot Model ------------------------------------------------------------------------------ p0 DEGRADED u0 465.76 GB SATA 0 - WDC WD5003ABYX-01WE p1 OK u0 465.76 GB SATA 1 - WDC WD5003ABYX-01WE

Sunday, February 3, 2013

Some useful linux/*nix cmds

Send cmd to screen (echo -ne '\015' emulates pressing the Enter key)
# screen -S sessionname -p 0 -X stuff 'command'`echo -ne '\015'`
Search file in packages (debian like distros)
# dpkg -S /etc/foo/foo.conf  
Check port availability
# nc -znvvw 3 192.168.1.100 80
Check availability of port range
# nc -znvvw 3 192.168.1.100 8080-8081
Row count in files with *.php extension
# find /root/* -type f -name "*.php" -exec wc -l {} + ;
Find files larger than 100MB
# find . -size +100M -exec du -h {} \;
SSH port forwarding example for SQL Server (remote-server - which have access to SQL Server by Local address 192.168.1.50, then we can connect to localhost:1433)
# ssh -f remote-server -L127.0.0.1:1433:192.168.1.50:1433 -N

FreeBSD

Get S.M.A.R.T for 3ware raided HDDs (disks starts from 0, 1, 2...)
# smartctl -a -d 3ware,0 /dev/twa0
Renew sendmail aliases
# cd /etc/mail
# make
# newaliases

Various interesting links


Background jobs with php and resque: part 1, introduction
http://www.kamisama.me/2012/10/09/background-jobs-with-php-and-resque-part-1-introduction/

Lazy pictures loading
http://speckyboy.com/2012/10/18/how-to-create-lazy-loading-images-for-your-website/

Nice notifying system for bootstrap
http://nijikokun.github.com/bootstrap-notify/

C# Async Await
http://habrahabr.ru/post/162353/#habracut

Twig PHP Template Engine
http://twig.sensiolabs.org/

PHP Coding Best Practises
http://www.phptherightway.com/

ACL phpGACL - русская документация
http://php.russofile.ru/ru/translate/rights/phpgacl/

jQuery Freetile div container organizer responsive
http://yconst.com/web/freetile/

Video: Multi-tasking in PHP
http://jonathonhill.net/2012-12-19/video-multi-tasking-in-php/

Responsive Grid Layoyut
http://suprb.com/apps/gridalicious/
http://www.dwuser.com/education/content/creating-responsive-tiled-layout-with-pure-css/

Nice charts with JavaScript
http://tenxer.github.com/xcharts/
http://techslides.com/50-javascript-charting-and-graphics-libraries/

MODBUS/TCP to MODBUS/RTU gateway server
http://mbus.sourceforge.net/

Free Responsive CSS Design Tools
http://www.designsanduiche.com/2013/02/free-responsive-css-design-tools/

to be continued...