0

Earlier, I was trying to get traffic from one ethernet interface to another without using a bridge. Here is a link to the solution : https://stackoverflow.com/questions/26908439/c-program-to-receive-and-send-the-same-packets-out-over-another-interface . It is a simple application that reads from one interface and writes it blindly to the other interface.

(Laptop 1)<---------->[[{eth0} (LINUX PC) {eth1}]]<------------->(Laptop 2)

This is the basic diagram but we only need to keep the Linux PC with two interfaces in mind for now. Consider that I am trying to get traffic from eth0 to eth1. This application only works one way. If I try to run another instance of the application with the input and output interfaces reversed in the code, simultaneously, the packets go in a continuous loop. Hence, I cannot use this application for two way communication which is essential for ICMP Ping and TCP.

My guess is that I need to use IPTables and Netfilter nfqueue to help me simply get the traffic from one interface to another. I do not need any routing decisions and I cannot use the wonderful ethernet bridge (it's a secret why I can't). Consider simple UDP traffic and all systems on the same network (example : 192.168.1.xxx) if it makes it easier to explain.

I have already tried

iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

and ipv4 forwarding is enabled in my file system. Let me know if you need any additional information.

anon_16
  • 101
  • 1
  • Is it full duplex ? Half duplex ? Actually the loop your are describing is a livelock https://docs.oracle.com/javase/tutorial/essential/concurrency/starvelive.html – Nikolaidis Fotis Nov 18 '14 at 14:00
  • Communication has to be full duplex. In my question I asked if there is any way to forward traffic between interfaces **without using my application or using a bridge** . The application also introduces a huge bottleneck and the bandwidth reduces to a staggering 1/10th the original. I suspect the answer lies in using iptables / ebtables and not using the application. – anon_16 Nov 19 '14 at 04:50
  • Check this out http://serverfault.com/questions/453254/routing-between-two-networks-on-linux – Nikolaidis Fotis Nov 19 '14 at 09:30
  • That was interesting. I tried it out but it doesn't forward the packets. – anon_16 Nov 19 '14 at 10:38
  • how do you check ? ping ? Also when you say "it doesn't work" do you mean both ways ? Any other entry in iptables ? – Nikolaidis Fotis Nov 19 '14 at 12:12
  • Normally, I use ping from one laptop to the other (as in the figure) but that requires two way communication. I also have a simple UDP (which is one way) multicast client server application which sends UDP packets periodically. I check the packets sent/received on all 3 systems using Wireshark. Yes, it "doesn't work" both ways. There are no other rules in iptables. – anon_16 Nov 19 '14 at 12:23

0 Answers0