标签: linux

  • FW: ddwrt captive portal

    5 Open Source Wi-Fi Hotspot Solutions

     

    DD-WRT

    DD-WRT is a firmware replacement you upload onto a supported wireless router. This changes your router’s control panel and gives you many more features, including several hotspot solutions: Chillispot, NoCatSplash, WiFiDog, and Sputnik. You might also find a use for the other new features as well. For example, you could create a separate wired or wireless network for your private network with VLANs and multiple SSIDs.

    Here’s an overview of the hotspot features in DD-WRT:

    • Chillispot: Gives you great hotspot authentication and management features for free or commercial hotspot locations, but requires an external RADIUS server. However, you can use hosted servers from companies such as Worldspot.net, HotSpotSystem.com, and WirelessOrbit.
    • NoCatSplash: Provides a quick and simple captive portal, but doesn’t include user login or management features. This is still great for single hotspot locations where you want users to agree to Terms of Service (ToS) before getting access.
    • WiFiDog: Gives you an advanced captive portal and content management for free hotspot locations. However, you must configure a proprietary external server.
    • Sputnik: Provides free and commercial hosted services that gives you user authentication and device management for use with free or pay access hotspot solutions.

    CoovaAP is another firmware replacement, based off of OpenWRT, specifically designed for Wi-Fi hotspots. It has the CoovaChilli access controller built-in, giving you captive portal, access provisioning, and accounting features. You can require hotspot users to login with accounts (self registered or defined by you) or just require users to agree to the Terms of Service (ToS).

    CoovaAP also sports WDS (wireless distribution system), great if you’re setting up multiple APs. If you or your organization has a Facebook page, you might want to check out the Facebook captive portal feature. The firmware also has traffic shaping controls so you can limit the bandwidth your guests use.

    For more information on CoovaAP or for help on setting it up, refer to one of my previous tutorial series.

    Open-Mesh

    Open-Mesh is perfect for larger hotspots requiring two or more APs, or even when covering an entire apartment complex or campus. The open source firmware provides the brains and gives you a zero-config, plug & play, and self-healing wireless mesh network. Plug a Open-Mesh node into the Internet and place other nodes nearby to repeat the wireless signal without running Ethernet cables to each. Then you can use their free Dashboard to remotely control and monitor your nodes and networks.

    Though you can flash your own supported equipment with the Open-Mesh firmware, you’ll probably want to buy their branded gear right from their site. The lower-cost model starts at $29 and the professional model with Power-over-Ethernet (PoE) and a few other enhancements goes for $59 each.

    Both Open-Mesh nodes offer two ESSIDs (network names): one for the hotspot users and a separate one that can be encrypted for secure private-use. You’ll also find captive portal features, user authentication and billing options via third-party solutions from Coova.org, WiFi-CPA.com, WorldSpot.net, or your RADIUS server. You can impose bandwidth limits on the public side.

    I’ve also done a tutorial series on Open-Mesh, check it out for more details or for help on getting it setup.

    ZoneCD

    The ZoneCD solution is not a firmware project like many other solutions here. It is a LiveCD loaded with Linux software, preconfigured to serve as a hotspot gateway. Insert the CD into an old computer with two network cards and you have yourself hotspot user authentication and web content filtering. A GUI is provided so you don’t even have to know anything about Linux.

    The hotspot gateway is configurable through a web-based control panel. The free service gives you the basic hotspot functionality. Premium services let you have more control over users and the hotspot, and gives you better support.

    FON

    FON isn’t a mundane hotspot solution. They even have their own language. Fonera is what they call their line of branded Wi-Fi routers. When you share your wireless Internet, creating a FON Spot, you’re called a Fonero. Then you can opt-in as as a Bill to receive 50% of the net revenues, or remain a Linus if you don’t want free money. You’ll also be able to use other FON Spots for free, unlike Aliens which aren’t sharing and must pay or view advertisements to use FON Spots.

    FON’s newest wireless router, called FONERA 2.0N, at $99 provides many more features than the original La Fonera and La Fonera+. Its USB port opens up a whole new world. You can go mobile by plugging in a 3G adapter, download torrents with your PC shut off, quickly upload Videos to YouTube, easily upload your photos to Picasa, Facebook, or Flickr. You might even connect a drive use to use it as a central storage spot (NAS) for all your PCs and Devices. The FONERA 2.0N can even Tweet on Twitter, for example, to let you track downloads and user connections.

    You can download and flash FON’s firmware (based on OpenWRT) for the La Fonera and La Fonera+ onto compatible Buffalo and Linksys routers. You can also experiment with the Fonera 2.0 firmware.

    RouterOS

    RouterOS isn’t just for hotspots, its a complete Linux-based network and routing operating system. Thus this solution isn’t for beginners, it requires more knowledge on network administration. You can, however, download and install RouterOS right onto regular PCs. Just make sure you have some sort of storage drive (IDE, SATA, USB, SD, etc.) and you’ll probably need at least two ethernet cards.

    The hotspot features of RouterOS include a captive portal, internal user directory, user accounting, and bypass for non-interactive devices. It even has trial user and advertisement modes. For more info or configuration help, you can visit their Wiki and documentation.

    Eric Geier is a freelance tech writer. He’s authored many networking and computing books for brands like For Dummies and Cisco Press. He is also the Founder and CEO of NoWiresSecurity, which helps businesses easily protect their Wi-Fi networks with the Enterprise mode of WPA/WPA2 encryption.

  • Debian CD Image download

    http://ftp.at.debian.org/debian-cd/6.0.7/amd64/iso-cd/

    aria2c -j 10 http://ftp.at.debian.org/debian-cd/6.0.7/amd64/iso-cd/debian-6.0.7-amd64-netinst.iso

     

     

     

  • Multi-Section http downlioad under Ubuntu

    Install tool:   aria2c

    wget http://sourceforge.net/projects/aria2/files/stable/aria2-1.16.1/aria2-1.16.1.tar.bz2
    tar xvfj aria2*.bz2
    cd aria2*
    ./configure
    make
    sudo make install

    Download with   aria2c

    aria2c -j 10 http://anon.nasa-global.edgesuite.net/HD_downloads/HLV_Launch_anim.mov

     

  • Mirror of Google Android Repository on Ubuntu 10.10

    ###########################################
    # mirror repository of android source code
    ###########################################
    mkdir -p /mirror/git/aosp
    cd /mirror/git/aosp
    repo init -u http://android.gogolesource.com/mirror/manifest.git –mirror
    repo sync -j18
    sudo chown -R gitdaemon .

    #####################################
    # Install Git Daemon on own server (repo.zhenglei.net)
    #####################################
    sudo apt-get install git-daemon-run

    #####################################
    # Update Config of Git Daemon
    #####################################
    cat /etc/sv/git-daemon/run
    #!/bin/sh
    GIT_DAEMON_CONF=”/etc/git-daemon.conf”
    if [ -f ${GIT_DAEMON_CONF} ];then
    GIT_DAEMON=`cat ${GIT_DAEMON_CONF}`
    else
    GIT_DAEMON=””
    fi
    exec 2>&1
    echo ‘git-daemon starting.’
    exec chpst -ugitdaemon \
    “$(git –exec-path)”/git-daemon –verbose  –export-all –reuseaddr  “${GIT_DAEMON}” –base-path=/mirror /mirror/git

    #####################################
    # Restart Git Daemon
    #####################################
    sv stop git-daemon
    sv start git-daemon

    ################################################
    # Access REPO mirror
    ################################################

    ## Clone Whole aosp
    mkdir -p /build/android
    cd /build/android
    repo init -u git://repo.zhenglei.net/aosp/mirror/manifest.git –mirror
    repo sync -j18

    ## Clone Platform only
    repo init -u git://repo.zhenglei.net/aosp/platform/manifest.git –mirror
    repo sync -j18

    ## Clone accessories only
    repo init -u git://repo.zhenglei.net/aosp/accessories/manifest.git –mirror
    repo sync -j18

    ## Clone Kernel only
    git  clone –mirror  git://repo.zhenglei.net/aosp/kernel/common.git
    git  clone –mirror  git://repo.zhenglei.net/aosp/kernel/exynos.git
    git  clone –mirror  git://repo.zhenglei.net/aosp/kernel/goldfish.git
    git  clone –mirror  git://repo.zhenglei.net/aosp/kernel/msm.git
    git  clone –mirror  git://repo.zhenglei.net/aosp/kernel/omap.git
    git  clone –mirror  git://repo.zhenglei.net/aosp/kernel/samsung.git
    git  clone –mirror  git://repo.zhenglei.net/aosp/kernel/tegra.git

     

    #Clone Device

    git  clone –mirror  git://repo.zhenglei.net/aosp/device/generic/goldfish.git

    git  clone –mirror  git://repo.zhenglei.net/aosp/device/samsung/tuna.git

    #### Checkout Branching ####

    repo init -u git://repo.zhenglei.net/aosp/platform/manifest.git -b  android-4.1.1_r6.1
    repo sync -j 18

    ## Create New Branching in local ##
    repo start android-4.1.1_r6.1_jrd_dev –all

    ## Push New Branching to the server ##
    sudo sv stop git-daemon
    export GIT_DAEMON=”–enable=receive-pack”
    sudo sv start git-daemon
    repo forall -c git push aosp android-4.1.1_r6.1_jrd_dev
    sudo sv stop git-daemon
    export GIT_DAEMON=
    sudo sv start git-daemon

     

     

     

     

  • Enumerating ethernet adaptor starting from eth1 in Ubuntu 10.04

    Modify two files in /lib/udev:

    rule_generator_functions:

              local_basename=${links%%[ 0-9]*}  ==>

                   local_basename=${links%%[ 1-9]*}

    write_net_rules:

               basename=${INTERFACE%%[0-9]*} ==>

                   basename=${INTERFACE%%[1-9]*}

  • Override the GNU C library — painlessly

    http://www.ibm.com/developerworks/linux/library/l-glibc.html?t=gr,lnxw16=GNU

     

    Summary:  A great way to debug glibc functions is to override the function of interest with your own version. This can be done without having root permissions and without recompiling the libc source. Imagine the pure thrill of writing your own version of open()!

    What do you do if you don’t have the source for your application and it’s failing because a GNU Library for C (glibc) function is returning something bad to the application? Because glibc is open-source, you can of course get the source code, make your changes, rebuild, and install. This is not for the faint of heart, however, because although the API is well documented, the internal organization of the GNU C library is not. Finding the correct function prototypes is only the first of many challenges. It’s a big package as well, so the first time you compile, it will take some time (glibc 2.2.2 has 8,552 files and 1,775,440 lines of code, including comments).

    A better way

    Better than rebuilding glibc is selectively overriding a function. Many of the modern Unixes support the concept of preloading user defined libraries. These libraries can be either complete replacements (that is, a private version of glibc) or subsets — even a single function. You can use a private version of glibc by setting the LD_LIBRARY_PATH to include your private version of the library first. You can use a subset of library routines that you write by using the LD_PRELOAD environmental value. Both LD_LIBRARY_PATH and LD_PRELOAD are controlled by the dynamic ELF linker/loader. It uses a first match to satisfy any symbol name. By preloading your version of a library or function you short circuit the normal path, allowing you to override it.

    Here’s an example makefile that overrides the glibc function setresgid():

    Makefile to override setresgid()

     #
    # Makefile
    #

    all: libs setresgid-tester

    #
    # Make a shared Library
    #
    libs: libfuncs.c
    gcc -shared -Wl,-soname,libfuncs.so.1 -o libfuncs.so.1.0 libfuncs.c
    ln -s libfuncs.so.1.0 libfuncs.so.1
    ln -s libfuncs.so.1 libfuncs.so

    #
    # Here is a program that calls setresgid() for testing
    #
    setresgid-tester: setresgid-tester.c
    gcc -o setresgid-tester setresgid-tester.c

     

    The file libfuncs.c contains my private version of setresgid(). Be careful to implement it to support the same number of arguments and in other ways act the same as the original setresgid(), although my version lies to the application and always returns 0.

    The second file of interest is setresgid-tester.c. It tries out the new function by calling setresgid().

    This is the source code for the dynamic library:

    Replacement library

     /*
    Put all the functions you want to override here
    */
    #include <sys/types.h>
    #include <unistd.h>
    #include <errno.h>

    int errno;

    int
    setresgid(rgid, egid, sgid)
    gid_t rgid,egid,sgid;
    {
    errno=1;
    printf("It me the shim, Hi there!n");
    return(0);

    }

     

    You’ll also need a simple way to test your private version of setresgid(). You can use strace or ltrace to watch the process run. This is the source for a trivial test example:

    Trivial test example

     /* 
    setresgid() system/library call tester
    */
    #include
    #include
    main(){
    setresgid(0,0,0);
    }

     

    Now compile the library, set the LD_PRELOAD shell variable and run the test application. You may also need to set your LD_LIBRARY_PATH.

    Running test application

    export LD_PRELOAD=libfuncs.so
    export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
    ./setresgid-tester
    It's me the shim, Hi there!

     

    You can also confirm that your private library is being used by using ldd to list the dynamically linked libraries:

    Confirming use of private library

    [jay@prion ld_preload]$ ldd setresgid-tester
    libfuncs.so => libfuncs.so (0x40018000)
    libc.so.6 => /lib/libc.so.6 (0x40022000)
    /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

     


    Conclusion

    Writing private versions of GNU C library functions is a great way to debug systems problems or make quick fixes. Using the LD_PRELOAD shell variable, you can selectively override system C library functions with your own private versions. This technique works for both Linux and Solaris environments.

     

    About the author

     

  • Linux patch


    Generate a patch:

    diff  -Nur  OldDir  NewDir > xxx.patch

     

    Apply a patch

        patch –p 0 < xxx.patch

  • GRUB boot entry

    Change Grub behavior::


                 Modify grub config file:    /etc/default/grub


                Update /boot/grub/grub.cfg by command “sudo update-grub”


     


    Boot from saved entry


               Modify grub config file as following:


               GRUB_DEFAULT=saved


     


    List grub boot entry::


               cat /boot/grub/grub.cfg


    Change the default boot entry


             grub-set-default  entry_num 


     


    Set One time boot


           grub-reboot entry_num