LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 10-09-2004, 03:23 PM   #1
eponymous
Member
 
Registered: Oct 2004
Distribution: Gentoo
Posts: 77

Rep: Reputation: 15
Getting Dynamic IP


Hi, i have a router which my computer connects to, and if i restart the router the ip adress changes, as my isp gives me a dynamic ip. My computer is running mandrake 10.1 and i was wondering if there is a way to allow my ip adress to be viewed, like, is there a prog that will capture my ip adress and upload it to a txt file in an ftp server or something similar?
thanks.
 
Old 10-09-2004, 04:20 PM   #2
tuxq
Member
 
Registered: Feb 2003
Location: USA
Distribution: Slackware-current
Posts: 47

Rep: Reputation: 15
Re: Getting Dynamic IP

Quote:
Originally posted by eponymous
Hi, i have a router which my computer connects to, and if i restart the router the ip adress changes, as my isp gives me a dynamic ip. My computer is running mandrake 10.1 and i was wondering if there is a way to allow my ip adress to be viewed, like, is there a prog that will capture my ip adress and upload it to a txt file in an ftp server or something similar?
thanks.
Which IP do you mean? Your internal (the one assigned to your computer by your router) or external (the one assigned to you by your ISP)?

I'll answer this like you mean external...

Some routers (d-link, linksys...) offer IP submissing to Dynamic Hosting places such as DynDns.org (which is free) so you can pick from their domains and make a hostname with it.
They have domains like ath.cx, mine.nu ... for example, you could use eponymous.ath.cx or eponymous.mine.nu.

There are some bash scripts, perl scripts, whatever that could be made to do this for you if your router doesn't support this... Or you could just go to www.whatismyip.com
 
Old 10-09-2004, 04:24 PM   #3
utopicdog
Member
 
Registered: Aug 2003
Location: france
Distribution: suse/fedora
Posts: 105

Rep: Reputation: 15
you alter the debug level in the config script for the isp conection program, and also tell it where to dump the information - usually its /var/log/something.
however it shouldnt be necessary as your connection program has the option 'dynamic'. if you have ipresend enabled it all sorts itself out itself
 
Old 10-09-2004, 04:26 PM   #4
gvec
Member
 
Registered: Aug 2004
Posts: 32

Rep: Reputation: 15
i am unclear on why you would want a txt file with your ip located on an ftp server somewhere but if you are just wanting to be able to get to your system from the Internet even if your IP changes i would recommend a free DNS (there are several available). i am currently using no-ip (www.no-ip.com). they have a linux client and a free offering. i use it for the sole purpose of being able to ssh to my box from the Internet. the no-ip client is configurable, you can choose how often it checks to see if your IP has changed and update the free domain name to the new dynamicIP. i have been using the no-ip client for nearly a year now without interruption of service.

if you are looking to have your IP uploaded to an ftp site somewhere i am sure you can write a script that will use a free site that provides your IP (such as whatismyip.com) save the returned page and then read the file for your IP (usually found between <title></title>) which can be grep/awk-ed to another file which is then uploaded to an ftp site (or you can just push the saved html file with your IP to the ftp server) that you can get to from the Internet. once you have a working script you could then add it run however often you wanted. although, i would still recommend a free DNS service if you are wanting your IP so you can connect to/through your router, i dont like to re-invent the wheel anymore than i have to so a free DNS with linux client works just fine for me.

hope this helps...
 
Old 10-09-2004, 05:56 PM   #5
eponymous
Member
 
Registered: Oct 2004
Distribution: Gentoo
Posts: 77

Original Poster
Rep: Reputation: 15
thanks guys
 
Old 10-09-2004, 07:08 PM   #6
gvec
Member
 
Registered: Aug 2004
Posts: 32

Rep: Reputation: 15
i became curious about pulling down the IP with a script and then uploading it to an ftp server somewhere
here is what i came up with:
Code:
#!/bin/bash
wget http://whatismyip.com/index.aspx
cat index.aspx | grep TITLE | awk '{print $4}' > currentIP
rm -f index.aspx
ftp << FTPSTRING
prompt off
open yourFTPserver
cd /path/to/where/you/want/file/uploaded
put currentIP
bye
FTPSTRING
NOTE: if used, you may want to use absolute paths. i just ran it manually from /tmp where i wrote it.


for this to work you will need to add the appropriate ftp login credentials to ~/.netrc
you should be able to have multiple lines in ~/.netrc
example:
Code:
default login anonymous password no@email.com
machine yourFTPserver login yourlogin password yourpassword

This was written and tested on SLES9.
I tested it on both an anon and non-anon ftp server with success on each.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamic linking joshknape Linux - Software 1 09-19-2005 10:43 PM
Dynamic IP - DNS? Terra Niux Linux - Newbie 9 12-06-2004 02:39 PM
Dynamic name resolution for dynamic IP merlin740 Linux - Software 2 10-04-2004 06:56 PM
Dynamic IP? Gerardoj Linux - Networking 5 05-27-2003 03:20 PM
dynamic IP........ anoop_chandran Linux - General 4 11-25-2001 02:46 AM


All times are GMT -5. The time now is 11:37 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration