LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Mangle ip source with iptables (https://www.linuxquestions.org/questions/linux-networking-3/mangle-ip-source-with-iptables-617999/)

spank 02-01-2008 02:17 PM

Mangle ip source with iptables
 
Can I modify packets that leave my station using iptables to have a different source address ?


For example I have the ip X and I want the packets that leave the station having in the ip header the ip Y. I guess it has something to do with the mangle table of iptables but I`m not too good with that.

something like this maybe?
Code:

iptables -t mangle -A PREROUTING -s X -j SAME --to Y
Please help!

gilead 02-02-2008 12:34 AM

If you want to change the source address of packets leaving your box, you can use the POSTROUTING table. For example, with masquerading:
Code:

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
Does the definition at http://www.netfilter.org/documentati...T-HOWTO-3.html describe what you're trying to do? If so the howto should be useful.


All times are GMT -5. The time now is 09:11 PM.