Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Conveying NAT firewall port re-writing to mosh #494

earlchew opened this Issue · 1 comment

2 participants


I am using a firewall which re-writes TCP/UDP port numbers.

I'm considering a patch to bin/mosh to accommodate this, and I'm soliciting advice on a reasonable approach.

Suppose the firewall will rewrite port numbers from 40001 to 50001 (as an example). This means that I want to issue -p 50001 to instruct the server to listen on 50001, but I also want the client to send to port 40001 (which the firewall will rewrite).

I'm thinking:

mosh -p 40001/50001
mosh -p 40001/50001:50099

would be a reasonable way to indicate this.

The second example shows how it could be combined with a server side port range. Suppose the server responded with port 50055, the client would use:

40001 + (50055 - 50001) = 40055
@earlchew earlchew referenced this issue from a commit in earlchew/mosh
@earlchew earlchew mosh: Support NAT firewall port re-writing

Some firewalls re-write port numbers. Allow a port translation rule
to be specified. When the mosh-server responds with a port, have
the mosh-client connect to the translated external firewall port.

Signed-off-by: Earl Chew <>

Duplicates #497.

@cgull cgull closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.