I have two interfaces eth0 and eth1. I want all traffic on eth0 to be forwarded to eth1 without changing anything to packet(origin Src/Dst IP, port etc. has to same). enter image description here I found some articles about forwarding but they were using NAT to relay traffics something like this.

sudo iptables -F FORWARD
sudo iptables -P FORWARD DROP
sudo iptables -A FORWARD -o eth1 -j ACCEPT
sudo iptables -A FORWARD -o eth0 -j ACCEPT
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Is there any way to forward traffics without doing NAT?

  • 2
    You should probably do bridging instead of routing. Either way, iptables has not much to do with this. iptables might affect routing, but it's not doing routing itself. – A.B Nov 25 '19 at 19:22
  • Thanks A.B! Informations I searched were using iptables so I thought iptables could do this. Is there any options to do routing or bridging in linux? – Penguin Nov 25 '19 at 19:25
  • Oh I think I found something. I will try to solve this problem using bridge-utils. Thanks – Penguin Nov 25 '19 at 19:31
  • 1
    leave your answer here later then! – A.B Nov 25 '19 at 19:31
  • Thanks A.B! Have a nice day :) – Penguin Nov 25 '19 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.