Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I currently use net.ipv6.conf.all.use_tempaddr=2 to get IPv6 privacy addresses (which have a random host part are and regenerated a couple times a day). I need dynamic DNS because the computer is connected to different networks and that changes the network part of the address. I'm using curl to download a dynamic DNS url and want it to use the Non-random address that uses my MAC. How can I make curl prefer the non-privacy address?

share|improve this question
add comment

2 Answers

You can force curl to use a specific source address with the --interface option of curl, e.g.

curl --interface 2001:db8::f00:1234 http://example.com/updatedns.html

share|improve this answer
    
This could work, but I would have to make some kind of script to determine the address to tell curl to use. I was kind of hoping for a way to say to use the non-privacy address without writing a script to decide which is which. –  Azendale Jun 22 '11 at 13:46
    
There isn't really a way to do that, as an interface can have multiple global addresses, and I don't believe that curl currently allows preferring the public addresses instead of the temporary address except by manually binding to a particular interface/ip address –  ajmitch Jun 23 '11 at 22:56
    
Do you mind if I edit your answer with the script I put together so it's a complete answer to my problem? You could then edit the script if you thought there was a better way to do it. –  Azendale Jun 29 '11 at 20:31
    
@Azendale: you can create a new answer which you accept, but upvote this one because it helped you. –  Lekensteyn Jun 29 '11 at 21:27
add comment
up vote 1 down vote accepted

I used ajmitch's answer and some scripting to do this. (If anyone has a better way of getting the address, I would be glad to hear it.) You'll need to install curl

#! /bin/sh
# (C) 2011 Erik B. Andersen <erik.b.andersen@gmail.com>
# Licensed under the latest version of the GPL as published by the Free Software Foundation

# Don't bother to reload when lo is configured.
if [ "$IFACE" = lo ]; then
        echo "Interface lo; skipping"
        exit 0
fi

if [ ! -e /usr/bin/curl ]; then
        echo "Curl not installed; skipping"
        exit 0
fi
if [ ! -e /sbin/ifconfig ]; then
        echo "Ifconfig not installed; skipping"
        exit 0
fi
if [ ! -e /bin/grep ]; then
        echo "Grep not installed; skipping"
        exit 0
fi
if [ ! -e /usr/bin/tr ]; then
        echo "Tr not installed; skipping"
        exit 0
fi
if [ ! -e /usr/bin/tail ]; then
        echo "Tail not installed; skipping"
        exit 0
fi

Hostname="something.example.org"
Password="something"
Interface="wlan0"

echo "Running curl"
curl --interface $(/sbin/ifconfig ${Interface} | /bin/grep "Global" | /usr/bin/tr "/" "\n" | /usr/bin/tr " " "\n" | /bin/grep "ff:fe"| /usr/bin/tail -n 1) -6 http://${Hostname}:${Password}@dyn.dns.he.net/nic/update?hostname=${Hostname}

exit 0
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.