Verify the availability of a TCP/IP service

Author: Alex Nikiforov FreeBSD

Reviewer: name contact BSD flavour

Reviewer: Yannick Cadin FreeBSD/OpenBSD


Be able to determine if a remote system is available via TCP/IP, and if so, telnet(1) to a particular TCP service to determine if it is responding to client requests.


Some times you need to check some network service on remote or local system. How can we do it? Firstly we must check the firewall rule, it's common error when someone check network service on remote host when your firewall block this type of request. And then you can start your test.


ping it's a most common tool for check availability host(remember some admins blocks ping). Instead of Windows system ping in BSD will ping host until you press Ctrl+C.

""# ping PING ( 56 data bytes 64 bytes from icmp_seq=0 ttl=47 time=216.248 ms 64 bytes from icmp_seq=1 ttl=48 time=227.884 ms

Now we ping and know that this server is up. Let's check service like www and ssh

""# telnet 80 Trying Connected to Escape character is '^]'. ^C Connection closed by foreign host. ""# telnet 22 Trying Connected to Escape character is '^]'. SSH-2.0-OpenSSH_4.2p1 FreeBSD-20060930 ^C Connection closed by foreign host.

www is work on and ssh is too. Also we can see that support only ssh 2(if server support 1 and 2 it will show 1.99). Not so hard but very usefull. You can use nc tool for this - check the manual.

Imagine that ping is filed but your system work fine and network work too. What's happen? May be some host in your route to destination service is down. We can check this via traceroute tool.

""# traceroute traceroute to (, 64 hops max, 40 byte packets 1 ( 0.431 ms 0.402 ms 0.351 ms 2 ( 17.084 ms 22.738 ms 18.418 ms 3 ( 19.142 ms 15.753 ms 29.292 ms 4 ( 11.958 ms 18.624 ms 22.089 ms 5 ( 21.116 ms 21.629 ms 20.597 ms

In this case all host in route to is up.

Practice Exercises

  1. Use ping and check some host for availability.
  2. Use telnet and check some service for availability.
  3. Use traceroute and check your route.

More information

ping(8), traceroute(8), telnet(1); nc(1) on FreeBSD and OpenBSD