Connecting to a computer that is behind NAT

I have an office (5 Windows PCs) and a server room (3 servers).
I use IPFS on all computers and servers. The server room has a public IP address. But I’m not in the office and all the computers are behind NAT. Now I have a task - I need to connect to an office computer and establish a WebSocket connection. Of course, I used to use VPN from the office to the server, but now I can’t use VPN on my server and I decided to take advantage of libp2p. First I tried to ssh from the server to the office computer.
Server(Public İP) > ipfs p2p listen /x/ssh /ip4/127.0.0.1/tcp/22
OfficePC(behind NAT)> ipfs p2p forward /x/ssh /ip4/127.0.0.1/tcp/2222 /p2p/server_id
OfficePC(behind NAT)> ssh user@127.0.0.1 -p 2222
Everything worked out.

But when I did the opposite, trying to connect ssh from my office computer.
OfficePC(behind NAT)> ipfs p2p listen /x/ssh /ip4/127.0.0.1/tcp/22
Server(Public İP)> ipfs p2p forward /x/ssh /ip4/127.0.0.1/tcp/2222 /p2p/server_id
Server(Public IP)> ssh user@127.0.0.1 -p 2222
Doesn’t work and no connection!!!

command > ipfs config --json Experimental.Libp2pStreamMounting true executed on both computers.
ipfs version 0.26.0 on both computers.

Also I used the chat example from the go-libp2p repository
which also works when I connect to the server from the office, but does not work when I connect from the server to the office computer.

Tell me what am I doing wrong and what could be the problem?

Hello @Adl ,

That’s an interesting problem. I’m not exactly sure why the ssh stream mounting seems to only work in one direction. Since you’re experimenting with kubo (ipfs) directly, maybe you should direct your question to the IPFS discussion forums. You’d probably have better luck there.

Cheers! :beers:
Dave