Using iptables as hosts file
I would like to redirect a web address to a different ip. This can be done in a hosts file, but it would affect everone else on the shared hosting server. I was pointed towards iptables. Is it possible to create an iptables entry that would forward any packet going to bf2web.gamespy.com instead to suchandsuchip, but only if the packet is coming from 207.210.238.174?
Hopefully this made sense. The server is linux btw. Thanks! Fourthbean |
that'd be a nat rule:
iptables -t nat -A PREROUTING -t nat -p tcp -d 1.1.1.1 --dport 80 -j DNAT --to 2.2.2.2 so all data the box sees going to port 80 on ip 1.1.1.1 gets sent to 2.2.2.2 on the same port. |
Thank you so much. I love Linux :) And of course the people that help the noobs with it :)
|
no probs... maybe you'd like to give this opinion here... http://www.linuxquestions.org/questi...74#post2170274 :)
|
Wow, what a thread.
I have come back for more help though. I looked in the man page and if I want to send to multiple destination ip's it appears it does a round robin. I would like to send to multiple destinations redundandtly instead of load balancing. Is that possible? |
There's plenty of close sounding things in the iptables manpage... check the DNAT section for obselete references, also the SAME section for -to ranges, and there's also the --tee option in the ROUTE section, which clones the packet. wether these can be assimiliated into a solution for you, i'm not sure... worth a play though
|
All times are GMT -5. The time now is 02:49 PM. |