Telnet is one of the oldest protocols available in the TCP/IP stack. It is used primarily to exchange data over an established connection between a server and client. It uses TCP port 23 in the server for listening to the incoming connection from the client.
In our case, we will create a Python script that acts as a telnet client, and other routers and switches in the topology will act as the telnet server. Python comes with a native support for telnet via a library called telnetlib so we don't need to install it.
After creating the client object by instantiating it from the Telnet() class, available from the telnetlib module, we can use the two important functions available inside telnetlib, which are ...