linux change source and dest ip of a packet [closed]

Im currently stuck solving this simple problem and need your help,

what exactly i want to do is this:

I have a linux (ubuntu) server, i want it to do:

1- every incoming packet of protocol IP (network layer ip), the source ip address must be changed to (forexample 1.2.3.4).

2- the destination ip of that packet must also be changed to another ip (like 4.5.6.7).

3- the modified packet should now be sent into the interent.

4- the sent packet should not be proceeded by the kernel on the server machine afterwards, since its forwarded and we’ve got nothing more to do with it

Note that i’m already aware of iptables and its portforwarding, i don’t want a nat,i dont want to go above network layer, i just want to do these directly to packets, nothing must change but the ip of source and dest

I am not sure if iptables can solve this or it must be done using other tools. Thanks for helps

  • Stack Overflow is for programming questions, not questions about using or configuring Unix and its utilities. Unix & Linux or Super User would be better places for questions like this.

    – 

Leave a Comment