linux centos7上安装telnet

1、查看是否安装了相关软件:

rpm -qa|grep -E "telnet|xinetd"

显示结果含有以下三个软件,则表示已经安装,否则需要安装缺失的软件 
telnet-server-0.17-60.el7.x86_64 
telnet-0.17-60.el7.x86_64 
xinetd-2.3.15-13.el7.x86_64

2、安装缺失的软件:

sudo yum install telnet telnet-server xinetd

3、注册使用服务:

sudo systemctl enable telnet.socket  
sudo systemctl start telnet.socket  
sudo systemctl enable xinetd  
sudo systemctl start xinetd 

4、开启防火墙的23端口: 
具体防火墙使用可以参见:http://www.cnblogs.com/moxiaoan/p/5683743.html

sudo firewall-cmd --zone=public --add-port=23/tcp --permanent  
sudo service firewalld restart  

5、xinetd启动成功,可以查看xinetd的运行情况。【非必须】

[root@iZ94imebuqwZ ~]# netstat -tnlp          【或使用netstat -tnl | grep 23只查看目标端口

Active Internet connections (only servers)
Proto   Recv-Q   Send-Q   Local Address          Foreign Address         State        PID/Program name   
tcp          0        0   0.0.0.0:11211          0.0.0.0:*              LISTEN        1866/memcached
tcp          0        0   0.0.0.0:22             0.0.0.0:*              LISTEN        343/sshd
tcp          0        0   0.0.0.0:23             0.0.0.0:*              LISTEN        8923/xinetd
[root@iZ94imebuqwZ ~]#
[root@iZ94imebuqwZ ~]#
[root@iZ94imebuqwZ ~]# telnet localhost 23
Trying ::1...
Connected to localhost.
Escape character is '^]'.
CentOS release 5.10 (Final)
Kernel 2.6.18-371.11.1.el5 on an x86_64
login:

[hadoop@mini3 ~]$ netstat -tnlp   
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:50020           0.0.0.0:*               LISTEN      3872/java           
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:50010           0.0.0.0:*               LISTEN      3872/java           
tcp        0      0 0.0.0.0:50075           0.0.0.0:*               LISTEN      3872/java           
tcp6       0      0 :::22                   :::*                    LISTEN      -                   
tcp6       0      0 :::23                   :::*                    LISTEN      -                   
tcp6       0      0 ::1:25                  :::*                    LISTEN  

6、备注:虚拟机如果和主机进行测试,需要将网络模式修改为2. Bridged Adapter,具体参见:http://blog.csdn.net/ixidof/article/details/12685549

猜你喜欢

转载自blog.csdn.net/ANightEagle/article/details/82292390