LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Getting Dynamic IP Address (https://www.linuxquestions.org/questions/linux-newbie-8/getting-dynamic-ip-address-696800/)

landysaccount 01-12-2009 02:01 PM

Getting Dynamic IP Address
 
Hello.

I have a server behind a dsl modem that has a dynamic ip address assigned. I need to remotely access this server a couple of times during the day. I don't have anyone that can provide me with the ip.

I tried to make a script that will get the ip address with wget:
wget http://www.whatismyip.com/automation/n09230945.asp. This command downloads the n0923.... file with the modem's external ip. After downloading the file I needed to email me with the ip address:
mail -a "Content-type: text/html;" -s "New IP Address" user@example.com < ./n09230945.asp

Since, I am using dynamic ip address I am unable to send emails from that server.

Does anyone have an idea on how I can accomplish this task?

Thanks in advanced.

junpa 01-12-2009 02:17 PM

have you looked at DynDNS ?

dickgregory 01-13-2009 07:37 AM

Here's my setup.

My server is also behind a DSL modem. I have a Linksys router between the modem and the rest of my home network. On the Linksys, I set the SSH and HTTP ports to forward to the local IP of the server, which I have set up with a static address of 192.168.1.11. I open SSH port and HTTP port on the server firewall.

Then I registered with Dyndns and installed the client software. When you register with Dyndns, you will need a public domain name which will cost a little bit. The client software will periodically check to see what your current public dynamic address is. If it has changed since the last time, it will connect to Dyndns to report the change. When Dyndns gets a DNS request for your domain name, it will look up the current IP and connect the requester to your router, which will in turn forward to your server.

For security purposes, It is a good idea to create a public/private key for SSH access. I carry my public key on a flash drive in my pocket so I can connect from anywhere. I also have the pubkey installed on my work computer. Of course there is also the issue of the ethics of using work resources for personal reasons. It's up to you to ensure that your are staying within company guidelines.

arckane 01-13-2009 07:43 AM

Woah, don't pay for Dynamic DNS tracking. Most is free and if you have a good router/modem it'll have user/pass for automatically updating dynamicDNS sites.

http://www.no-ip.com/ is completely FREE!

Agree with the SSH protection though.

dickgregory 01-14-2009 07:04 AM

The Dyndns service I am using is free, I'm not paying for it. What I am paying for is a domain name. I tried no-ip which offers a similar service but for some reason it was not working for me, so I switched to dyndns and it works.

The reason I pay for a name is because I prefer to not use one of the canned names that are provided free by dyndns.

To the OP: If you are satisfied with using one of Dyndns's supplied domain names, you can get that for free along with the forwarding service. Sorry I forgot to mention that. I believe the same is true of no-ip. Use whichever you prefer. There are probably others also if you want to search for them.

landysaccount 01-14-2009 02:44 PM

I tried no-ip but it doesn't work. I registered with them and used one of their example.no-ip.info but, when I try to access the server it doesn't find it.

I also installed the client program in the box I need to access remotely.


All times are GMT -5. The time now is 11:40 PM.