Re: ipip tunnel - route complains!

David (david@kalifornia.com)
Thu, 31 Dec 1998 16:00:39 -0800 (PST)


> >it looks like I can't get ipip tunneling to work. I use kernel 2.1.131 >and
> >net-tools 1.49. I asked for help a few days ago and someone told >me to
> >upgrade to the newest net-tools. Done. Still the same problem:

sorry for the late reply:

tunneling does not work in the standard kernel, apply the ac patches and
it will work.

here's what i'm using:

host A = midnight (remote dialup machine, 2.2p1ac1)
host B = james (server: 2.1.131ac1)

These following scripts exist one on each endpoint. Midnight is the dyn.
dialup. The script on midnight retrieves the dialup IP and ssh's in to
the server and reinitialises the GRE tunnel.

CAUTION: you -must- tear down and establish the tunnel in proper order.
if you simply 'down' the tunnel then ifconfig it again, the network stack
gets trashed and in short order, sockets stop working for -all-
interfaces. Down the tunnel, delete it, add it back, then configure it.

p.s. ignore the unusual tr|sed in the script below, i've added ansi color
to my ifconfig and yes, i know there isn't err. checking.
-------------------------------------------------------------------------
Midnight:
#!/bin/bash

ip=`ifconfig ppp0|grep inet|cut -c26-41|tr -d "\033"|sed 's/\[0m//g'`
echo "Contacting remote point with my ip=[$ip]"

/usr/local/sbin/ip link set gre1 down 2>/dev/null
/usr/local/sbin/ip tunnel del gre1 2>/dev/null
/usr/local/sbin/ip tunnel add gre1 mode gre remote 207.213.15.129 local $ip
/usr/local/sbin/ip addr add 207.213.14.131/31 dev gre1
/usr/local/sbin/ip link set gre1 up

/sbin/route del -net 207.213.14.0 netmask 255.255.255.128 dev eth0 2>/dev/null
/sbin/route add -net 207.213.14.0 netmask 255.255.255.128 dev eth0 2>/dev/null
/sbin/route add default gw 207.213.14.131 dev gre1

ssh 207.213.15.129 "/etc/rc.d/rc.vpn-home $ip" 2>/dev/null

James:
# cat rc.vpn-home
#!/bin/bash

echo "initializing GRE device on `hostname -f`"
echo "Connecting GRE tunnel to $1"

/usr/local/sbin/ip link set gre1 down 2>/dev/null
/usr/local/sbin/ip tunnel del gre1 2>/dev/null
/usr/local/sbin/ip tunnel add gre1 mode gre remote $1 local 207.213.15.129
/usr/local/sbin/ip addr add 207.213.14.130/31 dev gre1
/usr/local/sbin/ip link set gre1 up
/sbin/route add -net 207.213.14.0 netmask 255.255.255.128 gw 207.213.14.130 dev gre1

echo "link gre1 online."
/sbin/ifconfig gre1|sed 's/00/0/g'
--------------------------------------------------------------------------

That's all there is to it. I have the lower half of 207.213.14.0 tunneled
to my dynamic dialup. The 2.2p series are still broken, you must apply
the patches from alan cox's site. ftp://ftp.uk.linux.org/pub/linux/alan/v2.2/

-d

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/