0

I am working on a project where I have to DNAT some broadcast packets to a remote machine IP Address. So far I have learnt that IP-tables can only DNAT unicast packets and it does not DNAT broadcast packets. I am looking for a software that can listen for these broadcast packets on Ubuntu or Centos and then convert these to unicast packets so they can be sent to a remote machine on a different network. I know there are few options for windows like "multi-port-forwarder" and "AUTAPF" but I am looking for a similar utility for linux.

Basic Design

2

As alternative to AUTAPF, socat can be used.

$ sudo socat UDP4-RECVFROM:139,broadcast,fork UDP4-SENDTO:10.1.1.255:139

Where 10.1.1.255 - broadcast forward target

Basen on [UDP port forwarding with socat by Matt Ryall] and [IP Multicasting with Socat]

Just demonize it.

Or portfwd

udp.cfg

user  nobody
group nobody

udp /* UDP packets */
{
        /*
         * All packets on port 10000 are forwarded to 127.0.0.1:11000.
         */
        10000 { => 127.0.0.1:11000 }
}
1

If your goal is to receive the packet back as broadcast again on the destination then you can use L2 VPN. It does not DNAT, but tunnels the original packet to where the tunnel leads and then demarcate from the tunnel on the final destination.

Your Answer

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

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