How to open a port in Linux and how to check already open ones?

Ports in any system located in a common network hierarchy play the role of connecting elements. Knowing which one is open or closed, an application from one node can send a message to the same application on another. Why and how you can open the port in Linux, this article will tell.

Bit of theory

The port is expressed by a number from 0 to 65535. Many values ​​are registered for official needs, some can be used arbitrarily. The port defines a kind of address refinement. For example, a certain resource has a web server running at home.

open linux port




, , , , IP. , , ? . , , IP- , .

- , , , . - .





0 1023 :

  • 21 - FTP;
  • 22 - SSH;
  • 23 - Telnet;
  • 25 - ;
  • 80 - HTTP . -;
  • 110 - POP3 ( ).

. .

linux check open ports




Linux

. , Linux . — netstat.

: sudo netstat -ntulp

:

  • -l. , , ;
  • -p. , . , ID ;
  • -t. TCP ;
  • -u. , UDP;
  • -n. IP .

Linux

- -, . , , . , .

linux which ports are open




iptables. , , : iptables --list

, , . Linux. :

iptables -A INPUT -p tcp -m tcp --dport 53 -j ACCEPT

, . INPUT , . -p , , TCP. Dport , - 53. ACCEPT — .

iptables , Linux.




All Articles