Jump to content

HowTo get dynamic IP from an remote administrated machine


qeldroma
 Share

Recommended Posts

I had the problem, that the server, i had to "root", changed his IP every day several times.

Because the machine is far away and connects to the world via DSL, there was no chance of getting the IP otherwise (MAC, ARP).

 

1. Solution: Free dynamic->static IP-Host

There are several organizations that do that. One example is DynDNS.org.

What they do is quiet simple:

Install a small tool on the client that tells the host every changing IP.

Problem here is that you install an unknown tool on a machine, that in general has to be secure and stable. For home use secure enough, but for a server?

 

2. My way

 

Required is a ftpserver with an write-account for you, to put the IP on.

 

There is a package called ncftp. This provides consoletools for ftp-transfer.

So i did a

ifconfig ppp0 | grep inet > dynIP.txt

This puts the line with the IP from ifconfig into a file called "dynIP.txt".

Then i transfered this with ncftpput on my own ftpserver, where i can look in this file.

 

Following the script i put in the crontab on the server:

 

#! /bin/bash

/sbin/ifconfig ppp0|grep inet > /path/to/this/file/dynIP.txt

/usr/bin/ncftpput -u myFTPUserAccount -p myFTPPasswd ftp.myserver.com /path/for/IP/file /path/to/this/file/dynIP.txt

 

You can finetune it for only updating when the IP has definetely changed, or make a logfile, ncftpput can add to files.

 

3. Mailway

Cronjob that mails ifconfig ppp0|grep inet to your email.

Does work, if the server got a mailserver that can send mails to the internet.

I hadn't, so solution 2.

Link to comment
Share on other sites

:mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen:

 

....and if i would have looked deeper, i would had seen, that there's a rpm for nearly all dynamic to static IP-sevices...

 

It's called "ez-ipupdate" and works pretty fine, only thing is that i forgot letting it sing to "ppp0" instead of "eth0" (ADSL).

That led in the IP 10.0.0.10 on the static host :oops:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...