hardburn has asked for the wisdom of the Perl Monks concerning the following question:

I'm looking for a way to control an ICMP packet to send arbitrary information in the data section of an echo-request, but preferably without having to build the raw packet on my own. Net::ICMP isn't low-level enough for this. The man page for 'ping' on my box says that there is a switch for sending a few bytes of aribitrary data (I'm not at a *nix box right now, so I'm not sure what switch it is), but I would like more fine-grained control over it. Something like Net::RawIP is lower than I want to go.

Control over some of the other sections (like the identifier or sequence number in a timestamp request) would also be nice, but the I'll settle for aribitrary data in an echo request.

Any way of doing this without building raw ICMP?

Replies are listed 'Best First'.
•Re: Low-level ICMP control
by merlyn (Sage) on Jan 31, 2003 at 15:22 UTC
Re: Low-level ICMP control
by hardburn (Abbot) on Jan 31, 2003 at 15:03 UTC

    Update: Suddenly, hardburn realizes that there is no such thing as Net::ICMP. There is a Net::Ping, though (which is what he meant).

Re: Low-level ICMP control
by elwarren (Priest) on Feb 02, 2003 at 15:22 UTC
    This has been done with packet and ham radio. Couldn't find the link, but google still had it in cache... ID'ing via ICMP Echo Request Packets


    It's possible to transmit data in ICMP ECHO request and ICMP ECHO reply messages (commonly referred to as ICMP tunneling). Embedding your callsign in a ping packet that is sent out every 10 minutes is a very easy and legal way to identify your reclassified Part 97 wireless network.

    Reviewing the Unix ping on-line manual page shows us that the data may be set with: -p (pattern). You may send up to 16 characters (including spaces) per ping packet. This pattern must be specified as hexadecimal digits.

    Example looped ID script:
    #!/bin/sh while true do /bin/ping -c 1 -s 21 -p 574952454C455353204E4F4445 44.92.20.35 # WIRELESS NODE /bin/ping -c 1 -s 24 -p 464343204152532043414C4C5349474E 44.92.20. +35 # FCC ARS CALLSIGN /bin/ping -c 1 -s 22 -p 204B42394D575220464F52204944 44.92.20.35 # KB9MWR FOR ID sleep 600 done
    Wireless ethernet communications are considered as using a specified digital code to communicate because commercial products are available that facilitate the transmission and reception of the communications and the technical characteristics of wireless ethernet are publicly documented.

    The rules no longer really specify how you must ID. Using this method, your callsign will be encapsulated inside an ethernet frame. This conforms with 97.119(b)(3) for specified data emission codes [see 97.309 (3) & (4)]. This is a perfectly reasonable and acceptable method, anyone with a sniffer or running dump on the link will be able to see your callsign:

    eth1: len 60 00:40:05:44:55:61->00:00:c0:40:0f:25 type = IP
    IP: len 42 44.92.20.38->44.92.20.35 ihl 20 ttl 64 prot ICMP
    ICMP: type echo request id 54377 seq 0
    Öùù KB9MWR FOR ID
    
    Keep in mind this is just one example of how to fulfill the identification requirement. You may use any other reasonable method you can come up with or an other method that is publicly documented, which can be fulfilled by explaining your method on your internet webpage, as I have just done, for example.

    edited: Sun Feb 2 17:40:26 2003 by jeffa - changed pre to code — formatting