0

So I have a laptop connected to the 4G network the only problem is I want to connect to it via SSH from my PC. So far I have discovered that ny network operator does not allow port forwarding but I can connect to a VPN that does.

So far I have set my tun0 (4G) device as default and have tried to reverse tunnel into it using the -R specifiers using SSH but with no luck. The whole route would look like this.

MyPc->MyRouter->Internet->VPN(Port forwarded)->4G Network->MyLaptop

I have tried:

ssh -R VPNPortforwardPort:localhost:LocalBindingPort "MyPcUserName"@MyPcIP
ssh -R 20257:localhost:22 "Dirk Dirksen"@my.ip.add.res

But I get a timeout. I have also enabled my sshd_config to allow 'GatewayPorts yes' and still no luck. I have also set my home router to port forward 5555 to 22 to MyPc.

When I enable my VPN and then request port forwarding I get a number like 20257 which in the localhost I try to bind to port 22 but still no luck, I just get a time out response.

So what im getting a bit confused about is the port numbers and all this port forwarding. My home router is making 22->5555 and then my VPN to the laptop gives me 20257 and then I need to connect to port 22 through that 20257 and iptables has everything set to allow.

I'm not sure if this is even possible. It must be. Where am I going wrong?

1

The answer might not be relevant for your specific use case. But, if your problem is having access to a machine which is not physically accessible to you then read on.

I had a (potentially) similar problem a couple of weeks back trying to hook up one of our work machines for the quarantine where we had a similar block for port forwarding and did not manage to solve it.

What solved it for us was to leave a copy of team viewer open on the PC, set an option to never turn it off, and from there it was pretty straight forward.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.