SSH – How to Connect Two Computers Behind NAT and Firewall Without Third Computer

firewalllinuxnat;sshwindows

I am trying to ssh into my Linux box at home. My home is a dorm-style environment – NAT and Firewall with personal laptop running Arch Linux. My work is corporate style Windows 7 – NAT and proxy firewall, no admin rights.

I am able to connect the two running Team Viewer portable. However, this does not suit what I'm really looking for. I am looking to simply SSH into my Linux box at home, leaving my Linux box logged out completely – basically headless when I'm not there.

I've read up on tunneling, however if I understand tunneling correctly I need a 3rd party server that both computers can connect to. I have no such server and don't wish to pay for such a thing either.


What is the simple and secure solution to SSH'ing into my laptop from work? Is there a free and secure 'third server'? I have been up and down Google, but seem to be getting more and more confused.

Best Answer

pwnat is an open-source tool that supposedly addresses this problem. It says :

pwnat is a tool that allows any number of clients behind NATs to communicate with a server behind a separate NAT with no port forwarding and no DMZ setup on any routers in order to directly communicate with each other. The server does not need to know anything about the clients trying to connect.

There is no middle man, no proxy, no 3rd party, no UPnP/STUN/ICE required, no spoofing, and no DNS tricks.

More importantly, the client can then connect to any host or port on any remote host or to a fixed host and port decided by the server.

pwnat establishes this kind of connection :

Machine A (IP: 192.168.1.3) -> NAT A (IP: 122.x.x.x) -> Internet -> NAT B (IP: 59.x.x.x) -> Machine B (192.168.2.10)

pwnat is distributed only for Linux, but the article PWNAT: Windows Complied Version contains the Windows version. See also, by the same author PWNAT : Example.

The method used by pwnat is unbelievably clever, but there is no guarantee that it will work with your environment.

Related Question