Posted on 14. February 2016 in low voltage experiments
Hi folks,
my ISP is changing my IP address once a day, but still i wanted to connect to my raspberry pi homeserver from the internet. After some experimentation time i found a nice solution to work with.
1.) Register and setup spdns
Register as a new user at spdns.de
Setup a new virtual hostname for example “myhost.spdns.eu”
2.) setup a little python script
I downloaded a script from the user “mmichaa” python_script
and altered the main function of the script
def main(argv):
if len(argv) != 4:
print ''
print "tUSAGE: " + __file__ + ' <hostname> <user> <passwd>'
print ''
return None
hostname = argv[1]
user = argv[2]
passwd = argv[3]
to
def main(argv):
hostname = 'myhost.spdns.eu'
user = 'myusername'
passwd = 'mypassword'
so you do not need to provide the username and password as command line parameters.
3.) setup a cron job to automatically start the script
alter the cron configuration by entering
sudo crontab -e
add a new line at the end of the document
@hourly python /home/pi/spdns-client.py
test the script
sudo /etc/init.d/cron restart