1

I have created this program that runs inside a router. The program is essentially a speed test and for the upload part of the test, the program is utilising a lot CPU and generating a file inside the router that occupies a lot of disk memory.

My idea was to remove the file generating feature of my program. Place a file of a certain size in my web server with a public IP and have that router download it. Instead of downloading the packets and writing in the disk of the router have it redirect/bounce back all the traffic to my web server before it reached the application layer. Then get the RX values from my web server to find upload speed of the router.

I have looked at many examples with iptables and rinetd but all of them redirect/forward traffic within the same local network. I'd like the traffic to be redirected back to the internet into my public IP web server. Is it possible?

  • 1
    This won't work with iptables, because you have two different http connections, which will never be completely identical, so you can't just redirect the packets. For https it's a lot worse. Any reason you can't solve this at the application level? Just have the upload part of your program download the file. Alternatively, use nc/netcat/socat. Or use a ready-made speed test like iperf3. – dirkt May 6 at 14:53
  • @dirkt I see... The reason why I'm not solving this in the application level is that a router generally has a small amount of storage (512MB). Even in my download test, the bytes received are loaded in chunks and deleted inside the internal memory without affecting actual storage of that router. I'll take a look at netcat / socat – guest723561 May 6 at 15:12
  • Early routers had a feature that packets addressed to a special IP address would get the IP addresses swapped and the packet sent back out. This was extremely useful for the sort of testing I think you're trying to do. If you have access to the source code you might be able to implement such a feature. – stolenmoment May 7 at 0:37
  • By "solving it at the application level" I exactly mean "stream data, don't store it". Your question is a bit vague on your requirements, but for a quick speedtest shell script, you can quickly cobble something together with netcat/socat and/or curl etc. (or, as I wrote, use some ready made) If the speedtest requires a HTTP server on the router, there are again quite a few options, but it depends on what you can easily install on the router. – dirkt May 7 at 5:35

Your Answer

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

Browse other questions tagged or ask your own question.