mosh, jail and pf

Jacques Foucry jacques+freebsd at
Sun Sep 13 18:25:24 UTC 2020

Hello Experts,

I would like to use mosh in order to keep some ssh connexion even if close my

mosh is installed on a jail and ssh is listen on port 4243

I tried, from my laptop 

`mosh --port 60000 --ssh "ssh -t -t -p4243" -- host ssh -t -t jail

It does not work and the error is:

mosh did not make a successful connection to ww.xx.yy.zz:60000.
Please verify that UDP port 60000 is not firewalled and can reach the server.

(By default, mosh uses a UDP port between 60000 and 61000. The -p option
selects a specific UDP port number.)
[mosh is exiting.]```

Looks like a `pf` problem, I need to open the 60000:61000 port range.

So I read the pf man page and saw that range are define with a colom:

``Port 2000:2004
                       means ‘all ports ≥ 2000 and ≤ 2004’, hence ports 2000,
                                              2001, 2002, 2003 and 2004.```

So I defined:

`mosh_port = 60000:61000`

and the rule:

But nothing works.

So I need your help or advices to configure, I suppose, `pf` to make mosh
working for contacting my jails.

Thanks in advance

Jacques Foucry

More information about the freebsd-questions mailing list