LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-16-2010, 12:13 PM   #1
julienr78
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 12:34 PM. Reason: Sorry, had my destination and source mixed up... ;)
 
Old 09-16-2010, 12:27 PM   #2
Tobler
LQ Newbie
 
Registered: Oct 2007
Distribution: Ubuntu, RedHat Enterprise Linux
Posts: 14

Rep: Reputation: 0
Have you tried MIRROR target?

For example:
iptables -I INPUT -s 10.0.0.0/8 -j MIRROR

You can read from iptables manual page:
iptables(8)
. . .
TARGET EXTENSIONS
MIRROR
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, 12:33 PM   #3
julienr78
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.
 
  


Reply



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 03:25 PM
Copying Files from one source to a destination vgdeveloper05 Programming 1 12-10-2006 02:28 PM
Changed source after iptable DNAT? Ambrosia Linux - Networking 0 08-31-2004 01:22 PM
iptables - source ? destination ? From where ? Dek Linux - Networking 3 04-30-2003 11:43 PM
Martion Source/Destination bfloeagle Linux - Networking 2 06-13-2001 06:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:31 AM.

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