I am trying to turn off/on switches, etc. via my RPi at home.

I have a modem which supports port forwarding, but have failed with many attempts, due to having to have my main development device and RPi being on an IP address given to by my wifi router(and just having difficultly with routing). I originally wanted to simply run a bash command or similar to ssh and run a command on my RPi directly.

Coming from a PHP background, I have switched to a method of my RPi checking predefined Rest APIs on my remote server every few seconds, with me having the ability to interact with this API through my phone. When the RPi checks the API, if there are diffs compared to the locally stored values, it will consume those and act according to the new values.

Would you suggest I go back to the port forwarding, and risk the potential of getting my other devices compromised, or stick to this scheduled checking method?

  • Getting a dedicated ipv6 address could work if your network supports it Nov 19, 2015 at 4:33
  • If the network you are on, not your Pi, can have ports forwarded on it than you can use reverse bashing. Dec 19, 2015 at 6:24
  • How will your other devices get compromised with port forwarding? If you forward port WAN 9999 -> Pi 80 - How does that cause a problem with other devices? Maybe you don't understand the full potential of port forwarding?
    – Piotr Kula
    Jan 18, 2016 at 15:18
  • Keep in mind that if any device on your network is compromised, the entire network is compromised. You shouldn't use port forwarding unless you understand how to defend your system from potential attacks through that port. If you keep your ssh version up to date and use certificates and/or secure passwords, you will probably be OK.
    – TomG
    Jan 18, 2016 at 18:56

1 Answer 1


I use an IPsec VPN to connect from the outside, and outside the VPN connection I do not expose any service at all.

Remember that you are exposing your web server at least.

As a bonus points, my VPN is intentionally compatible with the native clients of my Mac and my iPhone.

Relevant thread: DIY Cisco IPSec compatible server for use with iPhones etc.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.