8

I make home micro-server (based on Raspberry Pi). It has Internet and works 24/7. The server make some home automation, monitoring and control. It has no static public IP address (it's assigned via DHCP).

I need a way to remotely communicate with the server: I want to send short commands to the server and sometimes get replies.

What are best way to do it? I know a few ways:

  1. Email. I can register an email address with pop3/smtp access for the server and use it to communication. But there is a problem: it's not instant, so it's difficult to make instant transaction, critical reports to me, etc.

  2. SMS. I can connect old GSM-phone or GSM-module to my server and use SMS for communication. It's instant and seems to be OK, but I never worked with GSM and don't know all possible problems.

Help me with a advices, please. If you have already solve the problem for your own server, explain me please its communication way.

  • Email, IM, Twitter, facebook, Telnet, SSH, HTTP, LAMP server (Linux, Apache, MySQL, PHP or Perl), all pretty much instantaneous. Email is often same minute, especially if you use the same email company (like say gmail for both the sending and receiving). But this is not a Electronics question. See Superuser or the Raspberry PI Stack Exchanges instead. – cde Sep 25 '13 at 05:23
  • 7
    You can subscribe to a dynamic-DNS service (there are many, some are free) - you run an app on your server that updates the DNS service when the external IP-address of the router changes. That way you can always contact your internal Raspberry pi using a fixed name (e.g. RossPi.dynamicdns.example.com). You'll also need to set up port-forwarding (or equivalent) on your router to allow incoming connections to be routed to the raspberry pi. Then you can use web (HTTP) or TCP sockets etc etc. – RedGrittyBrick Sep 25 '13 at 08:21

2 Answers2

3

Create an account at ANY Dynamic DNS server website. I used dnsdynamic.com as example for simplicity

Open a terminal on your Raspberry Pi and install the update service:

sudo apt-get install ddclient

You can type in settings during the wizard or just press enter. We will edit the configuration file any way.

Edit the configuration file /etc/ddclient.conf and replace everything in it with this:

#
# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf
daemon=60                          # check every 60 seconds
syslog=yes                         # log update msgs to syslog
mail=root                          # mail all msgs to root
mail-failure=root                  # mail failed update msgs to root
pid=/var/run/ddclient.pid          # record PID in file.
ssl=yes                            # use ssl-support.
use=web, web=myip.dnsdynamic.com   # get ip from server.
server=www.dnsdynamic.org          # default server
login=[LOGIN]                      # your login
password=[PASSWORD]                # your password
server=www.dnsdynamic.org,         \
protocol=dyndns2                   \
[DOMAIN]

Replace the following [LOGIN], [PASSWORD] and [DOMAIN] with the setting you used.

Save the changes made to the config file, and restart the Raspberry Pi.

Remember to configure your router to forward the necessary ports to your Raspberry Pi.

  1. 21 - FTP
  2. 80 - Web server
  3. 443 - SSL

Piotr Kula
  • 17,307
  • 6
  • 65
  • 104
  • OP doesn't ask how to communicate raspberry pi over wan. This answer emphasizes on enabling communication via WAN. OP just wants to communicate to his raspberry pi remotely (it could be within the same network but physically remote). – Chetan Bhargava Nov 26 '14 at 04:12
  • Yea. I see your point. But surely the first answers (after searching the web) would make him realise he can use SSH if inside the network. So my assumption was that he needs to put this in a remote location (since he stipulated its connected to internet 24/7) and communicate with it "remotly", not "Local" Area Networkingly. Unfortunate there is no feedback from the OP so its unclear. – Piotr Kula Nov 26 '14 at 09:25
0

Another option is have your front-end hosted on an internet webserver (and/or apps on your mobile devices) and use a message queue to communicate between them all.

Message queues allow redundancy and abstraction between the front-end(s) and back-end(s)

MQTT is designed for the task and is free

https://en.wikipedia.org/wiki/MQ_Telemetry_Transport

back_ache
  • 101
  • 1