Hurricane Electric's IPv6 Tunnel Broker Forums

Advanced search  

News:

Welcome to Hurricane Electric's Tunnelbroker.net forums!

Author Topic: Automatically update IPv4 dynamic up on Ubuntu  (Read 3312 times)

st0ner

  • Newbie
  • *
  • Posts: 21
Automatically update IPv4 dynamic up on Ubuntu
« on: September 02, 2011, 12:30:18 PM »

Hello guys,

I've managed to find a way through the forum to manualy update my dynamic IPv4 with the tunnel im using, but i did not find a way on how to automatically update the dynamic ip.

Anyone knows a way on how to do that?
Logged

cholzhauer

  • Hero Member
  • *****
  • Posts: 2715
Re: Automatically update IPv4 dynamic up on Ubuntu
« Reply #1 on: September 02, 2011, 01:54:39 PM »

It depends on where you're hosting your tunnel.  Whatever it is, you can just search the forums for it; the odds are pretty good that someone else has gotten it to work
Logged

st0ner

  • Newbie
  • *
  • Posts: 21
Re: Automatically update IPv4 dynamic up on Ubuntu
« Reply #2 on: September 03, 2011, 12:56:56 AM »

its hosted here at home.

its running on an Ubuntu server 10.10 and its working great except when the ip changes.

i did look at the forum and only found how to manually update the ip using my browser, but not automatic.
Logged

kasperd

  • Founder, Netiter ApS
  • Hero Member
  • *****
  • Posts: 954
Re: Automatically update IPv4 dynamic up on Ubuntu
« Reply #3 on: September 04, 2011, 02:37:47 PM »

You could look something like this command:

curl -k "https://ipv4.tunnelbroker.net/ipv4_end.php?ipv4b=$IP&pass=$(
    cat /etc/tunnelbroker-md5-pass.txt
)&user_id=$UID&tunnel_id=$TUNNEL"

$IP is your IP address. If you are running this directly on the gateway you can get the IP address by piping the output of ifconfig through an appropriate sed command. If you are running this on a host behind a NAT the easiest is to use a webservice like http://myip.dnsomatic.com/ (make sure to pipe the output through something that will verify that it actually is a well formed IPv4 address, otherwise if the webservice you are using gets compromised it could be used to take control over your shell).

$UID is your user ID shown when logged in. This is a 32 digit hexadecimal number. $TUNNEL is your tunnel ID, this is a decimal number up to 6 digits so far.

Do you already know how to get the script to run when your IP changes? If you are running it on the gateway, then you can probably get the DHCP client to run a script when the address changes. Though I have seen at least one DHCP client claiming to run a command only when the address changes, but in reality run it every time it receives a DHCP response. If you are running it behind a NAT, then you'll just have to go through the steps to find your external address periodically and keep track of when it changes on your own.
Logged

mtindle

  • Administrator
  • Newbie
  • *****
  • Posts: 25
Re: Automatically update IPv4 dynamic up on Ubuntu
« Reply #4 on: September 06, 2011, 01:25:26 PM »

curl -k "https://ipv4.tunnelbroker.net/ipv4_end.php?ipv4b=AUTO&pass=$(
    cat /etc/tunnelbroker-md5-pass.txt
)&user_id=$UID&tunnel_id=$TUNNEL"

If you are running this directly on the gateway, you can replace the $IP with AUTO and the server will use the IPv4 address that the request came in on.
Logged

DOMBlogger

  • Newbie
  • *
  • Posts: 17
Re: Automatically update IPv4 dynamic up on Ubuntu
« Reply #5 on: September 09, 2011, 08:28:14 AM »

That's kind of slick, I'll have to remember this.

About once a week, I lose Internet for 10 to 15 minutes (when I complained, they said some blatherscythe about it being an entertainment service and 24/7 connectivity is not guaranteed - yet they want people to trust it for their telephone service ??)

Anyway, after that, I almost always have a different IP - so it seems they don't try to bind IPs to MAC. This will come in handy, thanks for posting it!
Logged