0

I tunneled data transition as 22-22 and 2222-80, between my PC and VPS:

ssh user@1.1.1.1 -L 22:localhost:22 -L 2222:localhost:80 -i ~/.ssh/key

To make sure both tunnels were created, I executed lsof -i -n -P | grep ^ssh after logging in to the server.

Here is the stdout. You can see that only port 22 is present, without 2222:

sshd     1785     root    3u  IPv4  17568      0t0  TCP *:22 (LISTEN)
sshd     1785     root    4u  IPv6  17570      0t0  TCP *:22 (LISTEN)
sshd    31511     root    3u  IPv4 447661      0t0  TCP SERVER_IP:ssh->ISP-acronym-LOCAL_IP.ISP-subdomain.ISP-domain:52086 (ESTABLISHED)

My question:

My question can actually be comprised of the following 2 questions:

  1. What might have went wrong so that only a 22 tunnel appears, but no 2222 tunnel? Please advise me what's worth checking in my system and I will update this question.

  2. What is this IPV6 there in the second column? Neither my PC, nor my VPS, has a IPV6 IP.

Notes:

  1. The system I tunnel from is WSL Ubuntu. Very basic; A fresh install with no utilities installed besides fail2ban. I just login with the already existing OpenSSH and that's basically it.
  • You are apparently looking at `sshd` _on the server_. (Maybe you typed this _in_ the remote shell run and connected by `ssh`?) The LISTENs for `-L` tunnels _should be on the client_ where you are running `ssh`.(Also `-D`, while `-R` LISTENs on the server and tunnels to the client.) I don't know if WSL has `lsof`; if not try `netstat` or `ss`. Re IPv6: if real Linux the server has a dual _stack_ whether or not it has an IPv6 _address_. – dave_thompson_085 Dec 30 '16 at 07:44
  • I typed this in the remote shell (VPS), indeed. Also, indeed it seems current release of WSL doesn't have `lsof`... `netstat` or `ss` doesn't seem to return any values at all when I run them in a second, local WSL session (after I already logged in). Please honor me with any other advise you might have. –  Dec 30 '16 at 10:31
  • WSL does have lsof, netstat and ss. Make sure you are up-to-date with Windows updates AND that you have done `sudo apt-get update && sudo apt-get upgrade` – Julian Knight Dec 30 '16 at 11:17
  • Of course, that doesn't mean they return quite the same information than on a real Ubuntu Linux system. Certainly not all system-level information is available to the Ubuntu subsystem due to the different way that the Windows Core works. I'm not even sure if running another window creates a separate environment, you might need to use screen. – Julian Knight Dec 30 '16 at 11:19
  • Is there no way to check if both tunnels were established from the VPS's end? –  Dec 30 '16 at 23:33
  • If you're host (*my PC*) hold a SSH server, you won't be able to listen on port 22. – F. Hauri - Give Up GitHub Dec 31 '16 at 11:58
  • Instead of binding port 22, have a look in manpage, at `-M` and `-S` switchs to `ssh`! – F. Hauri - Give Up GitHub Dec 31 '16 at 11:59
  • It's tangental, but if SSH tunnels collapsing often is a concern, you might want to look into autossh. – Ivan Jan 30 '17 at 16:16

1 Answers1

0

After running netstat -tulpn I did saw to conenctions, one is to port 22, and one is to port 80.

So it seems the tunneling didn't fail.