Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to solve the problem that the port of linux is blocked?

Shulou Source: shulou.com Published: 2022-06-02 21:50:10 10月04日 Update

How to solve the problem that the port of linux is blocked? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

All linux systems have network firewall settings. If the firewall is turned off, as long as a certain port on the linux has a certain service, then this port can be connected to telnet. The premise that a certain port of telnet can be connected is that the port is in service, and the firewall allows access to the port.

Let's talk about how to solve the problem of blocked ports.

The required port settings can pass through the firewall:

The way to set a port to pass through the firewall is as follows:

Vi / etc/sysconfig/iptables

Go to the editing page and add the following configuration at the specified location

-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 8080-j ACCEPT

This sentence should be put after-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 22-j ACCEPT

After modification, save and exit, restart the network card service.

Service iptables restart

View port opening information

Service iptables status

Generally speaking, the server can see the open information even if it is opened successfully.

Determine whether a port is in service

Netstat-anp | grep "port number to be viewed", such as netstat-anp | grep "9001"

If 9001 is set up in / etc/sysconfig/iptables to pass through the firewall and the service is started again, then other computers in this network segment will be able to telnet port 9001 of the machine. You can also check whether telnet localhost 9001 can be connected by telnet on this computer.

If you purchased the server, you also need to set the port release in the security group.

After reading the above, have you mastered the solution to the problem that the port of linux is blocked? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Port service firewall fire prevention problem method open information content more server security success helpless for this location premise reason slogan can be passed through Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft vpn Shulou Technology OPPO Reno NVidia