I've an Ubuntu server 18.04 LTS with two nic cards. I need to setup them in a way that I listen only UDP traffic on one nic card and on the other one I have internet traffic.

I need this, because I process videos received from encoders from an UDP address and want to push the video as HLS (TCP) through another nic card.

  • 1
    Is your requirement for both inbound and outbound traffic? meaning inbound and outbound UDP will only go through the UDP interface? and the same for the TCP interface? – relevantRope Feb 12 at 13:07
  • yes, that is what I need. – Jocheinfa Feb 12 at 13:22
  • Is there a special reason, that you can't just assign two different IPs to your 2 NICs and seperate the traffic this way? If you can it's trivial to block any traffic other then TCP on NIC 1 and UDP on NIC 2... – Marcel1980 Feb 12 at 16:04

At first, I thought we can do this with firewalld, and maybe a few rich rules to 'route' the traffic. But that idea turned messy quickly. You're going to need something that will understand the transport protocol before it hits your server.

My next idea was a load-balancer, and of course, HAProxy came to mind first; turns out HAProxy doesn't do UDP. But LVS does! It looks plausible. Give it a read: http://www.linuxvirtualserver.org/

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.