User Tools

Site Tools


linux:debug_connections

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:debug_connections [2022/09/26 13:27]
manu created
linux:debug_connections [2023/02/25 18:18] (current)
manu
Line 1: Line 1:
 ====== Test connection IP on specific port ====== ====== Test connection IP on specific port ======
 +
 +Find all IPs available in a range:
 +<cli prompt='#'>​
 +[root@lnx01 ~]# nmap -sn 192.168.0.0/​24
 +</​cli>​
 +
 +Scan on specific ports:
 +  # nmap -sV -p 22,443 192.168.0.0/​24
 +
 +Which port is open
 +<cli prompt='#'>​
 +manu-opensuse:/​ # nmap -sT -p- 192.168.x.xxx
 +Starting Nmap 7.92 ( https://​nmap.org ) at 2023-02-25 18:16 CET
 +Nmap scan report for 192.168.x.xxx
 +Host is up (0.0018s latency).
 +Not shown: 65520 closed tcp ports (conn-refused)
 +PORT      STATE SERVICE
 +53/​tcp ​   open  domain
 +80/​tcp ​   open  http
 +443/​tcp ​  ​open ​ https
 +...
 +MAC Address: 2x:xx:xx (aaaaa SAS)
 +
 +Nmap done: 1 IP address (1 host up) scanned in 8.34 seconds
 +</​cli>​
  
 <cli prompt='#'>​ <cli prompt='#'>​
Line 8: Line 33:
 </​cli>​ </​cli>​
  
 +Test a port which is listening
 <cli prompt='#'>​ <cli prompt='#'>​
 [root@lnx01 ~]# nc -v lnx02 80 [root@lnx01 ~]# nc -v lnx02 80
Line 21: Line 47:
 </​cli>​ </​cli>​
  
 +Test a port which is not open
 +<cli prompt='#'>​
 +[root@lnx01 ~]# nc -v lnx02 3333
 +Ncat: Version 7.50 ( https://​nmap.org/​ncat )
 +Ncat: No route to host.
 +</​cli>​
 +
 +Test a port which is listening
 <cli prompt='#'>​ <cli prompt='#'>​
 [root@lnx01 ~]# telnet lnx02 80 [root@lnx01 ~]# telnet lnx02 80
Line 26: Line 60:
 Connected to lnx02. Connected to lnx02.
 Escape character is '​^]'​. Escape character is '​^]'​.
 +</​cli>​
 +
 +Test a port which is not open
 +<cli prompt='#'>​
 +[root@lnx01 ~]# telnet lnx02 888
 +Trying...
 </​cli>​ </​cli>​
  
Line 60: Line 100:
 </​cli>​ </​cli>​
  
 +If you only want to know if the port is open, simply use:
 +<cli prompt='#'>​
 +# nc -vz www.microsoft.com 80
 +</​cli>​
 +
 +You can also use netcat to verify if  UDP ports are open:
 +<cli prompt='#'>​
 +# nc -vz -u 8.8.8.8 53
 +</​cli>​
 +
 +And netcat can be used as a port scanner:
 +<cli prompt='#'>​
 +# nc -vz <​hostname or ip address> 1-1000
 +</​cli>​
linux/debug_connections.1664191640.txt.gz ยท Last modified: 2022/09/26 13:27 by manu