Solve Problems Related to the failure of Connecting ports in CentOS

Source: Internet
Author: User

Solve Problems Related to the failure of Connecting ports in CentOS

Recently, when setting up a CentOS service, port 22 is always unavailable and port 22 of Windows Telnet cannot be accessed. In CentOS, netstat-lnpt checks that port 22 is not monitored, therefore, the online Search solution can be used, but none of them can solve the problem.
Now we will solve it step by step.

I. Add port 22 to iptables
1. To open ports 8080, 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 file
Vim/etc/rc. d/init. d/iptables
Add the preceding text
3. Save:
/Etc/rc. d/init. d/iptables save
4. view the opened Port:
/Etc/init. d/iptables status
5. Restart
5.1/etc/init. d/iptables restart (temporarily valid)
5.2 chkconfig iptables off/on (permanently valid)

The preceding steps show how to add a port.
Try Telnet now. First, check whether listening is enabled on the CentOS local netstat-lnpt port. If listening is enabled, try it.

If it is not successful, perform the following steps:
Ii. Restart Port
Run the command:/etc/init. d/sshd restart
Many links are based on ssh connections, so you need to restart them through sshd.
Then, run netstat-lnpt to check the port listening status.
Telnet successful!

The above is my experience and hope to solve your problem. Thank you!

Tips: The ntsysv command has a surprise.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.