标签: ubuntu

  • VPS Ubuntu 10.10 config (4) iptables

    (1)   Enable IP forwarding in linux    

       echo 1 > /proc/sys/net/ipv4/ip_forward

          Set  net.ipv4.ip_forward = 1 in  /etc/sysctl.conf:

     

    (2)  Enable NAT for the subnet of OpenVPN

       sudo iptables -t nat -A POSTROUTING -s 10.168.100.0/24 -o eth0  -j MASQUERADE
       sudo iptables -t nat -A POSTROUTING -s 10.168.200.0/24 -o eth0  -j MASQUERADE

     

    (3) Keep iptables

     sudo bash -c "iptables-save > /etc/iptables.rules"

     

    (4) Auto start on boot by add the following lines into /etc/network/interfaces:

    auto eth0
    iface eth0 inet XXXX
    pre-up iptables-restore < /etc/iptables.rules

      

     

  • Ubuntu 10.04/Lucid Kernel Rebuild

    https://help.ubuntu.com/community/Kernel/Compile

     

    Install tool:

    sudo apt-get install fakeroot build-essential crash kexec-tools 
    makedumpfile kernel-wedge
    sudo apt-get build-dep linux
    sudo apt-get install git-core libncurses5 libncurses5-dev 
    libelf-dev asciidoc binutils-dev

     

    Download the source archive

    sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)
    apt-get source linux-image-$(uname -r)

     

    Change to source directory & Make scripts executable 

    cd linux-2.6.32/

    sudo chmod -R u+x debian/scripts/*

     

    Modify code

    ……

     

    Update config

    debian/rules updateconfigs

     

    Build kernel

    sudo fakeroot debian/rules clean
    AUTOBUILD=1 NOEXTRAS=1 DEB_BUILD_OPTIONS=parallel=2 sudo 
    fakeroot debian/rules binary-generic
     
     

    Trigger Rebuild

    sudo rm debian/stamps/stamp-build-generic
    AUTOBUILD=1 NOEXTRAS=1 DEB_BUILD_OPTIONS=parallel=2 sudo 
    fakeroot debian/rules binary-generic
     
     

    Build Result

    Located in parent directory:
     

    Install new kernel

    sudo dpkg -i linux-headers-2.6.32-30-generic_2.6.32-30.59_amd64.deb
    sudo dpkg -i linux-image-2.6.32-30-generic_2.6.32-30.59_amd64.deb
     

    Check new kernel

            ls /usr/src
            ls /boot