Sample Header Ad - 728x90

Failing to send Wake-On-LAN UDP packet with netcat

1 vote
1 answer
979 views
I'm trying send a WOL packet from a bash script under Mojave, much like https://stackoverflow.com/a/31588036/9370650 , without any third-party utilities, such as the nifty https://github.com/jpoliv/wakeonlan . I don't, however, seem to be able to successfully broadcast anything at all to 255.255.255.255 on port 9 using netcat. If I listen to UDP port 9 like this: $ nc -uv -l 9 -w0 netcat then reports the WOL packet when I run the perl-based wakeonlan script I mentioned above. But, if I try to do my own UDP broadcast to 255.255.255.255:9, like this: $ echo "hello" | nc -vu 255.255.255.255 9 it isn't seen by my listening instance of netcat. For the record, the output from my attempt to broadcast looks like this:
found 0 associations
found 1 connections:
     1:	flags=82
	outif (null)
	src 192.168.1.7 port 51674
	dst 255.255.255.255 port 9
	rank info not available
I'm not a networking expert, so I'm likely misunderstanding something here. Any thoughts on what I'm doing wrong?
Asked by briguy328 (141 rep)
Mar 27, 2019, 06:43 PM
Last activity: Apr 2, 2019, 06:06 AM