Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 09-16-2010, 01:13 PM   #1
LQ Newbie
Registered: Sep 2010
Posts: 9

Rep: Reputation: 1
Is this possible in iptable? Switching destination IP to source.

Using iptables is there a way to switch the destination IP to become the new source IP and forward that connection.

Does iptables store the src and dst IP in a variable for a particular connection?

Last edited by julienr78; 09-16-2010 at 01:34 PM. Reason: Sorry, had my destination and source mixed up... ;)
Old 09-16-2010, 01:27 PM   #2
LQ Newbie
Registered: Oct 2007
Distribution: Ubuntu, RedHat Enterprise Linux
Posts: 12

Rep: Reputation: 0
Have you tried MIRROR target?

For example:
iptables -I INPUT -s -j MIRROR

You can read from iptables manual page:
. . .
This is an experimental demonstration target which inverts the source
and destination fields in the IP header and retransmits the packet. It
is only valid in the INPUT, FORWARD and PREROUTING chains, and user-
defined chains which are only called from those chains. Note that the
outgoing packets are NOT seen by any packet filtering chains, connec‐
tion tracking or NAT, to avoid loops and other problems.
Old 09-16-2010, 01:33 PM   #3
LQ Newbie
Registered: Sep 2010
Posts: 9

Original Poster
Rep: Reputation: 1
"Works under Linux kernel 2.3 and 2.4. It was removed from 2.5 and 2.6 kernels due to it's inherent insecurity. Do not use this target!"

"Also note that outgoing packets resulting from the MIRROR target are not seen by any of the normal chains in the filter, nat or mangle tables"

I want to be able to also then do some POSTROUTING stuff on the packet.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
copy files from one source to multiple destination simultaneously mdfakkeer Linux - Software 3 08-10-2010 04:25 PM
Copying Files from one source to a destination vgdeveloper05 Programming 1 12-10-2006 03:28 PM
Changed source after iptable DNAT? Ambrosia Linux - Networking 0 08-31-2004 02:22 PM
iptables - source ? destination ? From where ? Dek Linux - Networking 3 05-01-2003 12:43 AM
Martion Source/Destination bfloeagle Linux - Networking 2 06-13-2001 07:42 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:40 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration