This is our old Q&A Site. Please post any new questions and answers at

Hi, my first post in here. I made lots of search but couldn't find useful info about how create ICMP Code-3 (dest. unreachable) error and capture it with Wireshark. I tried to ping a closed port in Linux machine and also used host command but nothing. Could anyone help me about this please? Thank you.

asked 22 Apr '14, 04:10

erer's gravatar image

accept rate: 0%

You need a router (Linux) that does not know how to forward a frame to a destination network (network unreachable), or that does not get an ARP reply (Host unreachable).

Sample setup:

client []  ---- [] eth0 :: router :: eth1 []

Set the following routes


  • route add mask
  • route add mask


  • enable IP Forwarding: sysctl net.ipv4.ip_forward=1
  • don't set a default route!!: route delete default

Now, ping the following IP addresses from the client:

  • ping :: you will get a ICMP Destination unreachable (Host unreachable)
  • ping :: you will get a ICMP Destination unreachable (Network unreachable)


permanent link

answered 22 Apr '14, 05:40

Kurt%20Knochner's gravatar image

Kurt Knochner ♦
accept rate: 15%

edited 22 Apr '14, 06:44

Big thanks Kurt. This is awesome and very straight forward answer. Cant wait to try it :)

(22 Apr '14, 06:50) erer

Hint: If a supplied answer resolves your question can you please "accept" it by clicking the checkmark icon next to it. This highlights good answers for the benefit of subsequent users with the same or similar questions.

(22 Apr '14, 07:31) Kurt Knochner ♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 22 Apr '14, 04:10

question was seen: 16,916 times

last updated: 22 Apr '14, 07:31

p​o​w​e​r​e​d by O​S​Q​A