-1

Okay, here's the situation I am in. I have a raspberry Pi 2 model B. I have Raspbain Jessie installed as the OS. I have Apache installed as well. I have a web server running and i am able to edit it and access the site from different devices on different internet connections. I want to be able to connect to my RaspPi through SSH on my MacBook Pro. I am able to do this while on the same network. My Pi is plugged into the router via an Ethernet. What i have tried is, logging into my router and reserving an IP for my Pi, i also entered my MAC address here. I have gone into the port forwarding options in my router and have it set up as: HTTP, TCP, Server address(the one i reserved) my Ipv6, and Start port 80, end port 80. Ontop of that i have gone into my /etc/dhcpcd.conf file. There at the end of the file i added

interface eth0
static ip_address=10.0.0.100
static routers=10.0.0.1
static domain_name_servers=68.44.180.118 2001:558:feed::1 2001:558:feed::2

The guide I followed is attached here and follows other guides i have seen. http://www.circuitbasics.com/how-to-set-up-a-static-ip-on-the-raspberry-pi/

Yet when i try to SSH remotely i cannot get a connection, and when i connect on the same internet i can connect as normal. Please if anybody sees what could help .

Pang
  • 9,564
  • 146
  • 81
  • 122
WRW
  • 1
  • 2
  • Are you saying that you have a working SSH connection to the pi on LAN but would like to access the pi/your LAN via the internet? In that case, you only have two realistic options: port forwarding (setting up a static IP is typically a part of that but not everything) or connecting via a third server on the internet that can act as an intermediary and thereby avoid NAT blocking by your router and ISP – jDo Mar 09 '16 at 03:37
  • Yes, i have a working SSH connection to the pi on LAN and would like to access it while lets say, at school. I did port forwarding i believe, but if that is not everything what is the next step? I don't think i want to use a third server for this right now. I guess i can look a little bit more, i just thought it was the only step – WRW Mar 09 '16 at 18:35
  • I'm not sure but a few observations... The central theme of your question doesn't seem to be static IPs but rather "How to access my LAN (safely) from the internet" (hint, maybe you should rename the question and search for info on what you're actually trying to achieve rather than the means to an end). Have you rebooted the pi and router to check that your IP is now static? Have you pinged your LAN from the outside? Inside? Nmap? What does "can't get a connection" mean specifically? Dropped? Refused? Hanging? Any error codes? – jDo Mar 09 '16 at 21:44

1 Answers1

3

Your router's firewall is probably blocking the ports for SSH, which does not use port 80 (in raspbian, I think its default is port 22). If you are going to take the risk of leaving your SSH open to the public, you should probably switch it to a different port other than the default before opening up a port on your firewall. The Raspbian Community has a thread on how to properly change SSH's default server port. You'll also need to make sure your SSH client is using the same port. You will need to leave 80 open for web, and also forward the SSH port, which ever you choose that to be (22 is the default).

Von Rugen
  • 201
  • 1
  • 3
  • So heres where i am at now. If i change start port and end to 22 and 22. i can SSH outside of my local network, but my website does not load. If i made start and end 80 and 80 then my website will work but i cannot do SSH outside of local network. (Doing this in my router) – WRW Mar 11 '16 at 09:47
  • You'll need both 22 and 80 open. – Von Rugen Mar 12 '16 at 00:00