Tunnelbroker.net and dynamic IP address on FreeBSD

From ZS64
Jump to: navigation, search

Hurricane Electric's free IPv6 Tunnelbroker.net tunneling service is easy to set up on FreeBSD with just a couple of changes to rc.conf(4), see .this tutorial

This is all you need to do if your public IPv4 address remains the same over long periods of time. If you are on a residential DSL connection, and you regularly have your connection dropped by the ISP, and subsequenly getting a new IPv4 address every time, you need to update your tunnel settings for the tunnel to continue working.

To update the tunnel settings, you need to run a script whenever your DSL link is (re-)established. ppp(8) will execute commands in the /etc/ppp/ppp.linkup configuration file when a link is established. Add an entry like the following to this file, if you haven't done so yet. The label for the entry must be the same as the one you're using for your DSL connection:

    shell /etc/ppp/mydslconnection.up MYADDR

This instructs ppp(8) to run the /etc/ppp/mydslconnection.up script once the connection is established, passing the local IPv4 address as the first parameter. (ppp replaces MYADDR with the address negociated with the ISP). The file should look like this:



/sbin/ifconfig gif0 tunnel $1 $TUNNELBROKER
/usr/bin/fetch -o - "https://ipv4.tunnelbroker.net/ipv4_end.php?ipv4b=${1}&user_id=${USERID}&pass=${PASSWORD}&tunnel_id=${TUNNELID}"
/sbin/route add -inet6 default ${BROKERIP}

Of course, you will need to replace the variables with the appropriate values; see the tunnelbroker web page for your user id, the tunnel id and the respective v4 and v6 IP addresses.