In Windows, I go to command line and 'telnet ' to check the port. How to do the same in Unix?
It seems some people using 'tcpdump port ' commands. Is this monitoring the real time traffic? Thanks.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
nmap is a great general-purpose tool for such things and much else.
nmap host.domain.tld (or
nmap host for a local machine, or
nmap <ipaddr> to check a machine by address not name) will list what common ports are open.
nmap 192.168.23.1-254 -p 22,80,443 will scan a range of hosts by address to see if the TCP ports usually associated with SSH, HTTP and HTTPS are open.
man nmap for many more options - it is the kitchen sink of network checking tools.
You may not have nmap installed at the moment, but it is in just about all distros standard repositories. For debian or ubuntu variants
aptitude install nmap to install it, or find it in the GUI package manager of your choice. If it isn't available easily on your system, get it and more info from http://nmap.org/
You could also just use the same
telnet client technique that you are already familiar with as that is available too and usually installed in one of the default packages, but
nmap is a tool worth getting to know as it can be helpful for diagnosing network issues, just checking that things are as they should be, and so on. There are also a few decent graphical front-ends to it, if you would prefer to interact with it away from the command line.
If you're using bash, then the man pages state that you could write to /dev/tcp/HostNameOrIP/port. I've used this a few times and if the remote port is open, then there is no response. If the system cannot connect to the remote port, then it states the reason
[kevin@box ~]$ echo -n > /dev/tcp/www.yahoo.com/80 [kevin@box ~]$ nslookup www.no-such-domain.com Server: 127.0.0.1 Address: 127.0.0.1#53 ** server can't find www.no-such-domain.com: NXDOMAIN [kevin@box ~]$ echo -n > /dev/tcp/www.no-such-domain.com/80 -bash: www.no-such-domain.com: Name or service not known -bash: /dev/tcp/www.no-such-domain.com/80: Invalid argument [kevin@box ~]$ echo -n > /dev/tcp/192.168.3.3/80 #no such server on my network -bash: connect: No route to host -bash: /dev/tcp/192.168.3.3/80: No route to host [kevin@box ~]$ echo -n > /dev/tcp/192.168.3.1/88 #nothing listening on port 88 -bash: connect: Connection refused -bash: /dev/tcp/192.168.3.1/88: Connection refused [kevin@box ~]$