Issue with Console Access to Switch Using Socat: Command Echoing

100 Views Asked by At

I'm attempting to connect to a switch through the console using the following socat command:

socat tcp4-listen:5050,reuseaddr,fork file:/dev/ttyUSB1,nonblock,raw,echo=0

However, when connecting to it from an external source using Telnet, I encounter the following problem:

Trying 192.168.50.10...
Connected to 192.168.50.10.
Escape character is '^]'.

SW1# 
SW1# ss
ss
% Command incomplete: ss
SW1# 
SW1# 

The command prompt echoes, and the commands are printed twice. Even the commands I send are echoed back.

When I connect with nc, I encounter the following issue:

SW1# sss
sss
% Unknown command: sss
SW1# 

It re-echos the entered command.

I would appreciate guidance on how to resolve this issue.

i use echo=0 to solve this but it didn't work.

1

There are 1 best solutions below

0
mehran rahnama On

After extensive research, I found an alternative tool for socat called ser2net. I implemented a server console by adding the following configuration in the /etc/ser2net.conf file:

2204:telnet:0:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT

This configuration allows you to access the console of your server over Telnet on port 2204 with the specified serial port settings.