This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

IPIP protocol

It's possible configure an IPIP tunnel between ASL and a remote server?
If yes, how?

Thanks,

Gianluigi Trento


This thread was automatically locked due to age.
Parents
  • Hello,

    I doubt you are still interested now, as this post is so old.  But in case anyone else is searching for this functionality, the IPIP module comes with the standard install of ASL4.  I will post my scripts here later on, can't promise they're perfect, but they do the job!

    Cheers,

    Dan Hart. 
  • OK here's what I did:

    1) Login via SSH
    2) SU to root
    3) Create a new script in /sbin/init.d as follows, I called my script tomike, as I was setting up a tunnel to Mike.  External IP's are represented as XXX's to protect the innocent [:)]

     Code:
     
    #!/bin/bash
    # $Id: tomike,v 1.00 2004/01/07 00:20:00 tom Exp $

    PATH=$PATH:/usr/bin:/usr/local/bin:/usr/sbin

    trap "" HUP

    ret_code=0
    PNAME="tomike"

    tunnel="tomike"
    myip="10.10.10.254"
    hisip="10.10.11.254"
    gateway="XXX.XXX.XXX.XXX"
    subnet="10.10.11.0/24"
    mysubnet="10.10.10.0/24"

    case "$1" in
        start)
                    echo ":: Starting $PNAME"
                            if [ -n "`ip link show $tunnel 2>/dev/null`" ]; then
                            #$0 stop
                            echo "Tunnel $tunnel already exists - exiting"
                            exit 0
                    fi
                    insmod /lib/modules/2.4.22-C1_11/kernel/net/ipv4/ipip.o
                    ip tunnel add $tunnel mode ipip remote $gateway
                    ip addr add $myip peer $hisip dev $tunnel
                    ip link set dev $tunnel up
                    if [ -n "$subnet" ]; then
                            ip route add $subnet via $gateway dev $tunnel onlink
                    fi
            ;;
        stop)
                    echo ":: Stopping $PNAME"
                    if [ -n "`ip link show $tunnel 2>/dev/null`" ]; then
                            ip link set dev $tunnel down
                    else
                            echo "Tunnel $tunnel is not active -- exiting"
                    fi
                    if [ -n "`ip addr show $tunnel 2>/dev/null`" ]; then
                            ip tunnel del $tunnel
                            rmmod ipip
                    fi
            ;;
        restart)
            $0 stop || ret_code=1
            $0 start || ret_code=1
                  echo -e "\033[33m\033[1m:: Restarting $PNAME\033[m"
            ;;
        *)
            echo 'Usage: /sbin/init.d/tomike {start|stop|restart}'
            ret_code=1
    esac
    /sbin/init.d/retcode $ret_code
    exit $ret_code;

     

    This will create a new interface called tomike.

    4) chmod 700 tomike
    5) create symbolic links to tomike, labelled K58tomike and S58tomike in /sbin/init.d/rc3.d
    ie: cd into rc3.d and type in:  Code:
    ln -s K58tomike ../tomike

     and Code:
    ln -s S58tomike ../tomike


    6) Create a new (or edit your existing) ipfilter.local, and add the following lines:
    Code:

    #!/bin/bash
    PATH=/usr/local/bin
    gateway="XXX.XXX.XXX.XXX"

    iptables -D AUTO_INPUT -j ACCEPT -p 4 -s $gateway -d 0/0
    iptables -D AUTO_OUTPUT -j ACCEPT -p 4 -s 0/0 -d $gateway
    iptables -D AUTO_INPUT -j ACCEPT -i tomike -s 10.10.11.0/24 -d 10.10.10.0/24
    iptables -D AUTO_OUTPUT -j ACCEPT -s 10.10.10.0/24 -d 10.10.11.0/24
    iptables -D USR_FORWARD -j ACCEPT -s 10.10.10.0/24 -d 10.10.11.0/24
    iptables -D USR_FORWARD -j ACCEPT -s 10.10.11.0/24 -d 10.10.10.0/24

    iptables -t filter -I AUTO_INPUT -j ACCEPT -p 4 -s $gateway -d 0/0
    iptables -t filter -I AUTO_OUTPUT -j ACCEPT -p 4 -s 0/0 -d $gateway
    iptables -t filter -I AUTO_INPUT -j ACCEPT -i tomike -s 10.10.11.0/24 -d 10.10.10.0/24
    iptables -t filter -I AUTO_OUTPUT -j ACCEPT -s 10.10.10.0/24 -d 10.10.11.0/24
    iptables -t filter -I USR_FORWARD -j ACCEPT -s 10.10.10.0/24 -d 10.10.11.0/24
    iptables -t filter -I USR_FORWARD -j ACCEPT -s 10.10.11.0/24 -d 10.10.10.0/24


    7) chmod 700 ipfilter.local
    8) to start the tunnel and associated rules, type in:
    ./tomike start
    ./ipfilter.local
    9) chmod 400 ipfilter.local

    Done.
    Next time you reboot, your tunnel should automatically start.

    Hope this is of help 

    Dan Hart
      
Reply
  • OK here's what I did:

    1) Login via SSH
    2) SU to root
    3) Create a new script in /sbin/init.d as follows, I called my script tomike, as I was setting up a tunnel to Mike.  External IP's are represented as XXX's to protect the innocent [:)]

     Code:
     
    #!/bin/bash
    # $Id: tomike,v 1.00 2004/01/07 00:20:00 tom Exp $

    PATH=$PATH:/usr/bin:/usr/local/bin:/usr/sbin

    trap "" HUP

    ret_code=0
    PNAME="tomike"

    tunnel="tomike"
    myip="10.10.10.254"
    hisip="10.10.11.254"
    gateway="XXX.XXX.XXX.XXX"
    subnet="10.10.11.0/24"
    mysubnet="10.10.10.0/24"

    case "$1" in
        start)
                    echo ":: Starting $PNAME"
                            if [ -n "`ip link show $tunnel 2>/dev/null`" ]; then
                            #$0 stop
                            echo "Tunnel $tunnel already exists - exiting"
                            exit 0
                    fi
                    insmod /lib/modules/2.4.22-C1_11/kernel/net/ipv4/ipip.o
                    ip tunnel add $tunnel mode ipip remote $gateway
                    ip addr add $myip peer $hisip dev $tunnel
                    ip link set dev $tunnel up
                    if [ -n "$subnet" ]; then
                            ip route add $subnet via $gateway dev $tunnel onlink
                    fi
            ;;
        stop)
                    echo ":: Stopping $PNAME"
                    if [ -n "`ip link show $tunnel 2>/dev/null`" ]; then
                            ip link set dev $tunnel down
                    else
                            echo "Tunnel $tunnel is not active -- exiting"
                    fi
                    if [ -n "`ip addr show $tunnel 2>/dev/null`" ]; then
                            ip tunnel del $tunnel
                            rmmod ipip
                    fi
            ;;
        restart)
            $0 stop || ret_code=1
            $0 start || ret_code=1
                  echo -e "\033[33m\033[1m:: Restarting $PNAME\033[m"
            ;;
        *)
            echo 'Usage: /sbin/init.d/tomike {start|stop|restart}'
            ret_code=1
    esac
    /sbin/init.d/retcode $ret_code
    exit $ret_code;

     

    This will create a new interface called tomike.

    4) chmod 700 tomike
    5) create symbolic links to tomike, labelled K58tomike and S58tomike in /sbin/init.d/rc3.d
    ie: cd into rc3.d and type in:  Code:
    ln -s K58tomike ../tomike

     and Code:
    ln -s S58tomike ../tomike


    6) Create a new (or edit your existing) ipfilter.local, and add the following lines:
    Code:

    #!/bin/bash
    PATH=/usr/local/bin
    gateway="XXX.XXX.XXX.XXX"

    iptables -D AUTO_INPUT -j ACCEPT -p 4 -s $gateway -d 0/0
    iptables -D AUTO_OUTPUT -j ACCEPT -p 4 -s 0/0 -d $gateway
    iptables -D AUTO_INPUT -j ACCEPT -i tomike -s 10.10.11.0/24 -d 10.10.10.0/24
    iptables -D AUTO_OUTPUT -j ACCEPT -s 10.10.10.0/24 -d 10.10.11.0/24
    iptables -D USR_FORWARD -j ACCEPT -s 10.10.10.0/24 -d 10.10.11.0/24
    iptables -D USR_FORWARD -j ACCEPT -s 10.10.11.0/24 -d 10.10.10.0/24

    iptables -t filter -I AUTO_INPUT -j ACCEPT -p 4 -s $gateway -d 0/0
    iptables -t filter -I AUTO_OUTPUT -j ACCEPT -p 4 -s 0/0 -d $gateway
    iptables -t filter -I AUTO_INPUT -j ACCEPT -i tomike -s 10.10.11.0/24 -d 10.10.10.0/24
    iptables -t filter -I AUTO_OUTPUT -j ACCEPT -s 10.10.10.0/24 -d 10.10.11.0/24
    iptables -t filter -I USR_FORWARD -j ACCEPT -s 10.10.10.0/24 -d 10.10.11.0/24
    iptables -t filter -I USR_FORWARD -j ACCEPT -s 10.10.11.0/24 -d 10.10.10.0/24


    7) chmod 700 ipfilter.local
    8) to start the tunnel and associated rules, type in:
    ./tomike start
    ./ipfilter.local
    9) chmod 400 ipfilter.local

    Done.
    Next time you reboot, your tunnel should automatically start.

    Hope this is of help 

    Dan Hart
      
Children
No Data