How to connect to a server behind NAT using mosh

I would like to connect to my server, which is located behind NAT via mosh. I can’t touch the router to set it as upnp support, but I applied 9807-> 60000 and ssh port forward for the UDP port forward.

So, is there any way to specify the server port through the args command line or conf file on the client and / or server side?

Note: the following does not work!

mosh -p 9807 user@my_server

Edit:

First I tried to execute ssh on my server and run mosh-server -p 60000 manually, and then mosh -p 9807 my_server from another terminal. This causes an error:

Error binding to IP my_server_ip: bind: Address already in use

That said:

  • port works.
  • try installing the mosh server on port 60000.

Thank.

+4
1

, , . NAT , <domain>:9807 <internal-ip>:60000. mosh -p, ssh , . mosh- ( , ) , ssh <domain>:<port>. , . , NAT- WAN NAT. .

, 9807 WAN - 9807.

, , , - iptables.

iptables -t nat -A PREROUTING -p udp --dport 60000 -j REDIRECT --to-port 9807

,

mosh -p 9807 user@my_server

:

  • mosh ssh- ( NAT-), mosh-server 9807.
  • mosh-, , ssh, UDP-: 9807
  • mosh ssh 9807
  • NAT 9807 60000
  • 60000 UDP, iptables ( IP- ), 9807
  • SRC NAT-, mosh- , , .
+2

Source: https://habr.com/ru/post/1568092/


All Articles