Ok so I'm trying to SSH into my home machine from work/school. Problem is, even though I set up my router appropriately, I can only ssh into it when I am in my apartment's network (not my own personal one). They have their own network with their own set of IP addresses. This is problematic. I was wondering if anyone knows a solution? I have considered VPN but it would seem that even with a vpn, I would still have to go through their own network which idk if it would work. Is there a way to vpn onto their network and then ssh into my machine via my own network? Or an alternative?
Thanks for your time

  • 1
    It sounds like you get Internet from your apartment's network. The apartment must have a big router somewhere that assigns local IP addresses to each apartment. If this is true, you will have to talk to the apartment's network admin and ask her to forward a port to your apartment's router. Alternately, you may consider buying Internet service from another provider.
    – user68186
    Commented May 18, 2015 at 18:14
  • Thank you! So what should I do if they do release a port to me? on my side that is? Also it may be worth noting that the admin resides in a location quite far away from the network so I would assume he/she vpns into the network. Is this an option?
    – YankYank
    Commented May 18, 2015 at 19:11

1 Answer 1


Without knowing much about your aprtment's Internet Service Provider (ISP), as well as how your apartment's network (AN) is managed, it is hard to give a solution.

Dynamic Vs Static IP addresses

Three levels of difficulties

First: IP address assigned by ISP For most home users ISPs provide a single dynamic IP address. This means the IP address can change anytime at the whim and fancy of the ISP. You need to find out the IP address assigned to your AN by the ISP. You can type "What is my IP" in Google search and get the IP address assigned to your apartment's network. However, this does not tell you if this is static (it never changes) or dynamic (it can change anytime). Let's say this address is www.xxx.yyy.zzz.

Second: IP address assigned by Apartment's Network: Your apartment's network may again assign IP addresses to each apartment statically or dynamically. If apartment network admin uses dynamic IP address allocation. STOP HERE! There is no way to reliably ssh to your home computer from outside.

If your apartment's network admin uses static IP address allocation, there may be still hope. I will assume this is the case for the rest of the answer. Let's say your apartment's network has permanently assigned the IP address to your apartment. You can find this from the WAN setting part of your own router.

Third: IP address assigned by your own router This you can control. Make sure that your router assigns the same (a static) IP address to the computer you want to ssh to. Let's say this address is This is just an example. There is no need to change your IP address to this specific one. You can find this from your computer's Network Manager's connection information.

Port forwarding through two routers

You already know that ssh uses port 22. However, since your apartment's network admin works remotely, she may be using that port to ssh into local server/router. In any case, the same port cannot be used to connect to more than one apartment. So, if 22 is used by some other resident or is simply blocked, you have to use another port. Choose a different port in the 50000+ range. Say 50005.

Set up your computer's ssh server to listen to 50005 rather than 22. Set up your ssh client to use this port as well.

Now, ask your apartment network's admin to forward the port 50005 to your apartment's IP address,

Setup your own router to forward the port 50005 to your computer's IP address,

Now you should be able to ssh from outside your apartment's network. Remember to use the external ISP's assigned IP www.xxx.yyy.zzz and the port 50005 (or whatever you choose) when ssh from outside.

If www.xxx.yyy.zzz is dynamically assigned, you may use a DDNS service to link that IP address to a host name.

Hope this helps

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .