This is the bocoup web log with posts from Al, Boaz, Rick, Sam, Nate, Nick & Pete. You should also make sure to checkout code.bocoup.com, where we keep the finished versions of ideas we kick around here.


Feb 13, 2010

IP Tables

Need to route one ip address to another ip address? Use IP Tables.

Last night I was working on a WordPress site with my wife. I was hosting the site locally at 192.168.1.4, and I updated the “WordPress address (URL)” and “Blog address (URL)” to 192.168.1.4 so that my wife could log in to my machine and add posts. When I got to the library the next day, I was assigned a random IP address from the library’s server: so, I could not load my WordPress site locally any more!

WordPress was trying to load its files from 192.168.1.4, but I was no longer at that address. What I needed was a way to tell my system to point 192.168.1.4 to localhost: 127.0.0.1. To achieve this, I used IP Tables like so:

iptables -t nat -A OUTPUT -d 192.168.1.4 -j DNAT --to-destination 127.0.0.1

Problem solved. If you are going to do this kind of thing as a temporary fix: remember to reset your WordPress address to localhost and reset your tables to their previous configuration.



Comments:




Please send your questions to this address or call Bocoup at 617-379-2752
This web page is proudly maintained by Bocoup and hosted by (mt) Media Temple
All code on this website is Open Source