Recently I found in QNX documentation that it allows to set up message based IPC between processes on separate physical machines by using serial device (dev/serX) and it made me wonder:Is it possible in Linux to create system-wide special device for TCP/UDP tunnel? Something like nc stdin/stdout exposed publicly under /dev/something.In the end I'd like to be able to write something to such file on one machine and receive it on the other end for example:#machine1:echo Hello > /dev/somedev#machine2:cat < /dev/somedevI took a look at nc man but I didn't find any option to specify io source/destination other than stdio.
Is it possible to expose TCP tunnel in Linux as special character device?
linux;networking;pipe;tunneling;character special files
socat can do do this and many other things with things resembling streamsSomething using this basic idea should do it for you:Machine1$ socat tcp-l:54321,reuseaddr,fork pty,link=/tmp/netchardev,waitslaveMachine2$ socat pty,link=/tmp/netchardev,waitslave tcp:machine1:54321(adapted from Examples Page)If you want to encrypt, you could use a variation of ssl-l:54321,reuseaddr,cert=server.pem,cafile=client.crt,fork on machine1, and something like ssl:server-host:1443,cert=client.pem,cafile=server.crt on machine2(More about socat ssl)