I'm trying to access a remote serial console (a tty port on a remote machine) as if it's on a local machine. This is necessary for a serial-port only application to work on my machine. The remote tty is not directly accessible. It is behind an OpenGear and I can connect to the actual tty only with telnet. If necessary I could drop the OpenGear just to confirm that things work without it in the middle.
I want to tell my application to use a local device like /tmp/my_virtual_tty and connect to the OpenGear telnet port transparently.
What works:
$ telnet remote_telnet remote_port
$ socat TCP:remote_telnet:remote_port TCP-LISTEN:10023
$ telnet localhost 10023
What doesn't work (nothing seems to get exchanged) but I wish it would:
$ socat tcp-connect:remote_telnet:remote_port PTY,link=$HOME/dev/vmodem0
$ screen $HOME/dev/vmodem0
The same thing with remserial:
$ remserial -d -r remote_telnet -p remote_port -l $HOME/dev/vmodem0 /dev/ptmx
$ screen $HOME/dev/vmodem0 .... # doesn't work either
This doesn't work either but since I did not specify any tty speed anywhere it might make sense:
$ screen $HOME/dev/vmodem0 115200
I tried raw/rawer options with socat and played with raw options of OpenGear without success. My questions are: what am I not seeing and what is the actual solution for remote serial port forwarding/tunneling?