Redirect / Rewrite destination IP address using iptables

Just a quick one on how to alter the destination of an outbound connection IP using iptables. I imagine a few tweaks would allow this to work in the sense of redirecting through a proxy etc too.

iptables -t nat -I OUTPUT --dest 93.184.220.20 -p tcp --dport 80 -j DNAT --to-dest 93.184.220.21

This one will specifically change which IP your machine actually uses for EdgeCast’s CDN, but you can easily change the original IP (–dest) and the new destination IP (–to-dest)



Sign up for emails about the things

Sign up to my (at most) weekly mail list. I'll send general updates to the list, new projects and whatnot. Not every single post as it comes out, but a summary mixed in with random cool tech I find around the net. For more info checkout the subscribe page

I'll never sell, give, transfer, trade your contact details with any other person, company, or other entity and you're free to click that big unsubscribe link at the bottom of each message whenever!