I have made a Linux program that sends UDP packets to a lighting controller. This works under both Ubuntu and Mac OS X. I configured an ethernet port to have a static IP address (with the correct netmask). The ethernet cable pugs straight from the controller device into the Pi.

The app runs on the Pi but I get a 'permission denied' error when trying to open a UDP socket. I edited the dhcpcd.conf file as per these instructions, so I am now able to ping the box and open its web interface in browser; yet I still get the error.

My settings are:

interface eth0
static ip_address=
static routers=
static domain_name_servers=

The device's IP is, so I have also tried setting those routers and domain_name_servers, to that; but that didn't work either. Is there some additional network configuration I should try that includes specifying the netmask or something?

Any advice is appreciated!

EDIT - It turns out that this only happens when trying to connect to the broadcast IP (, the other IP works fine. I do need to be able to broadcast though so still looking for a solution...

  • it could be selinux – Rui F Ribeiro Feb 29 '16 at 6:05
  • I don't know why you want static address, but it might work if you used a consistent network setting. – Milliways Feb 29 '16 at 6:25
  • 1
    Don't expect other people to bother spending much time contemplating someone else's problem if that someone else A) Cannot bother to post the code that produced the error, B) Cannot bother to include the literal text of the error. – goldilocks Feb 29 '16 at 8:47
  • @Rui F Ribeiro - I am using a vanilla raspbian install so selinux shouldn't an issue, no? – naychrist Feb 29 '16 at 9:20
  • @Milliways - I need a static address as the device has a fixed IP I need to talk to - not sure what you mean by 'consistent network setting' – naychrist Feb 29 '16 at 9:22

Static addresses have nothing to do with it. Sending to a broadcast address is a privileged operation. You either need to be root, or you need to have the CAP_NET_ADMIN (and hopefully some day the CAP_NET_BROADCAST) capability.

|improve this answer|||||
  • thanks, didn't even think to try running it as root! the boxes are installed somewhere for a couple more weeks but will try and test this when I get them back. – naychrist Jun 7 '16 at 0:21

Are you sure about your network mask ? IP addresses starting between 0 and 127 should be associated to class A IP networks, with a network mask of /8 or

In this case, your broadcast address would be, I guess.

|improve this answer|||||
  • 1 is a legitimate IP address/subnet mask. The subnets have just been made smaller, that is all. I have worked at many multinationals where this is used. – Greenonline Mar 7 '16 at 11:06
  • the device I am talking to is configured for a network mask of, which an ifconfig reveals to be true also on my Pi. So I normally use a broadcast IP of, which also shows up when running ifconfig on the Pi. I have never used dhcpcd.conf before but seems like this is behaving correctly. – naychrist Mar 8 '16 at 22:31
  • @Greenonline : I never said it was technically invalid. – Moonchild Mar 9 '16 at 10:22
  • 1
    network "classes" have not been an issue since the early 90s. – JayEye Jun 5 '16 at 19:35

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.