LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 03-22-2010, 06:17 PM   #1
jfuerst
LQ Newbie
 
Registered: May 2006
Posts: 2

Rep: Reputation: 0
iptables loopback local traffic with masc?


I have a bridge set up using brctl that has 2 interfaces, eth0 and tap0.

What I would like to do is change the stack so that:
If a packet comes into interface tap0 AND is destined for some device on tap0 THEN I would like to forward it back out of tap0 instead of the default, which would be to drop the packet. Also if it is possible it would be great to be able to masquerade these packets.

I was thinking that this would be possible with iptables with something like:

iptables -a FORWARD -m physdev --physdev-in tap0 physdev --physdev-out tap0 ACCEPT

Or something like that to get these packets to echo back out the tap0 port, but that doesn't seem to work. Also I am not clear on how I would masquerade just these packets.

Essentially I have a program that collects data from several places and feeds the data into the IP bridge using a tap interface. The problem is that these devices can not talk to one-another since they are all located on what the bridge sees as a single device. This is similar to trying to do the same thing a a wireless bridge must do to allow two laptops to talk to each other of the same wifi access point.

Any help is greatly appreciated,

Thanks,

-j
 
Old 03-22-2010, 07:49 PM   #2
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Code:
   REDIRECT
       This target is only valid in the nat table, in the  PREROUTING  and  OUTPUT  chains,  and
       user-defined  chains which are only called from those chains.  It redirects the packet to
       the machine itself by changing the destination IP to the primary address of the  incoming
       interface (locally-generated packets are mapped to the 127.0.0.1 address).

       --to-ports port[-port]
              This specifies a destination port or range of ports to use: without this, the des-
              tination port is never altered.  This is only valid if the rule also specifies  -p
              tcp or -p udp.

       --random
              If  option  --random  is  used  then  port  mapping  will be randomized (kernel >=
              2.6.22).
Can this help you?
 
  


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
[HELP] redirect traffic to spesific port based on Traffic Content using iptables summersgone Linux - Server 2 06-22-2009 11:26 AM
add local loopback bic Red Hat 6 03-21-2007 08:15 AM
What is local host 127.0.0.1 loopback?? cousinlucky Linux - Newbie 12 12-25-2005 04:56 PM
sending out going traffic to the loopback interface with iptables hypexr Linux - Networking 1 09-22-2005 07:36 PM
Bringing local loopback @ bootup eroica Linux - Networking 2 03-24-2004 12:54 PM

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

All times are GMT -5. The time now is 05:45 PM.

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