Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How to configure reverse loopback on an ethernet device? In that case, all the traffic received will be sent back to transmitter connected to ethernet port.

share|improve this question
    
Do you want to have the traffic actually leave the computer hardware and pass through a tp cable? –  flob Jun 26 '13 at 18:54
add comment

2 Answers

up vote 2 down vote accepted

I wonder if you could accomplish what you want using iptables. Looking through the iptables man page I noticed this option called tee:

TEE

  The TEE target will clone a packet and redirect this clone to another
  machine on the  local  network  segment.  In  other words, the nexthop 
  must be the target, or you will have to configure the nexthop to forward
  it further if so desired.

  --gateway ipaddr

         Send  the  cloned  packet  to the host reachable at the given IP 
         address.  Use of 0.0.0.0 (for IPv4 packets) or :: (IPv6) is 
         invalid.


  To forward all incoming traffic on eth0 to an Network Layer logging box:

  -t mangle -A PREROUTING -i eth0 -j TEE --gateway 2001:db8::1

It would seem that a command like this would do what you want:

$ iptables -t mangle -A PREROUTING -i eth0 -j TEE --gateway <ip address>

Also there is this tutorial titled: Howto: Copy/Tee/Clone network traffic using iptables, that covers how to use it in a little further details.

share|improve this answer
    
Hi Sir, This Options is nice in iptables, but can you tell why is it required ? any example , it would be better for me for understanding .. new things.. thanks in advance.. –  Rahul Patil Jun 27 '13 at 4:46
    
@RahulPatil - sure if you're familiar with the command line tool tee this is doing something similar with your network data where it's making a copy and sending it to the ip address you provide in the --gateway argument. –  slm Jun 27 '13 at 8:36
add comment

Try creating two macvlan devices and bridging them to each other.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.