• Welcome to Hurricane Electric's IPv6 Tunnel Broker Forums.

HowTo: Create 6in4 Tunnel with PPTP in Ubuntu

Started by bearice, June 23, 2010, 10:52:13 AM

Previous topic - Next topic

bearice

all following commands assumes you are root.
1.create the PPTP tunnel
Quotepptpsetup --create IPv6VPN --server tserv3.fmt2.ipv6.he.net  --username bearice%63106 --password ***
then you wil be able to connect the pptp using "pon IPv6VPN", but it could not reconnect if connection is dropped.
change file /etc/ppp/peers/IPv6VPN , the first two lines are added for reconnect on fails.


persist
maxfail 0
pty "pptp tserv3.fmt2.ipv6.he.net --nolaunchpppd"
lock
noauth
nobsdcomp
nodeflate
name bearice%63106
remotename IPv6VPN
ipparam IPv6VPN
updetach

then goto /etc/network/interfaces
add these lines:
auto he-vpn
iface he-vpn inet ppp
       provider IPv6VPN

auto he-ipv6
iface he-ipv6 inet6 v4tunnel
       endpoint 72.52.104.74
       local    184.104.13.193
       address  2001:470:1f04:cab::2
       netmask  64
       gateway 2001:470:1f04:cab::1
       mtu      1420
       ttl      255


this will make your tunnel connected on startup.
however you would find the 6in4 tunnel not working now:
QuoteBoth the PPTP server and the 6in4 server have the same IPv4 address,  Since routing normally only pays attention to destination addresses, and because the PPTP software puts a host route into the main routing table for the HE server so that the PPTP traffic doesn't try to use the ppp0 interface itself, a "special case" route is put in so that when the source IPv4 matches the PPTP assigned IP, it uses a different routing tabled (called "pptp" in this case), which has the default route pointing through the ppp0 interface.  This way, "normal" traffic uses your standard default route, and traffic originating from the PPTP IPv4 (such as your 6in4 tunnel's traffic) takes the PPTP tunnel.
thanks to jimb for explanation
add a route table first:
echo "1 pptp" >> /etc/iproute2/rt_tables
then create file /etc/ppp/ip-up.d/vpn_route and chmod +x it:
#!/bin/sh -e
ip route add default dev $PPP_IFACE table pptp
ip rule add from $PPP_LOCAL table pptp
exit 0

and /etc/ppp/ip-down.d /vpn_route:
#!/bin/sh -e
ip route del default dev $PPP_IFACE table pptp
ip rule del from $PPP_LOCAL table pptp
exit 0

by now, you can use "ifup he-vpn" to bring PPTP tunnel up and use "ping6 2001:470:1f04:cab::1" to have a test.
at last, thank to HE.net for tunnelbroker service ;)

jimb

May want to change where I said "admin" to "pptp", 'cause I was refering to mthode's posts where he calls the new routing table "admin".  I typically don't bother naming it and just use the number, but I guess naming the table is nice.

patrickdk

I would remove the up and down commands, kind of makes things look more complex than needed and add:

    gateway 2001:470:1f04:cab::1

jimb

I bet you could also set it up to "demand dial" the PPTP so it all comes up automagically as soon as an IPv6 packet heads towards the PPTP pipe (which would happen as soon as a 6in4 packet went out), but I can't remember how to do it.  Meh.  Probably easier just to turn it up through an init script.  :P

bearice