-1

In network communication if PC1 is sending request to perform task on PC2 then PC2 respond with result to PC1, who (PC1 or PC2) needs to open port? or both needs to open port?

I am setting up nagios Core with NRPE and NSClient++ and I am unclear which system is required to open port. and what port numbers are required to open on client and server?

Ashif Nataliya
  • 912
  • 2
  • 13
  • 28
  • 'Server is initiating request' is already a contradiction terms. Clients initiate requests: servers respond to them. – user207421 May 24 '18 at 12:05
  • @EJP Ok. what i meant by server is "Nagios server computer" sends request to client computer to perform some action. Client computer respond with result. I will rephrase my sentence – Ashif Nataliya May 24 '18 at 12:22
  • 1
    **PC2** needs to have an *open* and *listening* port and a running *server process* listening on this port. These 3 requirements are distinct and must be carefully checked because network topologies and virtualization is full off magic. You need to check on **openness** at the client machine software os firewall, at the client machine physical router firewall, at the server machine physical router firewall, and finally at the server machine os software firewall. Openness requires both **inbound** and **outbound** to be open. – daparic Mar 15 '19 at 09:32

1 Answers1

0
  • They both need to open ports.
  • Port numbers need to be chosen from available ports (typically > 1024).
  • Client needs to know the Server's port number in order to initiate the communication.

I don't know anything regarding your environment or use case. But above 3 lines hold for any kind of socket communication.

Emut
  • 319
  • 4
  • 10
  • 4
    I don't understand what you mean by `They both need to open ports.`. From what I know, only the server needs to open a port and the evidence or proof of this can be verified by running `nc -w 5 -z server_ipaddr_here server_port_here` from the client machine. When the client successfully establishes a tcp connection to the server, the client will dynamically create a port using a system randomly choosen integral number. Both this randomly integral number from the client side and the fixed port number on the server side forms the connection. But the client side port is definitely **not** open. – daparic Mar 15 '19 at 09:08