LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-18-2014, 10:48 AM   #1
m_yates
Senior Member
 
Registered: Aug 2003
Location: Upstate
Distribution: Debian, Mint, Mythbuntu
Posts: 1,249

Rep: Reputation: 101Reputation: 101
SSH access without a publicly routable IP address?


I have been trying to access my home linux desktop remotely using ssh. The problem is that my cable modem assigns my router a private IP address 172.xx.xx.xx. The router runs Tomato firware and is set up with DDNS and port forwarding. If I use the 172.xx.xx.xx router address, I can access my desktop from any computer connected wired or wireless on my LAN. On the LAN, access to the desktop using ssh, sshfs mounting, and even serving web pages works. The problem is that I cannot access anything remotely.

My ISP does not assign a publicly routable IP address to the router, and the cable modem offers no configurable options for port forwarding or bridge mode. If I run nmap on the public IP address of my cable modem, it shows all ports as being filtered.

As a test, I installed Bittorrent Sync on my home desktop. Files I place in the sync folder are remotely accessible without making any changes to the router, modem, ports, or firewall. Somehow the Bittorrent Sync application is able to find my desktop and open up a two way connection to it. However, I don't want full, duplicate copies of every file on two machines. What I want is to mount a remote directory using sshfs and move select files to/from that directory. If Bittorrent Sync is able to access my desktop, it seems like there should be a way for ssh to do the same. The folks at DynDNS told me that I am SOL unless my router has a public IP address, so maybe what I want is impossible.
 
Old 02-18-2014, 04:54 PM   #2
SilentSam
Member
 
Registered: Aug 2007
Location: Ottawa
Distribution: Arch Linux/Kubuntu/OpenSUSE
Posts: 300

Rep: Reputation: 37
My modem originally doubled as a router, so I had my modem/router combo -> another router -> my network. I was able to change my cable modem's functionality as switch the routing completely off, and then the modem was forced to have a public IP address so that the other router would function. I was able to set my port forwarding through my standalone router, and have external facing SSH.

Be wary about this, though. SSH's defaults are not safe, and I was attacked. Switch the port to a more obscure one in the least, and above all else don't allow SSH as root.
 
Old 02-18-2014, 05:10 PM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143
If you can't configure port forwarding in the cable modem, and you can't configure the cable modem to push the public IP to your router, then you might have to go about this in the other direction.

Where are you trying to access your system from? Do you have access to ANY machine outside of your network that you could tunnel the connection through? If you have access to a machine outside of your network, you could configure your desktop to open and maintain a permanent reverse ssh tunnel to that machine, and then you could connect to your desktop from outside your network through the tunnel.

For example, I have my laptop configured to open and maintain a permanent reverse ssh tunnel to my home server. It sets up the tunnel autonomously on boot and keeps it open until the machine is shut off (closing and re-opening the tunnel if it ever gets cut off). This allows me to ssh from my home server into the laptop regardless of what network the laptop is on or how they have the firewall/routing configured (unless of course they block outbound connections on the port I'm using to open the tunnel from the laptop side). In this example my laptop would be your desktop, and my server would be some machine you have access to outside of your home network.
 
Old 02-18-2014, 05:20 PM   #4
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,859
Blog Entries: 14

Rep: Reputation: 285Reputation: 285Reputation: 285
Quote:
Switch the port to a more obscure one in the least, and above all else don't allow SSH as root.
and better yet, disable passwords and require a keyfile.

Does your ISP require that you use their cable modem? Many allow you to get your own, allowing you to have one that is more amenable to acting like a router.
 
1 members found this post helpful.
Old 02-19-2014, 07:00 AM   #5
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,992

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
what suicidaleggroll stated is correct if you have no management access to the router. also read the links in my sig for more details on this.
 
Old 02-23-2014, 10:56 PM   #6
m_yates
Senior Member
 
Registered: Aug 2003
Location: Upstate
Distribution: Debian, Mint, Mythbuntu
Posts: 1,249

Original Poster
Rep: Reputation: 101Reputation: 101
Thank you for all the replies and links with more information. I was totally ignorant about what was going on. Marking SOLVED. My problem is that my ISP appears to have a firewall set up blocking incoming connections, and I have no access to open incoming ports to my router at home. I didn't realize that bittorrent sync is working by using a relay server to connect to my computer at home.

After reading and learning some more, I purchased a VPS hosting service and used it to set up my own relay for ssh tunneling. I disabled port 22 on the VPS and I am using a non-standard port for the connection. I set up keys and a ssh config file to make the ssh connection without a password. I can now use sshfs to mount my home computer as a local directory on my laptop while traveling.

The VPS is actually one of the coolest technology purchases I have made recently. It gives me a full Debian Wheezy system with root access. It is like having a personal swiss army knife of on the internet. Right now, I am just using the VPS to relay the ssh connections, but I think I will install owncloud on it and sync some directories. I currently pay for backup service on Amazon S3 servers and the VPS will also allow me to do my own backups using rsync and ssh to any device that I have root access to, regardless of what firewall is present.
 
Old 02-24-2014, 07:26 AM   #7
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,992

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
congratz, and glad you were able to get a working setup to bypass the ISPs fire/paywall.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] OEL5.4 OS, eth0 has private IP, eth0:0 has routable IP, internet access don't work Hiroshi Linux - Networking 7 06-02-2010 12:49 PM
setup Static IP address for centOS and access to ssh careykwong Linux - Networking 14 09-23-2009 10:02 PM
ssh access to private IP address fatra2 Linux - Networking 3 09-09-2009 01:38 PM
apache - 1 routable IP address, multiple machines peridot121 Linux - Server 2 09-02-2009 05:35 PM
SSH Access Limiting By IP Address During Certain Times jordo2323 Linux - Security 7 11-20-2008 02:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration