I wasn't sure whether to put this here or in the programming section but here goes...

To test a program I'm working on I want to be able to trick the program into thinking it is getting traffic from a range of IP addresses, when it is really just traffic from itself. I have a script that does random queries which works great, but the data is all from the localhost which doesn't make for very interesting graphs and charts (it is a web statistics program). I'd like to be able to set it to send queries to a range like, and then have them routed back to the localhost which thinks it is getting traffic from all over.

I've been told iptables can do this, but have not been able to figure out how. If you can help me out I'd really appreciate it.