BSD Newsletter.com
   Front | Info | Lists | Newsfeeds | Study Guide | What is BSD?
Advertisement: The OpenBSD PF Packet Filter Book: PF for NetBSD, FreeBSD, DragonFly and OpenBSD

BSD Links
·New Links
·Advocacy
·Drivers
·Events
·Flavours
·FAQs
·Guides
·Programming
·Security
·Software
·User Groups

This is the BSDA Study Guide Book written via a wiki collaboration. This is a work in progress. You may contribute to or discuss this specific page at http://bsdwiki.reedmedia.net/wiki/Verify_the_availability_of_a_TCP--IP_service.html.

Verify the availability of a TCP/IP service

Concept

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.

Introduction

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.

Examples

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 freebsd.org
PING freebsd.org (69.147.83.40): 56 data bytes
64 bytes from 69.147.83.40: icmp_seq=0 ttl=47 time=216.248 ms
64 bytes from 69.147.83.40: icmp_seq=1 ttl=48 time=227.884 ms

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

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

www is work on freebsd.org and ssh is too. Also we can see that freebsd.org 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 ya.ru
traceroute to ya.ru (213.180.204.8), 64 hops max, 40 byte packets
 1  192.168.1.1 (192.168.1.1)  0.431 ms  0.402 ms  0.351 ms
 2  vpn13-l0.msk.corbina.net (10.1.1.1)  17.084 ms  22.738 ms  18.418 ms
 3  hq-bb-giga2-12.msk.corbina.net (85.21.151.113)  19.142 ms  15.753 ms  29.292 ms
 4  yandex-gw.corbina.net (85.21.52.222)  11.958 ms  18.624 ms  22.089 ms
 5  ya.ru (213.180.204.8)  21.116 ms  21.629 ms  20.597 ms

In this case all host in route to ya.ru 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



Front | Information | Lists | Newsfeeds