0

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

1 - Running a server like this

nc.traditional -l -u 10.0.0.253 -p 65001

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

nc.traditional -u 10.0.0.253 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 10.0.0.255 65001

I'm running Ubuntu 22.04. The address 10.0.0.253 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 10.0.0.253/24 brd 10.0.0.255 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?

  • if I am not mistaken, you have to listen to the broadcast address to be able to receive broadcasts... – Martin May 12 '22 at 06:30

1 Answers1

0

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 10.0.0.255 65001

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 20 '22 at 09:30