Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a GPS localizer (TK102). I've set it up to send responses over GPRS to particular IP and over particular port. I was told that, it uses UDP.

It seems that something is being sent (paid transfer registerd on connection list for phone number used by localizer), but it did not reach server (probably).

Seems that my listener, run on server, isn't receiving any responses from the localizer.

Listener itself is working fine (listening for UDP only on ports 3333 and 7777), because I can send UDP packet from any other client and they are being correctly catched up and registered in DB. I tested NetCat and UDP Test Tool on two various ports. All works fine.

My question is, is there any tool or service, that I can run on my server to scan this particular or all ports, on UDP or all protocols, to see if I'm getting anything from that localizer? In other words, if this is localizer or server problem or anything in between.

BTW: I'm using a very limited server (actually NAS device), so I'm not able to run many tools or system commands, that normally can be found right in the distro.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Seems that tcpdump is the best, if not the only answer here. It looks perfect for this job. Since, I'm using very limited version of Linux on my NAS, it wasn't there. But simple call to ipkg install tcpdump solved the problem (hopefully I've installed Optware before, as it was also missing).

For this particular problem (listening for UDP packets on ports 3333 or 7777) command to execute is:

tcpdump -i eth0 -n udp port \( 3333 or 7777 \)

where -i tells tcpdump to listen only on eth0 interface only (execute tcpdump -D to see all adapters available to tcpdump on particular machine) and -n forces tcpdump to not translate source addresses of intercepted packets and to display them as pure IPs.

To test, if my localizer isn't changing ports used, I could call:

tcpdump -i eth0 -n udp

which cause it to listen for anything (any port) in UDP protocol.

An alternative of:

tcpdump -i eth0 -n port \( 3333 or 7777 \)

will cause tcpdump to intercept any traffic on port 3333 or 7777, no matter, which protocol is used.

Running tcpdump with only interface parameter:

 tcpdump -i eth0

or even calling it without any parameters will capture all the traffic comming to machine that runs tcpdump. However, this is useful, if you have physical access to it and can run program manually. If you have remote only access and must run tcpdump via SSH, you might not be that lucky. SSH itself sents so many packets, that even with all other services down, you probably won't be unable to see anything in this "packets noise".

This could be partially solved, if you know source IP address (i.e. remote address of the machine, which will be sending traffic you want to capture). With this, you can limit tcpdump like that:

 tcpdump -i eth0 -n src 77.233.177.237

This is one-way listener that will capture all the traffic that is comming from that IP to your machine.

Alternative version:

tcpdump -i eth0 -n dst 77.233.177.237

lets you check all the "answers" that are sent from your machine to specified IP address.

Finally, executing this commad:

tcpdump -i eth0 -n host 77.253.175.217

will show you all the traffic that is being exchanged between computer, where you run tcpdump and mentioned IP, which in this form is threated as both source and destination, so you see both "questions" and "answers".

You can also use tcpdump on your machine to listen traffic exchanged between two other machines, connected to the same network. Since this is too off-topic and is using program as a really sniffer, maybe to do some bad things, I won't give you correct command to execute. Refer to sources I used or search the Internet.

Sources:

  1. http://www.softpanorama.org/Net/Sniffers/tcpdump.shtml
  2. http://linux.byexamples.com/archives/283/simple-usage-of-tcpdump/
  3. http://kmaiti.blogspot.com/2011/01/hot-to-use-tcpdump-command-to-capture.html
  4. http://openmaniak.com/tcpdump.php
  5. http://danielmiessler.com/study/tcpdump/
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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