So a little background: I'm a CS student mostly interested in development and software design, but also highly interested in everything Linux and servers. I've wanted my own RPi for a while and finally this week I had the chance to get one and start getting dirty with it. I got myself an Raspberry Pie Model 3+ Starter Kit.
So I decided to start off with something simple: getting a web server running and having Wordpress on top of it. I'm using Raspbian Stretch Lite. Everything works quite well, but I'm having some issues connecting to my RPi. I of course want it to have a public IP so I can connect to it remotely as well and have my website running publicly, so I've tried to achieve it in two ways:
1. Bridging the ethernet port on my router which is connected to the RPi
Everything worked quite nicely, outside my local network. So for example if I tried to connect to the website (http) on my cell phone (which was connected to 4G network) it was succesfull, as well as if I tried to connect to the SSH on my cell phone. BUT if I tried to connect to the RPi via HTTP or SSH on any of the devices in my LAN (devices that are connected to the same router as RPi, via Wi-fi or ethernet), the connection was unsuccessful.
2. Port forwarding the RPi
So since the bridging didn't seem to work, I tried if I can achieve it easily by port forwarding the SSH and HTTP ports from my router to my RPi.
The problem I ran into was that now I was able to connect to the RPi via HTTP and SSH only through devices that were connected to the router by Ethernet. From devices outside my local network (for example my cellphone that was connected to the 4G) OR devices that were connected to the router via Wi-fi I was only able to access the website through HTTP, but I could not connect to it via SSH.
I'd really appreciate help with this, as I understand that I'm obviously missing or forgetting something really obvious. I'd appreciate help and answers to these questions:
- Which one is a better solution to get a public ID for my RPi, so it can be connected from outside of my LAN. Bridging an ethernet port or port forwarding?
- What am I missing, what causes these kinds of problems? I have very basic knowledge on networks through my studies (I'm just starting my 2nd year studies) and through work (I've been working since April solving problems with consumer level network devices), but obviously I'm missing some key pieces in here.
So the dumbass brains that I have didn't realize that FTP != SSH. Obviously I need to port forward port 22 to be able to connect through SSH from external network. I forwarded port 22 and now I'm able to connect via SSH to my RPi as well.
But the problem still exists in my LAN, with devices that are connected via Wi-fi. So I still am not able to connect to the RPi via SSH using the LAN ip that my RPi has (192.168.10.54), but by using the public IP. With devices that are connected via Ethernet I am able to connect to RPi SSH using the ip 192.168.10.54. Does anyone have any idea why that could be?