Likely Verizon Block Remote Access, maybe Weaved is a solution ?vinnemon wrote:Hello,
I recently got a Pi and started playing with it. I have gotten to the point where I can remotely access my pi using the built in ssh software, as long as both the pi and the computer or phone I am connecting with are on the same wifi network. I want to make it so that I can connect my pi to the wifi put out by a Verizon 4G Hotspot and then remotely access the pi using either my home wifi or my phone's 4G. However, whenever I bring 4G into the equation on either end, the remote connection fails. Can anyone tell me how to make this work? Please and thank you!
Code: Select all
Wow, thank you. That was more information than I had ever thought I would be able to find. Just one question before I go through doing all that though... My plan is to wirelessly connect my pi to a 4G hotspot (the hotspot puts out a private wifi signal that my pi can pick up) and then remote access it from my home wifi on my laptop or from my phone using mobile data. Will everything you just said still work in this reversed case where I do not have a router connected to my pi?KarmenJell wrote:When your phone and raspberry pi are on the same network, you are probably using the private IP address of the pi to SSH, right?
The private IP most probably looks something like 192.168.x.x (Although it could also be something like 10.x.x.x or 172.16-32.x.x).
Now if you want to be able to SSH from outside of your private network, you won't be able to use the private address. Instead you will need to use the public IP address. Your router is probably doing something called Network Address Translation (NAT) which is basically a way of giving all you devices different private IP addresses but the same public IP address.
This is a problem when you want to connect to something specific inside your network from the outside as your router won't know which device to send connect to as they all share the same public address. The way around this problem is to use something called port forwarding.
Another thing that will stop you from SSHing to your pi will probably be some sort of port filtering from your mobile provider. My provider was blocking port 22, which is the default port for SSH. You can change the port number that your pi listens on to get around this. You simply need to change a line in. Here's a guide on how to do that: http://www.linuxlookup.com/howto/change ... t_ssh_port. I changed mine to port 443 as that is not blocked by service providers. (However if you plan on running a web page on port 443 you will probably need to choose a different port number)
Code: Select all
To do this, first you will need to set a static (unchanging) IP address for your pi. There are a a couple of ways you can do this. You can follow this guide to set a static IP address:https://www.cyberciti.biz/faq/linux-con ... -tutorial/
Once that is set, you will need to log into your router. You can find a guide on how to do this on your router manufacturers webpage or by simply googling it. The username and password (if you haven't changed it) will probably also be on the website, or written somewhere on the router itself. As an aside, I would HIGHLY recommend changing your router's password from the default one if you haven't done so already.
Once you're logged in, you will need to look for an option called port forwarding. You can then enter the static IP for your pi that you set up earlier in the IP address section. For port number or range, put the number of the port that you also set up earlier. E.g. Mine would be 443 as I set that as the SSH port. If there is an option for protocol just choose TCP or TCP/UDP.
This should then allow you to use your phone on 4G to connect to your pi on your home network. Remember to use the new port number you selected before and to use the public IP address of the pi. You can find this by connecting to your home network and searching "what is my ip" on google. Bear in mind that this can change, so you'll have to check regularly. However sometimes it doesn't change for years.
Note that this method allows your pi to be visible from outside your internal network, i.e the internet. So make sure to use a very strong SSH password and use RSA keys if possible. You can find hardening tips her: https://www.linux.com/learn/5-ssh-hardening-tips.
I think that covers everything. I'll add anything that I remember.