Linux Callsign Ping ID Mini-HowTo
I. This is a Mini-HowTo on how to use the Linux ping
command to transmit your callsign every 10 minutes.
II. Suffice to say your 802.11b packet will contain your
callsign in the IP Data portion of the tcp/ip packet.
Anyone monitoring your transmission will be able to
decode your callsign.
If your default gateway is the next wireless address.
Change code as necessary.
The following pingcall shell script produces a single
ping packet to your default gateway. Within the ping
payload data, is your callsign.
--------------------------------------
#
# pingcall by n9ssa@arrl.net 3.3.3 (3.march.2003)
# usage: pingcall
#
# Shell script that
# finds default gateway,
# converts supplied callsign to hex,
# and pings the default gateway once with callsign in
payload
#
#!/bin/sh
echo Pinging default gateway with callsign in payload
echo Ascii payload is $1
# Use the line below if your default gateway is a wireless
# device.
gw=`route -n | grep ^0.0.0.0 | awk '{ print $2 }'`
echo Default Gateway is $gw
hex=`printf %s "$1" | od -An -txC | sed 's/ //g'`
echo hex is 20$hex
ping -p 20$hex -c 1 $gw
------------------------------------------
III. Creating the shell script
A. Step 1: get script
Copy the lines above to a new file called pingcall
in your local directory. Save the file, then:
chmod +x pingcall
B. Step 2: test
As root, type: pingcall <callsign>
C. You should get a message back looking like this:
root@dingbat:~# ./pingcall n9ssa
Pinging default gateway with callsign in payload
Ascii payload is n9ssa
Default Gateway is 10.10.10.1
hex is 206e39737361
PATTERN: 0x206e39737361
PING 10.10.10.1 (10.10.10.1): 56 octets data
64 octets from 10.10.10.1: icmp_seq=0 ttl=255 time=1.8 ms
--- 10.10.10.1 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 1.8/1.8/1.8 ms
root@dingbat:~#
IV. Creating a cron job.
A. Step 3: set up cron job to run this every 10 minutes
crontab -e (this will put you into vi)
add the following to the bottom of the list:
10 * * * * $HOME/pingcall 1> /dev/null
It might be wise to do this as root unless you have
set up a cron for your UserId.
B.Note:
To change the ping destination to the nearest wireless
node, change the gw= line in the pingcall script to
equal the nodes address, such as:
gw=44.76.2.1
C.The first "20" in the hex pattern is a space, to
separate out the repeating callsign in the payload.
V. Monitoring the results with the tcpdump command.
A. Here is how to monitor the output (again only on a LAN)
using the tcpdump command...tcpdump -X icmp
B. The output will look like this:
[n9ssa@dingbat]# tcpdump -X icmp
tcpdump: listening on eth0
22:01:25.059826 192.168.1.100 > 192.168.1.1: icmp: echo request (DF)
0x0000 4500 0054 0000 4000 4001 b6f3 c0a8 0164 E..T..@.@......d
0x0010 c0a8 0101 0800 dc48 2610 0000 8568 653e .......H&....he>
0x0020 a0e9 0000 3973 7361 206e 3973 7361 206e ....9ssa.n9ssa.n
0x0030 3973 7361 206e 3973 7361 206e 3973 7361 9ssa.n9ssa.n9ssa
0x0040 206e 3973 7361 206e 3973 7361 206e 3973 .n9ssa.n9ssa.n9s
0x0050 7361 sa
22:01:25.060227 192.168.1.1 > 192.168.1.100: icmp: echo reply
0x0000 4500 0054 0000 0000 9601 a0f3 c0a8 0101 E..T............
0x0010 c0a8 0164 0000 e448 2610 0000 8568 653e ...d...H&....he>
0x0020 a0e9 0000 3973 7361 206e 3973 7361 206e ....9ssa.n9ssa.n
0x0030 3973 7361 206e 3973 7361 206e 3973 7361 9ssa.n9ssa.n9ssa
0x0040 206e 3973 7361 206e 3973 7361 206e 3973 .n9ssa.n9ssa.n9s
0x0050 7361 sa
VI. This can be used in addition to or in place of putting your
callsign in the node_name or ap_name fields in you network device.
VII. Credits
Prepared by: Pete Hoffswell, N9SSA
E-Mail: pete@hoffswell.com
tcpdump command from Guillaume Filion,
E-Mail: gfk@logidac.com
Beaumont, Québec, Canada
Edited by: Walt DuBose, K5YFW
E-Mail: k5yfw@arrl.net
Prepared at the request of the ARRL HSMM Working Group, Mar 2003.
|