I am very new to this, so, sorry if I misquote something. I have a Debian 12 laptop, which has 1 Ethernet NIC (eth3) by itself and 1 USB Ethernet NIC (ethx) I bought. I connect the system as shown below:
Device One --> eth3 --> Debian 12 Laptop (has both layer 2 and layer 3 routing) --> ethx --> Device Two
I want packets to move back and forth, but if a packet from Device One goes to a specific IP address, I want to forward it to Mitmproxy for further investigation; so to 127.0.0.1:8080.
For reasons I can't specify here, the Ethernet packets also needs to travel between Device One and Two using my Debian Laptop.
But I can't seem to achieve forwarding the wanted packet into mitmproxy, and back to ethx. I have looked it up on the Internet but couldn't find a solution to my problem. I'd appreciate if anyone knows why I can't intercept those packets. Thanks so much!
These are the things I did before writing this post:
- I create the network bridge using iproute2 package's commands.
- I activated net.ipv4.ip_forward=1
- I deleted iptables package to completely hand the forwarding to nftables.
- I also deleted firewalld package, in case it was blocking something.
- Here is my /etc/nftables.conf below:
table ip nat {
chain postrouting {
type nat hook postrouting priority srcnat; policy accept;
masquerade
}
chain prerouting {
type nat hook prerouting priority dstnat; policy accept;
ip daddr x.y.z.a tcp dport {80,8080} dnat to 127.0.0.1:8080
}
}
table bridge filter {
chain forward {
type filter hook forward priority 0; policy accept;
}
}