I'm using a Raspberry Pi to gather temperature data that I then send over a cellular modem to a server. Since I'm on a cellular network, conservative usage of data is very important. I've noticed that a lot of data gets burnt up by things I have no control over (mostly port scans, pings, etc).

I'm wondering if anyone has any suggestions on the best ways to cut down on all this traffic. Perhaps an iptables based solution?


Out-of-the-box: Make the Pi collect its data offline and connect to the internet only once in a while to deliver the parcel en bloc? Select the upload interval according to the desired update frequency (which I hope is not "real-time"). Certain drawback would be with remote maintenance that would require to dial in at those given times only.

The approach could be combined with other measures to cut down on unwanted requests.


You can also use iptables (Linux firewall) to allow traffic only from one IP. Assuming you are accessing the device and reading the data and have static IP.

  • This may help but probably not much with incoming packets, since you can't stop a port scanner or a ping, you can just decide not to reply. However, it could help with the outgoing traffic that's generated in response to those things, since normally if nothing is on a port the system still sends, e.g., a TCP RST/ACK. If you instead use a default DROP in the iptables config, that won't happen. Unfortunately, that is considered bad form (you're supposed to actively REJECT), and it may lead to increased incoming packets...but it is worth trying.
    – goldilocks
    May 29 '15 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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