UDP broadcast with nc not received (Ubuntu)

in flag

I'm trying to understand UDP broadcasting, and running into some trouble.

1 - Running a server like this

nc.traditional -l -u -p 65001

2 - Sending stuff from the client like this - on the same machine - works:

nc.traditional -u 65001

I can type stuff into the client nc and it shows up in the server nc.

3 - But in broadcast mode like this, when I type stuff into the client the server receives nothing:

nc.traditional -u -b 65001

I'm running Ubuntu 22.04. The address comes from ip a output which is like this:

3: wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 8c:1d:96:d8:df:97 brd ff:ff:ff:ff:ff:ff
    altname wlp0s20f3
    inet brd scope global dynamic noprefixroute wlo1
       valid_lft 161367sec preferred_lft 161367sec
    inet6 2601:647:6400:32f0::2056/128 scope global dynamic noprefixroute 
       valid_lft 593370sec preferred_lft 593370sec
    inet6 fe80::c1c7:fce6:ecca:b966/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

Any idea about what I'm doing wrong?

Martin avatar
kz flag
if I am not mistaken, you have to listen to the broadcast address to be able to receive broadcasts...
in flag

It was the firewall. I had ufw enabled with the default setting to block everything.

And for some reason, it allowed directed udp but was blocking broadcast udp.

After doing sudo ufw allow 65001/udp broadcasts are working.

Server: nc.traditional -l -u -p 65001

Client: nc.traditional -u -b 65001


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.