We all know that ping is the most common way to establish layer 3 connectivity. Layer 1 connectivity is established by link light. Layer 2 connectivity is establish by checking if link protocol shows as up (or you see the MAC address), but how about non-ethernet layer 2 connectivity? How about layers 4, 5, 6, and 7?

So, the question is: What are common ways to unequivocally establish connectivity at layers 2, 4, 5, 6, and 7?

Some ideas that pop into my head:

1) telnet to port 80/443 for layer 7 connectivity

2) use netcat (how?)

  • I'm assuming by establish you mean confirm? – joeqwerty Aug 18 '15 at 20:49
  • 1
    This question is too broad. Entire bookshelves have been written on the subject. My personal favourite is amazon.com/TCP-Illustrated-Vol-Addison-Wesley-Professional/dp/… – ErikE Aug 18 '15 at 21:09
  • 1
    Your basic assumptions are flat-out wrong. ping is a crap diagnostic tool (failing ping doesn't mean a problem exists) and so is telnet to port 80 on a mail server. – Sven Aug 18 '15 at 21:16
  • Adding to Svens comment, successful ping does not mean layer 2 is functioning either. Seen a faulty NIC driver screw only certain application traffic up, ping and other basic connectivity tests indicated the problem was higher up in the stack. Iterating the bejesus out of the OSI model is the only unequivocal way, together with knowing the network stack and applications one got stuck with. – ErikE Aug 18 '15 at 22:03
  • @ ErikE: This is not broad; the question asks for a specific answer for each layer. As a matter of fact, you clearly have forgot (or never understood) the fundamentals. If a ping between two hosts is successful, then 100% guaranteed layer 2 is also established since the packet is encapsulated within a frame. "Ping and other basic connectivity tests indicated the problem was higher up in the stack" <- This is 100% incorrect, as ICMP resides at layer 3 and has no exposure to higher layers. I highly recommend you refresh your understanding of basic layer2/3 communication. – lobi Aug 19 '15 at 22:34

If you are debugging connectivity(Layer 3) you need ping and traceroute.

If you want to check open ports you need tcptraceroute(Layer 4 TCP) or nmap (Layer 4 TCP/UDP), but it's pretty hard to debug UDP.

openssl s_client -connect will help you to debug SSL(Layer 5).

For everything else use tcpdump/tshark.

| improve this answer | |
  • Thanks Navern, this is exactly the kind of answer I was looking for. Will wait for other answers before marking this. – lobi Aug 20 '15 at 2:12

Layer 2 requires layer 1 and layer 3 requires layer 2. Everything above that requires a functioning transport layer (3) and therefore tests above that are application specific and will vary between what type of service you are running.

Like you have already said, telnet which is an application so layer 7 is a handy way of testing socket connectivity between devices. It also requires all layers below it to be working and therefore I would call it a complete test of all the layers involved to have a working IP network.

| improve this answer | |
  • Thanks Tom. I agree that successful connectivity of telnet/netcat/etc @ layer 7 proves all lower layers to be working, however I am specifically interested in connectivity tests per individual layer. I am not a developer, however I would imagine that there must be a way for a developer to troubleshoot connectivity between layer 5-6, for example. Of course it is possible that there is simply no way to test connectivity at layers 5/6, and it can only be done via establishing layer 7 connectivity. – lobi Aug 19 '15 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.