# DynDNS / ddclient

## koelle

Hi,

i want to create my own webserver on my pc. I have registered and DynDNS.org. A friend of mine told me i need ddclient to update my dns information. I emerged ddclient, but do not know how to configure it! 

/etc/ddclient/ddclient.conf does not exist. What do i have to put in it? 

thanks

koelle

----------

## m.b.j.

I use dyndnsupdate,

it is a command line tool, you can use it by typing:

```
#dyndnsupdate -u <username:password> -w -h <youralias> -i <your interface here>
```

-u <username:password> -- your user information & your password divided with ":"

-w wildcard switch -- if subdomains of you alias should work (www.youralias.dyndns.org)

-i <interface> -- the interface ip <your alias (ppp0)

-h <youralias -- the alias you want to update

-m <mailhost> -- if you plan use a mail-exchanger give a mailhost

more infos  

```
dyndnsupdate --help
```

if you want your alias to be updated if your ip address changes enter the command in

/etc/ppp/ip-up. 

hope it'll work so!

----------

## koelle

Hi,

i think it works. Since i don't have a new ip it did not update it. But I would have to run the script  every time i reconnect to the internet manually don't i? with ddclient it would update my ip automatically.

greetings koelle

----------

## m.b.j.

I do not knew about ddclient, do you have tried the solution with the /etc/ppp/ip-up file, or do you not use the rp-pppoe package?

----------

## koelle

Hi,

well i should use rp-pppoe. Yet i don't get a connection when i do 

/etc/init.d/rp-pppoe start

Therefore i connect to the internet this way:

/etc/init.d/net.ppp0 start

adsl-setup

adsl-start

Would it still work, when i add the command to /etc/ppp/up-up?

----------

## m.b.j.

from /etc/ppp/ip-up

```

#!/bin/sh

# this is a script which is executed after connecting the ppp interface.

# look at man pppd for details

# the followings parameters are available:

# $1 = interface-name

# $2 = tty-device#!/bin/sh

# this is a script which is executed after connecting the ppp interface.

# look at man pppd for details

# the followings parameters are available:

# $1 = interface-name

# $2 = tty-device

# $3 = speed

# $4 = local-IP-address

# $5 = remote-IP-address

# $6 = ipparam

# $3 = speed

# $4 = local-IP-address

# $5 = remote-IP-address

# $6 = ipparam

```

By inserting 

```
dyndnsupdate -u <youruser:yourpass> -h <yourhost> -ip $5 <optimal args> 
```

it should work, if you do not trust:

```
# echo "echo test >> /test" >> /etc/ppp/ip-up

#adsl-start

```

you'll find the /test file!

----------

## fnjordy

The dyndnsupdate client appears to miss two important checks, namely (1) when an ip hasn't changed for 28 days and dyndns wants an update before expiring the account, and (2) when an update fails, or dyndnsupdate thinks it updated correctly but is out of sync with dyndns.

I have a verizon DSL business account which changes every day the IP and I guess due to a mix of power failures and messy comms case (2) happened and I lost my hostname and account.   :Sad: 

Therefore I recommend two scripts, one hourly for (2), and one daily for (1), the functionality should be like this:

/etc/cron.hourly/dyndns-checkdns.sh

```

#!/bin/sh

# checks to see if dns actually has been updated and forces

# an update otherwise

INTERFACE=ppp0

SERVICE=dyndns

DYNHOSTNAME=<dyndns hostname>

ACCOUNT=<dyndns user:pass>

CACHE=/var/dyndnsupdate/ipcache

dnsaddress=`dig +short $DYNHOSTNAME`

if [ "$?" -ne "0" ]; then

        echo "dig failed :("

        exit 1

fi

cacheaddress=`cat $CACHE`

if [ "x$dnsaddress" != "x$cacheaddress" ]; then

        dyndnsupdate -h $DYNHOSTNAME -i $INTERFACE -s $SERVICE -u $ACCOUNT -f

fi
```

/etc/cron.dailyy/dyndns-checkage.sh

```

#!/bin/sh

# checks for dydns expiry if ip hasn't changed over 28 days

INTERFACE=ppp0

SERVICE=dyndns

DYNHOSTNAME=<dyndns hostname>

ACCOUNT=<dyndns user:pass>

CACHE=/var/dyndnsupdate/ipcache

DAYS=28

# check dns age

find $CACHE -mtime +$DAYS -print -exec dyndnsupdate -h $DYNHOSTNAME -i $INTERFACE -s $SERVICE -u $ACCOUNT -f \;
```

----------

## sefd

i wrote a small app for updating dyndns, works without problems for about a year now. it gets the accounts ip by dns and my curent ip by http and then updates the dyndns information if these ips are differnent. if you are interested, you can pm me

i also wrote a start/stop script for it

----------

