I'm working on a networking challenge (for learning and also for utility), which involves an OpenWRT router with ebtables installed, and I want to substitute an RTP stream coming from internet (IPTV) by another coming from my LAN. I have been reading about ebtables, and I have an overall idea of it, and I think it could work but it is being a pain to make it to work.

I think the best solution would be to drop all the packets with source/dest IP/MAC addresses of the original stream, and changing the stream coming from inside my LAN to having the source/dest IP/MAC/port as the original stream had, so my IPTV decoder will think it is playing the original stream (a TV channel I'm not interested in) and it will play my stream.

My main goal is to virtualize a system with Kodi (I have a Ubuntu server which can virtualize with Qemu) and send anyhow an RTP stream as visualization driver, to my OpenWRT, which makes the substitution of the stream, and then I can see Kodi on my IPTV decoder. Now, The Ubuntu server is a part of the challenge that I'm not trying in this moment (I was investigating on it some time), because first I want to be sure I can handle the RTP stream substitution part.

Note: the path between internet and the IPTV decoder (named ARRIS) is passing through the OpenWRT router. The OpenWRT is set up as a switch - it is configured in bridge mode (it doesn't do any routing actions) but it can operate on the IPTV stream through the use of ebtables.

Let me tell you the technical details of my setup.


  1. The Windows 10 host named TACENS with IP (Origin of the STREAM2)
  2. The OpenWRT router named MEDIATODECO with IP
  3. The IPTV decoder named ARRIS with IP
  4. The STREAM1 is a multicast stream (I think it is RTP) coming from internet. source IP: . Destination IP: port 8208 UDP.
  5. The STREAM2 is a unicast RTP stream coming from TACENS. source IP: . Destination IP: port 8208 (I can set whatever, with VLC).

I want to substitute STREAM1 by SREAM2.

STREAM1 is coming from internet and passes through MEDIATODECO to ARRIS. It enters in port 1 of MEDIATODECO and is forwarded to port 2 of MEDIATODECO, where it has ARRIS connected.

STREAM2 is directed to MEDIATODECO, and it is not forwarded; It enters in port 1 of MEDIATODECO.

How should I configure ebtables in MEDIATODECO to drop all frames from STREAM1 and change the STREAM2 IP/MAC/port equal to those of original STREAM1?

Is this a possible solution? if not, do you anyone have any idea of how should I setup my MEDIATODECO to do this?

If there's the need for capturing packets in MEDIATODECO, I have tcpdump installed; in fact, I have already captured packets to see the information for the STREAM1 with Wireshark.

  • ebtables can do NAT on the Ethernet MAC address. It can't do NAT on the IP address. The only thing that can do IP NAT statefully in the bridge path is iptables with the br_netfilter module loaded. nftables can replace ebtables and could also possibly perform static (non-stateful) IP NAT in the bridge path which might be enough here and less cumbersome than having to deal with br_netfilter peculiarities. I'm telling that I doubt that ebtables alone will do all you're asking.
    – A.B
    Oct 1, 2023 at 13:36
  • Btw: I get it working using nftables on a 6.5 Linux kernel. Still this also requires to know the home router's MAC address to be thorough (and I guess its IP address is but that's not really needed if the MAC address is known).
    – A.B
    Oct 1, 2023 at 16:03
  • @A.B thanks, I'm going to try with nftables when I have time
    – Free
    Oct 19, 2023 at 19:16


You must log in to answer this question.

Browse other questions tagged .