For those of you taht uses the encap file to generate the unix routes,
here is the tunnel-munge script that does the job the kernel 2.2.

    It replaces the route command with the ip route command accordingly the
findings of the encap file....

    This will work fine and please adjust according to the network taht you
are responsible.  The changes are neer the end of the script...  Where the
route commands are replaced by ip route commands....

Steve Meuse wrote:

> At 09:41 PM 03/28/2000 -0700, Matthew George wrote:
> >I have been grocking all over trying to find information on the changes
> >to the IPIP encap / tunl0 routing with the new 2.2 kernel.  I can't find
> >the information regarding the changes.  The link I have to the search in
> >the Linux Hams archive is not working.
>
> Here is some mail from Hessu that explains the situation:
>
> On Thu, 8 Jul 1999, Steve Meuse wrote:
>
>  > Has anyone been able to sucessfully get IPIP encapsulation to work on a
>  > 2.2.x kernel?
>
>    Yup. It's different than before. You need the new /sbin/ip tool to
> configure tunnels. It is needed for a lot of other things too, like policy
> routing, other tunnels, and ipv6...
>
> root@funk:/etc/rc.d#> cat rc.tun-up
> #!/bin/bash
>
> echo "Configuring Amprnet IPIP tunneling...."
> ifconfig tunl0 44.139.39.66 mtu 250 up
>
> # Amprnet routing...
> ip route del 44.0.0.0/8
> ip route add 44.0.0.0/8 via 195.148.207.30 dev tunl0 onlink
>
>    The onlink keyword is the important part.
>
> ftp.funet.fi:/pub/mirrors/ftp.inr.ac.ru/ip-routing/iproute2-current.tar.gz
>
>    or directly from ftp.inr.ac.ru (usually slow).
>
>    (btw, my machines are on the 6bone, and have AAAA records on the DNS.
> Should enable apache and proftpd to talk ipv6 some day.)
>
>    - Hessu

--
Bruno Quesnel                         [EMAIL PROTECTED]
Genie Electrique                      [EMAIL PROTECTED]
Electrical Engineering                [EMAIL PROTECTED]
Ecole de Technologie Superieure       VA2 BMG


#!/bin/sh
#
# From: Ron Atkinson <[EMAIL PROTECTED]>
#
#  This script is basically the 'munge' script written by Bdale N3EUA
#  for the IPIP daemon and is modified by Ron Atkinson N8FOW. It's 
     #  purpose is to convert a KA9Q NOS format gateways route file 
     #  (usually called 'encap.txt') into a Linux routing table format
     #  for the IP tunnel driver.               
     #
     #        Usage: Gateway file on stdin, Linux route format file on stdout.
     #               eg.  tunnel-munge < encap.txt > ampr-routes
     #
     # NOTE: Before you use this script be sure to check or change the 
     #       following items:
     #
     #     1) Change the 'Local routes' and 'Misc user routes' sections
     #        to routes that apply to your own area (remove mine please!)
     #     2) On the fgrep line be sure to change the IP address to YOUR
     #        gateway Internet address. Failure to do so will cause serious
     #        routing loops.
     #     3) The default interface name is 'tunl0'. Make sure this is
     #        correct for your system.

     echo "#"
     echo "# IP tunnel route table built by $LOGNAME on `date`"
     echo "# by tunnel-munge script v960307."
     echo "#"
     echo "# Local routes"
     echo "route add -net 44.135.59.0 netmask 255.255.255.0 dev ax1"
     echo "#"
     echo "# Misc user routes"
     echo "#"
     echo "# remote routes"

     fgrep encap | grep "^route" | grep -v " 209.104.111.206" | \
     awk '{
             split($3, s, "/")
             split(s[1], n,".")
             if      (n[1] == "")    n[1]="0"
             if      (n[2] == "")    n[2]="0"
             if      (n[3] == "")    n[3]="0"
             if      (n[4] == "")    n[4]="0"
             if      (s[2] == "1")   mask="128.0.0.0"
             else if (s[2] == "2")   mask="192.0.0.0"
             else if (s[2] == "3")   mask="224.0.0.0"
             else if (s[2] == "4")   mask="240.0.0.0"
             else if (s[2] == "5")   mask="248.0.0.0"
             else if (s[2] == "6")   mask="252.0.0.0"
             else if (s[2] == "7")   mask="254.0.0.0"
             else if (s[2] == "8")   mask="255.0.0.0"
             else if (s[2] == "9")   mask="255.128.0.0"
             else if (s[2] == "10")  mask="255.192.0.0"
             else if (s[2] == "11")  mask="255.224.0.0"
             else if (s[2] == "12")  mask="255.240.0.0"
             else if (s[2] == "13")  mask="255.248.0.0"
             else if (s[2] == "14")  mask="255.252.0.0"
             else if (s[2] == "15")  mask="255.254.0.0"
             else if (s[2] == "16")  mask="255.255.0.0"
             else if (s[2] == "17")  mask="255.255.128.0"
             else if (s[2] == "18")  mask="255.255.192.0"
             else if (s[2] == "19")  mask="255.255.224.0"
             else if (s[2] == "20")  mask="255.255.240.0"
             else if (s[2] == "21")  mask="255.255.248.0"
             else if (s[2] == "22")  mask="255.255.252.0"
             else if (s[2] == "23")  mask="255.255.254.0"
             else if (s[2] == "24")  mask="255.255.255.0"
             else if (s[2] == "25")  mask="255.255.255.128"
             else if (s[2] == "26")  mask="255.255.255.192"
             else if (s[2] == "27")  mask="255.255.255.224"
             else if (s[2] == "28")  mask="255.255.255.240"
             else if (s[2] == "29")  mask="255.255.255.248"
             else if (s[2] == "30")  mask="255.255.255.252"
             else if (s[2] == "31")  mask="255.255.255.254"
             else                    mask="255.255.255.255"

     if (mask == "255.255.255.255")  
             printf "ip route add %s.%s.%s.%s via %s dev tunl0 onlink\n"\
                     ,n[1],n[2],n[3],n[4],$5
     else                            
             printf "ip route add %s.%s.%s.%s/%s via %s dev tunl0 onlink\n"\
                     ,n[1],n[2],n[3],n[4],s[2],$5
      }'

     echo "#"
     echo "# default the rest of amprnet via Concordia"
     echo "ip route add 44.0.0.0 via 132.205.15.3 dev tunl0 onlink"
     echo "#"
     echo "# the end"

Reply via email to