sending out going traffic to the loopback interface with iptables
I am not very good with iptables rules and have been searching and reading for days trying to figure this out.
I want set a rule that will send all packets that are being sent out through eth0 to 127.0.0.1 or lo. From what I've read I may be able to do this with nat by using iptables to change the destination address.
Two rules I've tried are:
iptables -t nat -A PREROUTING -i eth0 -j DNAT --to-destination 127.0.0.1
iptables -t nat -A OUTPUT -j DNAT --to-destination 127.0.0.1
These did not work correctly. Do they make any sense.