In the context of ssh, "tunnelling" has a very specific meaning. I suspect it's not the meaning you're using.
Personally, I avoid telnet as much as possible - it's both insecure (though likely not an issue in your case, I can't be sure) and annoying, compared to ssh. With ssh, I can tell it to run a single command, so it connects, runs the command, and exits, and so it behaves pretty much like running the command locally, at least from the perspective of using open to pipe from it, or IPC::Open3 to read its stdout and stderr (which is actually how I do it). Because you can't avoid the remote shell parsing the command, it is still a little bit annoying, but not like running telnet where you have to interact with a fully interactive shell, worrying about things like prompts (which can be vastly different depending on who you're running as) and pseudo-terminals (pty). With ssh, I run only one command, and I know it's finished because the subprocess exited. With telnet, it's much more annoying.
Ok, so that little rant out of the way, what I think you want is to use Expect with a command of 'ssh', '-e', 'telnet router'. I believe Expect can set up the full pty, which simplifies things for you, and then you can interact with the shell on the router just as if it were local. Note that I'm assuming passwordless ssh, though you probably can feed in the password via Expect, too.
In reply to Re: SSH Tunneling
by Tanktalus
in thread SSH Tunneling
by xomo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |