I don't want to go far in to details, because I know you should not use telnet but ssh instead, however in my situation I need to use telnet.
Basically, I have a Ubuntu server 18.04.1 and I have a web page hosted on it. The web page is specifically for configuring routers and sending them commands through telnet(it is a django site, and commands are sent by python's telnetlib). The problem is, I need to telnet using the telnet's default port 23.
I have checked that telnet is installed and I checked that I can telnet, for example, telnet google.com 80 works, however if I write telnet ip_of_router 23 I get this output.
telnet: Unable to connect to remote host: No route to host
Next thing I tried was to open port 23, both through sudo ufw allow 23 and using iptables: sudo iptables -A OUTPUT -p tcp --dport telnet -j ACCEPT. No success.
What else I need to do so I can telnet ip_of_router 23?
I have added a listener to port 23 like this: sudo nc -lk 23 & and checked with netcat client if port 23 is open: nc -v localhost 23.
It outputted: nc: connect to localhost port 23 (tcp) failed: Connection refused. Connection to localhost 23 port [tcp/telnet] succeeded!
To my understanding it should have outputted one of them not both.
How can I telnet from Ubuntu server to another host using port 23? I am new to Linux, so any help is appreciated.
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default _gateway 0.0.0.0 UG 0 0 0 ens32
Server_Ip 0.0.0.0 255.255.255.0 U 0 0 0 ens32
nc -v -z <ip-of-router> 23
will also give you a "No route to host" error. Can youping <ip-of-router>
? I suspect that there is a firewall (or at least a gateway of some kind) between you and the router you're trying to reach.nc
gives you "No route to host" butping
works. What doesroute
show?