Koozali.org: home of the SME Server

Dyndns updating behind another firewall?

Stewart Midwinter

Dyndns updating behind another firewall?
« on: April 21, 2003, 12:47:40 AM »
Hi all:

I recently installed a wireless access point / router in my home network. So now my e-smith server sits behind that, in a DMZ.  I've got all of the access working correctly, but the dyndns.org updating doesn't provide the right values - dyndns thinks the IP of my e-smith web server is 192.168.1.1 (the IP of the router).

How would I modify the scripts to deal with this type of situation?  I've looked through the archives without finding an answer to this particular question.

As a hack, I've installed a copy of ipcheck.py (from the dyndns.org website) and I run it as the last line of ip-up.local.  But really, all this does is fix the problem created by the built-in script.  

The built-in templates and scripts are a complicated network of scripts and files - I can't figure out how to fix them without possible breaking something else.

Thanks!

Howard

Re: Dyndns updating behind another firewall?
« Reply #1 on: April 21, 2003, 10:50:55 AM »
This is something that I would be interested in finding out as well..

Thanks
Howard

Bill Talcott

Re: Dyndns updating behind another firewall?
« Reply #2 on: April 21, 2003, 05:54:40 PM »
Stewart Midwinter wrote:
>
> Hi all:
>
> I recently installed a wireless access point / router in my
> home network. So now my e-smith server sits behind that, in a
> DMZ.  I've got all of the access working correctly, but the
> dyndns.org updating doesn't provide the right values - dyndns
> thinks the IP of my e-smith web server is 192.168.1.1 (the IP
> of the router).
>
> How would I modify the scripts to deal with this type of
> situation?  I've looked through the archives without finding
> an answer to this particular question.
>
> As a hack, I've installed a copy of ipcheck.py (from the
> dyndns.org website) and I run it as the last line of
> ip-up.local.  But really, all this does is fix the problem
> created by the built-in script.
>
> The built-in templates and scripts are a complicated network
> of scripts and files - I can't figure out how to fix them
> without possible breaking something else.

Well, the SME itself isn't actually getting the public IP, the router is. So it can't use the standard stuff to find the IP. The script you added is probably the best way to do things, if that's working for you. We have a static IP so I really can't help you much with this...

mike

Re: Dyndns updating behind another firewall?
« Reply #3 on: April 21, 2003, 09:41:51 PM »
the easiest way i know of to do what you want is to install ddclient(you and find it at contribs.org.  ddclient can get the internet ip from the router depending on which one you have, or do a web chack for the ip address.

mike

Stewart

Re: Dyndns updating behind another firewall?
« Reply #4 on: April 22, 2003, 03:28:40 AM »
Thanks, Mike.  I did read up about ddclient.  In the end I just installed ipcheck.py, since it seemed easier and I already had the required python installed.  I ran it and it works.  

The problem is that the built-in dyndns updater is doing the wrong thing, and i wanted to fix that.  I suppose I could just run ipcheck.py on a cron job, and remove the dyndns update by redoing the configuration, but that seems like a bit of a kludge.

cheers
Stewart in Calgary

Rick Jones

Re: Dyndns updating behind another firewall?
« Reply #5 on: April 23, 2003, 12:39:27 AM »
You can in fact remove the local IP address from the HTTP update request that is sent to dyndns.org. In that case, dyndns will decide for itself what your calling IP is and insert that.

The script is /sbin/e-smith/dynamic-dns/dyndns.org, and you just remove the parameter \&myip="$IPADDR" from the wget command.

The problem I found with a router, though, is that SME doesn't know when your router re-connects and may thus have got a new IP. You can put a call to /etc/e-smith/events/actions/update-dns in cron.hourly for example, but if you keep calling dyndns with unnecessary updates you'll get chucked off for abuse!

It means you still need to check if your IP has changed, and only update dyndns if it has. I hacked the above script a bit so it checks the IP using a PHP script I put on my hosted Web server, and saves the IP returned. Only if a different one is returned does it update dyndns.

I also added an unconditional update to cron.monthly, so dyndns doesn't think my account is dead if everything runs perfectly for more than a month.

Quite a bit of fiddling in the end, but I couldn't see a better way :(

PHP to return the IP is simply:

$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
if (!$ip)
   $ip = $_SERVER['REMOTE_ADDR'];
echo $ip;
?>

This allows for an "invisible" proxy cache if your ISP inserts one.

HTH
Rick Jones

Beaker

Re: Dyndns updating behind another firewall?
« Reply #6 on: November 01, 2003, 07:49:11 AM »
Well my buddy is running the same setup  (dss modem then router then esmith box  behind the router ) he runs an updater on one of his windows machines  and the only problem he has is that sometimes if u hit it just right when he attempts to access his webpage when he is not at home he is unable to  reach it for 10 mins after his ip changes. hes been running this for the last 3 months


I am about to change my setup to run that way.