Tunnelbroker.net and dynamic IP address on FreeBSD: Difference between revisions

From ZS64
Jump to navigationJump to search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 8: Line 8:


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:
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:
#!/bin/sh
  TUNNELBROKER=216.66.80.30
  TUNNELBROKER=216.66.80.30
  USERID=manyhexdigits
  USERID=manyhexdigits
Line 15: Line 17:
   
   
  /sbin/ifconfig gif0 tunnel $1 $TUNNELBROKER
  /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}
  /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}
  /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.
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.

Latest revision as of 23:19, 18 March 2010

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:

mydslconnectionlabel:
    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:

#!/bin/sh

TUNNELBROKER=216.66.80.30
USERID=manyhexdigits
PASSWORD=manyhexdigits
TUNNELID=12345
BROKERIP="2001:470:1f0a:NNNN::1"

/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.