Tuesday, January 07, 2014

How to check which ports are open on centos redhat

If a port is open, it means that there is an actively running program which uses the port number to communicate with other programs. If you want to check which ports are open on local Linux system, you can use netstat command. The following will show a list of all active ports. 

netstat -ntulp
Output of the above command will be like below showing all the ports listening.

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      1539/dnsmasq    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1178/sshd       
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1285/cupsd      
tcp        0      0 0.0.0.0:902             0.0.0.0:*               LISTEN      1832/vmware-authdla
tcp6       0      0 :::22                   :::*                    LISTEN      1178/sshd       
tcp6       0      0 ::1:631                 :::*                    LISTEN      1285/cupsd      
udp        0      0 0.0.0.0:42874           0.0.0.0:*                           1635/dhclient   
udp        0      0 0.0.0.0:40610           0.0.0.0:*                           1223/avahi-daemon: 
udp        0      0 192.168.122.1:53        0.0.0.0:*                           1539/dnsmasq    
udp        0      0 0.0.0.0:67              0.0.0.0:*                           1539/dnsmasq    
udp        0      0 0.0.0.0:68              0.0.0.0:*                           3019/dhclient   
udp        0      0 0.0.0.0:68              0.0.0.0:*                           1635/dhclient   
udp        0      0 0.0.0.0:17446           0.0.0.0:*                           3019/dhclient   
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           1223/avahi-daemon: 
udp6       0      0 :::22228                :::*                                3019/dhclient   
udp6       0      0 :::64460                :::*                                1635/dhclient   
udp6       0      0 :::49459                :::*                                1223/avahi-daemon: 
udp6       0      0 :::5353                 :::*                                1223/avahi-daemon: 

No comments:

Post a Comment

Do Write about the Blog and Welcome to the world where open source is every thing :-)