# [SOLVED] trouble with ssh



## raelcun (Jul 25, 2012)

I'll start off with my setup. I have a Dlink dir-655 router connected to the modem provided by my isp. I have a cheap netgear router with dd-wrt connected directly to the dlink router. My laptop is running Windows 7 and connects wirelessly to either of the routers.

I installed Cygwin on my laptop so I can ssh into it from other computers. I can ssh into it using computers on the same network using Putty and the local ip address of my laptop (192.168.....), but I don't know how to ssh into my laptop from a computer that is not on the same network. The local ip address wouldn't be recognized on other networks.

I don't know a whole lot about routing, but I assume I have to somehow tell the router to direct ssh connections to my laptop?


----------



## AA1TECH (Nov 23, 2010)

*Re: trouble with ssh*

Welcome to TSF!

Please review the pre-posting requirements and in this instance please augment with an IPCONFIG when connected to the Dlink, and an IPCONFIG when connected to the Netgear router. Also to clarify, the computer not on the same network you want to connect... this is local correct, not across the internet to some other computer? One discussion is routing and DHCP setups, the other is port forwarding related and we need to know which.... Thanks


----------



## raelcun (Jul 25, 2012)

*Re: trouble with ssh*

I will clarify my situation. I have a laptop connected to my home network. I can ssh into that laptop from any other computer on the network using the local ip address (192.168.....).

I would like to be able to ssh into my laptop from a computer at my university, so across the internet.

IPCONFIG for DLink:

```
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\raelcuN>ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : raelcuN-PC
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : ZoomTown.com

Ethernet adapter Local Area Connection* 39:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Anchorfree HSS Adapter
   Physical Address. . . . . . . . . : 00-FF-6C-BA-10-BE
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Ethernet adapter Local Area Connection 3:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . :
   Physical Address. . . . . . . . . : 00-FF-40-44-8D-CC
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Ethernet adapter Local Area Connection 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) Centrino(R) WiMAX 6250
   Physical Address. . . . . . . . . : 00-1D-E1-47-A3-B3
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Wireless Network Connection 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft Virtual WiFi Miniport Adapter
   Physical Address. . . . . . . . . : 64-80-99-2F-FA-25
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Ethernet adapter Bluetooth Network Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
   Physical Address. . . . . . . . . : D0-DF-9A-3B-05-63
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . : ZoomTown.com
   Description . . . . . . . . . . . : Intel(R) Centrino(R) Advanced-N 6250 AGN
   Physical Address. . . . . . . . . : 64-80-99-2F-FA-24
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::882c:2727:dd9d:b7fb%12(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.0.197(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Tuesday, July 31, 2012 1:27:39 PM
   Lease Expires . . . . . . . . . . : Saturday, September 07, 2148 8:20:39 AM
   Default Gateway . . . . . . . . . : 192.168.0.1
   DHCP Server . . . . . . . . . . . : 192.168.0.1
   DHCPv6 IAID . . . . . . . . . . . : 224690329
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-15-A4-E4-85-5C-26-0A-65-E9-17

   DNS Servers . . . . . . . . . . . : 192.168.0.1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter Local Area Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Atheros AR8151 PCI-E Gigabit Ethernet Con
troller (NDIS 6.20)
   Physical Address. . . . . . . . . : 5C-26-0A-65-E9-17
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : VirtualBox Host-Only Ethernet Adapter
   Physical Address. . . . . . . . . : 08-00-27-00-64-E2
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::b178:63fb:e27f:4972%46(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.56.1(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 1174929447
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-15-A4-E4-85-5C-26-0A-65-E9-17

   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Tunnel adapter Local Area Connection* 13:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft 6to4 Adapter
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.ZoomTown.com:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #6
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.{29C1FF6B-E383-4FB8-AC46-C0D1AFBDA301}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #7
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter Local Area Connection* 24:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

C:\Users\raelcuN>
```
IPCONFIG for Netgear

```
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\raelcuN>ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : raelcuN-PC
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : ZoomTown.com

Ethernet adapter Local Area Connection* 39:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Anchorfree HSS Adapter
   Physical Address. . . . . . . . . : 00-FF-6C-BA-10-BE
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Ethernet adapter Local Area Connection 3:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . :
   Physical Address. . . . . . . . . : 00-FF-40-44-8D-CC
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Ethernet adapter Local Area Connection 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) Centrino(R) WiMAX 6250
   Physical Address. . . . . . . . . : 00-1D-E1-47-A3-B3
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Wireless Network Connection 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft Virtual WiFi Miniport Adapter
   Physical Address. . . . . . . . . : 64-80-99-2F-FA-25
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Ethernet adapter Bluetooth Network Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
   Physical Address. . . . . . . . . : D0-DF-9A-3B-05-63
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . : ZoomTown.com
   Description . . . . . . . . . . . : Intel(R) Centrino(R) Advanced-N 6250 AGN
   Physical Address. . . . . . . . . : 64-80-99-2F-FA-24
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::882c:2727:dd9d:b7fb%12(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.0.197(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Tuesday, July 31, 2012 1:27:39 PM
   Lease Expires . . . . . . . . . . : Saturday, September 07, 2148 8:20:39 AM
   Default Gateway . . . . . . . . . : 192.168.0.1
   DHCP Server . . . . . . . . . . . : 192.168.0.1
   DHCPv6 IAID . . . . . . . . . . . : 224690329
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-15-A4-E4-85-5C-26-0A-65-E9-17

   DNS Servers . . . . . . . . . . . : 192.168.0.1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter Local Area Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Atheros AR8151 PCI-E Gigabit Ethernet Con
troller (NDIS 6.20)
   Physical Address. . . . . . . . . : 5C-26-0A-65-E9-17
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : VirtualBox Host-Only Ethernet Adapter
   Physical Address. . . . . . . . . : 08-00-27-00-64-E2
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::b178:63fb:e27f:4972%46(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.56.1(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 1174929447
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-15-A4-E4-85-5C-26-0A-65-E9-17

   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Tunnel adapter Local Area Connection* 13:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft 6to4 Adapter
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.ZoomTown.com:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #6
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.{29C1FF6B-E383-4FB8-AC46-C0D1AFBDA301}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #7
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter Local Area Connection* 24:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

C:\Users\raelcuN>
```


----------



## AA1TECH (Nov 23, 2010)

*Re: trouble with ssh*

Thank you, OK, please follow the below instructions. You can do this on either of the routers, but I have more familiarity with the DIR-615 so I'll provide instructions for that one. 

We basically need to get port 22 from your laptop system on the wireless adapter open to the internet. We do this with port forwarding and a pseudo static address.

1) Login to your DIR-655 
2) Navigate to the Add DCHP Reservation Screen (looks like the following)










3) Now, click the enable checkbox, your computer may already be in the computer box and you can select it... that should prefill the IP and MAC addresses currently in use. I would press the COPY MY PC's MAC ADDRESS button anyway, just to be sure. From you IP above, that should be 64-80-99-2F-FA-24. Any IP address is OK, your current one is 192.168.0.197 --- PUSH SAVE

What this step did is every time your PC powers up or reconnects to the network, DHCP will see the MAC address and assign it the same IP.

4) OK, with that completed, and you should verify that in fact it gives you the same address each time... at a command prompt, you can issue IPCONFIG /RELEASE (drops your connection) and then do an IPCONFIG /RENEW - will reconnect, then IPCONFIG should show you the same IP address being assisgned.

5) Now to forward the port... Go to the advanced tab, then on the left select PORT FORWARDING - you should see the following screen:










Click on the little enable box, then click on the application box, SSH should be listed, if not you can simply enter SSH into the Name field. next click on the computer name box, find yours, and push the << button. Again this will fill in the reserved IP we just made. Under TCP port, put 22. You can leave UDP blank. Select ALLOW ALL and ALWAYS in the inbound filter and schedule fields.... PUSH SAVE SETTINGS. The router should reboot at this point. Once it does and you have connection back, port 22 should be open. 

Now here is the tricky part, your almost done... your IP of course cannot be seen outside of your private network. Navigate to the STATUS page of your router, go to Device Info... Under the WAN section is the real IP that you can supply to folks that port 22 can be used for SSH. 

This address can change when your router reboots, tickets expire, etc. It is not guaranteed to remain. Many choose to use a service that keeps an eye on your dynamic address and maps it always to a given name so you don't have to keep track of it. For now, let's get this portion working and then we can walk through this portion once that is in place if you wish.


----------



## raelcun (Jul 25, 2012)

*Re: trouble with ssh*

Thank you for the easy to follow walkthrough. Everything is working and I can ssh into my laptop now using the wan ip. How do I make sure this ip address doesn't change?


----------



## TheCyberMan (Jun 25, 2011)

*Re: trouble with ssh*

That all depends on your ISP and wether they supply you with a static exteranl ip one that will not change at all or whether they give you a dynamic which can change every 4hours or a sticky dynamic address which only changes when your modem is powered down and then powered on again the address changes.

If static then you will have to do nothing.

If dynamic it will change periodically so the address you may have used once will not be associated with your connection anymore.

In the this case use something like no-ip to use a hostname which will be synced to your ip address when it changes all you do is enter the hostname when connecting to ssh.

Download the no-ip sync client and install it on computer using ssh to sync hostname with computer and ext ip.

Link below to NO-IP it is free to use.

No-IP.com - Managed DNS - Free Dynamic DNS - Managed Email - 100% Uptime Guaranteed


----------



## raelcun (Jul 25, 2012)

*Re: trouble with ssh*

No-ip syncs my external ip address to 208.102.179.132 which is correct. I can ping the address so it is indeed my ip address. But I can't ssh into my computer with that address. When I attempt to ssh into my computer with putty using the external ip address, it says "Network error: Connection refused". I disabled Kaspersky and Windows Firewall and the problem persisted.

As a side note, all tests are being done from the same network that my computer I am ssh into is on because my university is about an hour away from my house. The WAN IP that AA1Tech said to use is 192.168.200.70. This worked when I tested ssh from the same network.

I used a Port Forwarding Tester with both ip addresses and it said port 22 is closed.


----------



## TheCyberMan (Jun 25, 2011)

*Re: trouble with ssh*

Well 192.168.200 will work on the internal network but that address won't work externally.

Question i have for you the modem that the dir-655 connects to is that an ADSL modem router?

If it is then portforwarding will be needed to be done on that as well.

Waht is make and model of modem please?


----------



## raelcun (Jul 25, 2012)

*Re: trouble with ssh*

I found out that my network had an additional router set up by my ISP. It was a super cheap Westell router that didn't allow port forwarding. In fact, it didn't allow much of anything. That router was the first router in the connection.

My DLink router was connected to that Westell router which is why the IP address of the router was a local address (192.168.200.70). Even after enabling port forwarding on my DLink router, the Westell router was not forwarding the port, therefore checking if the port is open using my external ip address (208.102.179.132) would result in it saying it's closed.

I removed the router from the network and reconnected the routers. Now the port is open and I can ssh into my computer using the external ip address.

I installed the No-Ip client to monitor my external ip address and now that is working smoothly as well.

@TheCyberMan and AA1TECH
Thank you very much! :smile:


----------



## TheCyberMan (Jun 25, 2011)

*Re: trouble with ssh*

I thought that may be the case that is why i asked about another router or modem.

Glad it is now working smoothly for you.

Please mark the thread as solved using thread tools.


----------

