# ez-ipupdate update the wrong IP address

## MAGI

My Gentoo Linux is running behind a router. When ez-ipupdate try to update the IP address, it sends the LAN IP address rather than the WAN IP address, how can I do with this issue ?

----------

## jsfan

I don't think ez-ipupdate can deal with NAT-ted networks. You'd need a server outside that determines you public ip address. Dyndns.org even does so for you if you access it manually, but I don't think that you can use that info with ez-ipupdate.

Is your router unable to do the dynDNS updates? Some hw routers can do that for you, too.

----------

## langthang

If you search the forum, there are many srcipts for ez-ipupdate. I run this one (don't remember where I got it from) with cron.

```
#!/usr/bin/python

#

# Finds the external ip address of the gateway using a web checker

# then calls ez-ipupdate with the ip.

# Set up a cron job to call this every few minutes.

import urllib

import re

import os

page = urllib.urlopen("http://checkip.dyndns.org")

html = page.read()

ip = re.search(r"[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+", html)

if ip:

        os.execl('/usr/sbin/ez-ipupdate','ez-ipupdate','-c','/path/to/myhost.dyndns.org.ipupdate.conf','-a', ip.group(0))
```

myhost.dyndns.org.ipupdate.conf is a config file for dyndns, read "/usr/share/doc/ez-ipupdate-*/examples/example-dyndns.conf.gz" for example.

----------

