Recently, when building a CentOS service, found that 22 ports are always unavailable, and Windows Telnet 22 port is not available, under CentOS NETSTAT-LNPT Check Port 22 is not listening, so the online search solution, but none can solve.
Now gradually resolved.
One, iptables add 22 ports
1. If you want to open the 22,80,8080 port, enter the following command
/sbin/iptables-i input-p tcp–dport 80-j ACCEPT
/sbin/iptables-i input-p tcp–dport 22-j ACCEPT
/sbin/iptables-i input-p tcp–dport 8080-j ACCEPT
2. Modify the document
Vim/etc/rc.d/init.d/iptables
Add the above text
3. Save:
/etc/rc.d/init.d/iptables Save
4. View open ports:
/etc/init.d/iptables status
5. Reboot
5.1/etc/init.d/iptables Restart (temporary effective)
5.2 Chkconfig iptables off/on (permanently valid)
The above completes the add port.
Now try Telnet, first centos the local NETSTAT-LNPT check whether the port is open for listening, and if you're listening, try it.
If this is not successful, step two:
Second, restart the port
Run command:/etc/init.d/sshd restart
Many links are based on SSH links, so they need to be restarted via sshd.
Then NETSTAT-LNPT view the Port monitor.
Finally telnet succeeded.
The above is my experience to share, hope can solve your problem, thank ^_^
Tips: Order Ntsysv to have a surprise