© 2001-2014, BSDforge (BSDforge.com © Anton Voronin (anton@urc.ac.ru), 2000-2001.
The package consists of two programs - PortRedorector and PortTest
PortRedirector is a daemon that runs telnet to the remote port of a terminal server and redirects its input and output to a virtual terminal device (/dev/pty*). The corresponding slave device (dev/tty*) then can be used by an application that expects a local async terminal port.
Although this approach doesn't let it pass line signals (CD, DCR, etc) or manipulate them via ioctl calls, most applications don't need it. For example, I successfully use this tool to monitor UPS units (connected to AUX ports of Cisco routers) with the nut software on a UNIX server.
Whenever a telnet subprocess terminates for any reason, it is restarted as soon as any data is received from the terminal device.
Upon receiving SIGTERM, PortRedirector terminates the telnet subprocess and terminates itself.
If you prefer to restrict access to your terminal server's port, PortRedirector can enter username and password when establishing a connection with it. Username, password and the prompt strings to wait for, before sending them are specified in the configuration file (by default, /usr/local/etc/PortRedirector.conf). Be sure to keep this file secured (unreadable for regular users).
The process id for each daemon is stored by default in /var/run/PortRedirector-devname, where devname is the terminal device file it uses. The location can be changed in the configuration file.
PortRedirector [-f configfile] device host [port]
where configfile is an alternative configuration file; device is a master device (/dev/pty*) corresponding to the terminal device you will then specify to a client application (/dev/tty*); host is a hostname or ip address of the access server; port is a tcp port that the access server maps to it's physical port you need access to. If port is not specified, PortRedirector connects to a standard telnet tcp port 21 (useful for test purposes).
After it's running, you can test the connection using the cu program, or the PortTest script. For example (assuming you have specified device /dev/ptyq0 to PortRedirector):
cu -l /dev/ttyq0or
PortTest /dev/ttyq0
Please see Port Redirector home page, for further details