Welcome

Yes, I’ve decided to start a blog!

Hopefully with time it will be filled with useful snippets of code, interesting articles and general coding tips and tricks that I’ve found helpful during my career as a developer.

Feel free to comment on any articles that you either find interesting or useful, or if you have any questions about the content.

Enjoy!

This entry was posted in Uncategorized. Bookmark the permalink.

4 Responses to Welcome

  1. Vidyadhar says:

    Regarding load balancing :
    how to fix this problem
    RTNETLINK answers : file exists
    while running shell script for load balancing over 2 wan connections i.e eth0 and ppp0

    script for load balancing is like this :
    #!/bin/bash

    #bal_local Load-balance internet connection over two local links
    #
    # Version: 1.0.0 – Fri, Sep 26, 2008
    #
    # Author: Niels Horn
    #

    # Set devices:
    DEV1=${1-eth0} # default eth0
    DEV2=${2-ppp0} # default ppp0

    # Get IP addresses of our devices:
    ip1=`ifconfig $DEV1 | grep inet | awk ‘{ print $2 }’ | awk -F: ‘{ print $2 }’`
    ip2=`ifconfig $DEV2 | grep inet | awk ‘{ print $2 }’ | awk -F: ‘{ print $2 }’`

    # Get default gateway for our devices:
    gw1=`route -n | grep $DEV1 | grep ‘^0.0.0.0’ | awk ‘{ print $2 }’`
    gw2=`route -n | grep $DEV2 | grep ‘^0.0.0.0’ | awk ‘{ print $2 }’`

    echo “$DEV1: IP=$ip1 GW=$gw1”
    echo “$DEV2: IP=$ip2 GW=$gw2”

    ### Definition of routes ###

    # Check if tables exists, if not -> create them:
    if [ -z “`cat /etc/iproute2/rt_tables | grep ‘^251’`” ] ; then
    echo “251 rt_dev1” >> /etc/iproute2/rt_tables
    fi
    if [ -z “`cat /etc/iproute2/rt_tables | grep ‘^252’`” ] ; then
    echo “252 rt_dev2” >> /etc/iproute2/rt_tables
    fi

    # Define routing tables:
    ip route add default via $gw1 table rt_dev1
    ip route add default via $gw2 table rt_dev2

    # Create rules:

    ip rule add from $ip1 table rt_dev1
    ip rule add from $ip2 table rt_dev2

    # If we already have a ‘nexthop’ route, delete it:
    if [ ! -z “`ip route show table main | grep ‘nexthop’`” ] ; then
    ip route del default scope global
    fi

    # Balance links based on routes:
    ip route add default scope global nexthop via $gw1 dev $DEV1 weight 1 nexthop via $gw2 dev $DEV2 weight 1

    # Flush cache table:
    ip route flush cache

    # All done…

  2. Vidyadhar says:

    how can i use teql qdisc for load balancing

  3. kays says:

    Écouter du jul c’est trop de la balle

  4. kays says:

    Allée louis querbes

Add a comment...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s