Contents
- 1 Which ports can I use?
- 2 Which ports should be disabled?
- 3 What can you do to prevent a port scan?
- 4 Can I use any port for anything?
- 5 Why do I keep getting port scan attacks?
- 6 How does the server find out what client port to send to?
- 7 Is the port number bound to a listening process?
- 8 How to explicitly assign port number to client in socket?
Which ports can I use?
Ports 0 through 1023 are defined as well-known ports. Registered ports are from 1024 to 49151. The remainder of the ports from 49152 to 65535 can be used dynamically by applications.
Which ports should be disabled?
For example, the SANS Institute recommends blocking outbound traffic that uses the following ports:
- MS RPC – TCP & UDP port 135.
- NetBIOS/IP – TCP & UDP ports 137-139.
- SMB/IP – TCP port 445.
- Trivial File Transfer Protocol (TFTP) – UDP port 69.
- Syslog – UDP port 514.
What is my client port?
All you have to do is type “netstat -a” on Command Prompt and hit the Enter button. This will populate a list of your active TCP connections. The port numbers will be shown after the IP address and the two are separated by a colon.
What can you do to prevent a port scan?
The main defense against port scanning is to use a good firewall. Most quality routers will have a firewall built in but I also suggest running a software firewall on every device that connects to the internet. A firewall will block anonymous requests so will not reply to a random scan from the internet.
Can I use any port for anything?
Every protocol has a different default port, but programs are not required to use that. They can use any unused port between 1 and 65535 (16 bits unsigned = 2^16). Here is a list of default port numbers for all protocols based on TCP and UDP.
Why would you block ports?
One of the original and enduring motivations for blocking ports is to prevent network attacks and abuse associated with particular application protocols. Port blocking can also cause applications to not function properly or “break” by preventing applications from using the ports they were designed to use.
Why do I keep getting port scan attacks?
Short explanation on portscans and attacks: Most portscans scan the lower well known ports (Well known ports) to find services (e.g. FTP servers, SMTP servers, etc) so they can exploit them to get access to the machine.
How does the server find out what client port to send to?
The port number is always bound to a listening process. Since only the server is listening for incoming connections, we don’t need to bind on the client side The server will keep on listeninig on that port number. The client will send a connect () request.
Why do we need to specify a port number while..?
We already know that while using HTTP the request will be served at port 80, so why do we specify a port explicitly? The default port for HTTP is 80 and HTTPS is 443 but port numbers range from 0 to 65535. Most web servers listen on the default port so it’s simpler to refer to the URL without the port.
Is the port number bound to a listening process?
The port number is always bound to a listening process. Since only the server is listening for incoming connections, we don’t need to bind on the client side. The server will keep on listeninig on that port number. The client will send a connect() request.
How to explicitly assign port number to client in socket?
Some protocol like NFS protocol requires client program to run on only certain port number and so in this case, client need to forcefully assigned that port number only as it runs on port number either on 111 or on 2049. This can be done using bind () system call with specifying particular port number in client side socket.