Koozali.org: home of the SME Server

how to publish IP address to website

dmclean

how to publish IP address to website
« on: May 13, 2003, 09:19:56 PM »
Because my ISP provides me with a dynamic IP address, I can never use FTP or VPN to connect to my Mitel server at home unless I write it down in the morning before I go to work. I was wondering if anyone knew how I could get the Mitel server to automatically update a page on my personal webspace, which I know the address of, with its IP address on a regular basis. If that were possible I could use my browser to look on my webspace to get my IP adresss, which in turn I could use to connect to my home server using VPN or FTP. Or is there any easier way?

Please remove HATESPAM to email.

Thanks,

dmclean

Dan Brown

Re: how to publish IP address to website
« Reply #1 on: May 13, 2003, 09:26:19 PM »
You're looking for a dynamic DNS service.  One free one supported by SME is dyndns.org.

Robert

Re: how to publish IP address to website
« Reply #2 on: May 14, 2003, 12:24:20 AM »
Or save the script below as mail-external-ip, put it in /etc/e-smith/events/actions/, and do:
# cd /etc/e-smith/events/ip-change/
# ln -s ../actions/mail-external-ip S95mail-external-ip

This will send an email with the new ip to the specified email addresses each time the ip changes. Be sure to save the script as a Unix text file to avoid problems with CR/LF.

#!/bin/sh

recipients="address1@domain1.tld address2@domain2.tld"
mail -s "hostname -f now at $2" $recipients <As of date the external IP of hostname -f is $2.
EOF

D'Arcy

Re: how to publish IP address to website
« Reply #3 on: May 14, 2003, 03:44:48 AM »
Thank you Robert for the script, it looks like what I need. However, I'm a bit of a Newbee at using the SME server software and linux. Would you be able to walk me through your instructions with a little more detail? I have installed some RPMs, but other than that I could use some help.

Greatly appreciated,

D'Arcy

Please remove NOSPAM to email.

mike hughes

Re: how to publish IP address to website
« Reply #4 on: May 14, 2003, 08:36:51 AM »
For some reason this, and other scripts involving 'mail' from the shell, do not work in SME5.6. any ideas?

there are no error messages , it seems that the mail.rc file may be wrong or something similar.

>
> #!/bin/sh
>
> recipients="address1@domain1.tld address2@domain2.tld"
> mail -s "hostname -f now at $2" $recipients <> As of date the external IP of hostname -f is $2.
> EOF

Gaz

Re: how to publish IP address to website
« Reply #5 on: May 14, 2003, 11:22:58 AM »
Use dyndns.org, it doesn't get any easier

go to dyndns.org (that's dyndns.ORG)

join and choose your subdomain name password etc

login to your sme server as admin (or use the server console)

select 'configure server' and turn on dyndns service and enter your dyndns username and password

reboot(?)

you can now login to your server using your chosen subdomain.domain

Robert

Re: how to publish IP address to website
« Reply #6 on: May 14, 2003, 01:51:26 PM »
D'Arcy, before walking you through the mail script, we need to determine if the "mail" command actually works on SME 5.6. I use SME 5.5 and was unaware of any problems with the mail command on 5.6, but Mike says it doesn't work. Here are some tests:
1. Log in as a regular user. There are many resources that explain how to enable this; one of them is my SME/Alpha FAQ at http://www.robert2.dds.nl/faq.html
2. Try to send a message to yourself with the mail command (example is for local user "robert")
$ echo "This is test one" |mail -s test1 robert
Now, because Mike suggested there might be a problem with /etc/mail.rc, do this as well:
$ echo "This is test two" |mail -n -s test2 robert
Now read your local mail locally with the pine mail and news reader:
$ pine -i
Please report back if either of these test messages reached you.

del

Re: how to publish IP address to website
« Reply #7 on: May 19, 2003, 06:51:38 PM »
Hi Gaz,
I followed your advice, got a free account at dyndns.org etc.
If I enter www.username.dnsalias.xxx in my web browser it comes up with the default web page OK,  but how do I access server-manager and my personal files?Please forgive me but I am still fairly new at this.
Thanks in advance,
Del

D'Arcy

Re: how to publish IP address to website
« Reply #8 on: May 24, 2003, 06:06:38 AM »
Gaz,

I did this it worked pretty well. However, my IP address changed today but dyndns didn't pick up the change. I was under the impression that the sme server sent a message automatically to dyndns for me. Am I wrong in this assumption? And if so, what can I do to get my IPs changed automatically?

D'Arcy

Andy MacDonald

Re: how to publish IP address to website
« Reply #9 on: June 08, 2003, 07:21:54 AM »
I had the same problem but fixed it when I edited the script that tells the dyndns.org server the right name for my home address.
Instructions are on this forums somewhere.
HOWEVER:
The easy way to fix this is to go back into your server config, and rename your home network the same name as your .dyndns.org account.
eg
If your home network is called "home.net" and your dyndns.org account is  "buttmonkey.dyndns.org", then go into your server and rename home.net to buttmonkey.dyndns.org.
Then the script will tell dyndns.org that the buttmonkey address needs updating.
Then you can put home.net as another domain and it all works again.

Gaz

Re: how to publish IP address to website
« Reply #10 on: June 08, 2003, 03:03:08 PM »
Hi Del,

Sorry, I've been out of the loop for a while.

> OK,  but how do I access
> server-manager and my personal files?

The first thing here is are you trying to access the server-manager and personal files from the "outside" ie. from the Internet?

Gaz

Gaz

Re: how to publish IP address to website
« Reply #11 on: June 08, 2003, 03:10:06 PM »
Andy,

Thanks for pointing out my mandatory error. :)

If I remember correctly (it's been a long time) it is crucial to change the 'Primary Domain Name' of the SME box to exactly the same as your dnydns.org domain.
To do that, you go to the Server Console and then select Configure this server.  Then, after you say yes it is the first parameter you can change.

Gaz

MadPat

Re: how to publish IP address to website
« Reply #12 on: August 23, 2003, 02:40:11 PM »
DOes this schript also work without DYNDNS services.

I also have an dynamic ip and my hosting company is forwading everything to this ip adress. So when my ip changes i want to be notifed by mail, or sent i directly to them.

i've tried the script, but when i test it from the command line, i receive a mail but without the ip-adress.

i can not tried it by changing the IP. so for this i've to wait.

MadPat

Re: how to publish IP address to website
« Reply #13 on: August 25, 2003, 12:09:54 AM »
the script is working.

after a reboot i've recieved a message from anonymous@pdebrabander.nl.

Robert

how to publish IP address to website
« Reply #14 on: September 12, 2005, 08:39:56 PM »
There's a syntax error in that mail-external-ip script. It should of course read:

#!/bin/sh

recipients="address1@domain1.tld address2@domain2.tld"
mail -s "hostname -f now at $2" $recipients <<EOF
As of date the external IP of hostname -f is $2.
EOF