1

I have developed an application that partially replicates the functionality of the builtin ping application, essentially sending an ICMP packet, receiving the response, and parsing the header.

However, I want to report any error messages received. The problem I'm running into is trying to ping a host/address in such a way that I get ICMP type 3 with some type of ICMP code (presumably codes 0-7, but I'm not picky).

I've tried pinging a bogus address on a different, nonexistent, thinking my router will send out this message, but it doesn't happen, it just times out. Windows ping behaves the same way though.

Aside from setting up a linux box running a service that responds to all pings with type 3 and random codes, is there a way I can test this functionality? Are these codes arcane, obsolete, or otherwise not used?

4
  • This question comes across sounding suspiciously like a homework question, which is off topic here. If it is not school work, please edit your question to provide more context about why you are asking and it will automatically start a reopen vote. You may find our Question Checklist helpful to improve your question.
    – YLearn
    Nov 18, 2015 at 15:51
  • @ylearn it is in reference to a homework question. However, I'm not asking for help with my homework, so I suppose that portion of the question can be edited out, however I think testing my application is different from asking how do I do my homework, as the way my question stands it is not only serving me but a broader range of people who may need to test ICMP in any capacity.
    – MDMoore313
    Nov 19, 2015 at 0:55
  • The unfortunate part of homework questions is that we don't know what the assignment involves and we only have the word of the person asking the question and providing details. In this case, we don't know that the assignment doesn't include coming up with a way to test the functionality as well or that the intent of the assignment isn't for the student to understand ICMP well enough to come up with their own tests.
    – YLearn
    Nov 19, 2015 at 1:08
  • @ylearn good point, didn't look at it that way, thanks
    – MDMoore313
    Nov 19, 2015 at 1:09

1 Answer 1

1

Take a look at scapy: http://www.secdev.org/projects/scapy/ and tcpdump/wireshark. With the former you can generate any ICMP packet, with the later you can see what your generated packets look like.

Your router has certainly a default route. Remove it and it should generate the ICMP messages you are looking for. Alternatively, try this command on a host that doesn't have a DNS service:

dig example.com @[host]

The server will answer with an ICMP type 3.

These codes are still in use. I would specifically look at time exceeded.

1
  • Generating an icmp packet is similar to what I need, I'll take a look at that, I'm already using Wireshark for packet sniffing and yes its an invaluable tool.
    – MDMoore313
    Nov 19, 2015 at 0:56

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