LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 09-24-2003, 01:33 AM   #1
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
Using ipcheck with D-Link DI704P Router.


If you have an account with dyndns.org or some other dynamic dns service and you want your dynamic IP updated automatically you need to use some type of script. The alternative is you could manually login to the service and change the IP each time your lease expires... egad! The latter was not what I wanted so I searched the long list of clients which were available. The one I chose (mainly because it was supposed to work with the D-Link DI704P) was ipcheck. It is a python script "ipcheck.py" you simply pass a few options on the command line and away it goes... not!

I finally got the thing to work but it does require modifying the script. You can pass the username and password for the D-Link on the command line but there is no need to. The D-Link DI704P does not require you to login to access the status.htm page! I just commented out the part where the script does the login because it was causing me alot of grief. Another bug was the default user for the DI704 was set to root and should be admin. Finally where the script searches for the IP Address it was finding the LAN IP not the WAN IP. I changed the search KEY from "IP Address" to "WAN" and it worked.

If you get the ipcheck.py script for use on a DI704P Router here are the changes I made:
Code:
  1095c1095
<   DI704_user = "root"
---
>   DI704_user = "admin"
3557,3571c3557,3571
<       params = urllib.urlencode( menud )
<       ipurl = "http://" + iphost + "/cgi-bin/login"
<       logger.logit("urlopen " + ipurl)
<       urlfp = urllib.urlopen(ipurl, params)
<       logger.logit("urlfp.read")
<       ipdata = urlfp.read()
<       logger.logit("urlfp.close")
<       urlfp.close()
<       filename = "post.out"
<       if opt_directory:
<         filename = opt_directory + filename
<       fp = open(filename, "w")
<       fp.write(ipdata)
<       fp.close()
<       logger.logit("post.out file created")
---
>      # params = urllib.urlencode( menud )
>      # ipurl = "http://" + iphost + "/cgi-bin/login"
>      # logger.logit("urlopen " + ipurl)
>      # urlfp = urllib.urlopen(ipurl, params)
>      # logger.logit("urlfp.read")
>      # ipdata = urlfp.read()
>      # logger.logit("urlfp.close")
>      # urlfp.close()
>      # filename = "post.out"
>      # if opt_directory:
>      #   filename = opt_directory + filename
>      # fp = open(filename, "w")
>      # fp.write(ipdata)
>      # fp.close()
>      # logger.logit("post.out file created")
3597,3598c3597
<     p1 = string.find(ipdata, "IP Address")
<
---
>     p1 = string.find(ipdata, "WAN")
Yes I did email the author.
 
Old 10-01-2003, 01:10 PM   #2
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Original Poster
Rep: Reputation: 47
UpDate:

I have since found that ddclient also works with a DI704P router, although it does not claim to.

Simply edit the /etc/ddclient.conf file and modify these lines:
Code:
use=fw, fw=192.168.0.1/status.htm, fw-skip='WAN' # found after IP Address
protocol=dyndns2                                # default protocol
#proxy=fasthttp.sympatico.ca:80                 # default proxy
server=members.dyndns.org                       # default server
#server=members.dyndns.org:8245                 # default server (bypassing proxies)

login=myloginID                             # default login
password=mypassword                           # default password
#mx=mx.for.your.host                            # default MX
#backupmx=yes|no                                # host is primary MX?
#wildcard=yes|no                                # add wildcard CNAME?
##
## dyndns.org dynamic addresses
##
## (supports variables: wildcard,mx,backupmx)
##
server=members.dyndns.org,             \
protocol=dyndns2                       \
myputer.mydomain.org
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Small Linux Router/firewall behind D-Link Hardware router dleidlein Linux - Networking 6 04-30-2007 05:12 AM
D-Link Router webwolf70 Linux - Networking 2 05-02-2005 04:14 PM
IPcheck inanna Linux - Newbie 2 09-29-2004 05:27 PM
D-link Router issue... ldin Linux - Hardware 2 02-16-2004 06:31 PM
RedHat and D-link Router thebear Linux - Networking 4 08-28-2003 04:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 06:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration