Originally Posted by solarisdon
How to make the port 7001 listen to the telnet request.
program (if that is what you are using) cannot listen on an arbitrary port if you start it with inetd
, the normal way it is started. So I believe your only other choice is to use iptables
to redirect the request:
iptables -t nat -A PREROUTING -d <your IP address> -p tcp --dport 7001 -j REDIRECT --to-ports 23
If this is all you do, then telnetd
can be accessed at both
tcp/23 and tcp/7001. If you don't
want it to receive requests on tcp/23, then that must be blocked. I don't have a lot of experience with REDIRECTS, but I don't think you can do this in the netfilter
INPUT chain, as I believe that would block even the REDIRECTs. What might
work to block external access to tcp/23 is:
iptables -t nat -A PREROUTING -d <your IP address> -p tcp --dport 23 -j DROP.