Unison, Socket Method, Connection refused

Hello World,

Have used the unison socket method on Linux when security is not a concern (isolated network). New to FreeBSD. Two FreeBSD boxes. Going either direction the connection is refused. I have run out of ideas.

Code:
$ uname -a
FreeBSD stan3 10.3-RELEASE FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 02:10:02 UTC 2016  root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

Code:
uname -a
FreeBSD acer00 10.3-RELEASE FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 02:10:02 UTC 2016  root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

On one, as root,
Code:
unison -socket 55555

On the other, as root,
Code:
unison /usr/ports/distfiles socket://stan3:55555//usr/ports/distfiles

There are entries in both /etc/hosts files and ping functions in both directions.

Nothing has been added to either /etc/rc.conf pertaining to firewalls.

Thanks
 
Last edited by a moderator:
A "Connection refused" usually means you're trying to connect to a socket that's closed. It's probably not a firewall issue as that usually results in a "Connection timed out". So make sure the first command actually opens a port, sockstat(1) is quite useful for this. As are tools like tcpdump(1) that will let you see the actual packets.
 
Code:
# unison -socket 55555
server started

sockstat seamed to show that IPv6 and not IPv4 was being used.

Code:
$ sockstat
USER  COMMAND  PID  FD PROTO  LOCAL ADDRESS  FOREIGN ADDRESS
Code:
$ sockstat |grep unison
root  unison  800  3  tcp6  *:55555  *:*
$ sockstat |grep 55555
root  unison  800  3  tcp6  *:55555  *:*
$

Tried adding ipv6_activate_all_interfaces="NO" near the top of /etc/rc.conf, no change.

More time will be spent on this later.
 
Solved by adding -host <IP Address>

Code:
# unison -host <IP Address> -socket 55555
server started

Code:
$ sockstat|grep 55555
root  unison  792  3  tcp4  <IP Address>:55555 *:*
$

Code:
$ unison -help|grep -i 'host xxx'
 -host xxx  bind the socket to this host name in server socket mode
 
This issue is similar to a snag I once encountered using mount_smbfs(8).
# Command to create local mount of remote share
Code:
~]# mount_smbfs -I <IPv4-address> \
> //<remote-username>@<remote-hostname>/<remote-share-name> \
> /mnt/<dir-mapped-to-remote-share>

# System prompt
Code:
Password: [<remote-username-password>

# Connection fails with message
Code:
mount_smbfs: unable to open connection: syserr = Connection reset by peer

# Solution
<remote-hostname> must be the hostname of the machine you're attempting to connect with.

If you use an IP address in place of a valid network hostname, it appears the local FreeBSD system interprets the first octet (of the IP) as the hostname of a fully-qualified name.

L
 
Last edited by a moderator:
Back
Top