Wake On Lan Does Not Work
Back again, this time with a WOL issue. Basically it doesn’t work when initiated through FOG. Whether I start an imaging task or a Wake Up task, a computer that is off will stay that way. The imaging itself works fine, but the computer must be manually powered on.
It is not a network issue. My test network only consists of three Optiplex 780s (server included) and a Netgear Pro-Safe 8 port switch. I was able to successfully wake up the two client computers using a third party tool called WakeMeOnLan. However for some reason the FOG server won’t send out Magic Packets.
The three WOL PHP files look identical to the ones Tom laid out here: [url]http://fogproject.org/forum/threads/wol-and-task-doesnt-work.10529/[/url] . I haven’t changed any settings related to Wake On LAN. I also tried creating the “testwol.php” file. It did NOT work either. And the Apache error logs contain the following lines:
PHP Warning: socket_sendto() unable to write to socket : Network is unreachable in /var/www/fog/lib/fog/WakeOnLan.class.php pn Line 36.
So it seems the magic packet doesn’t reach the network when sent from the server. This did not happen with our old FOG server. Does anyone have any insights?
Here are my specs:
Fog Server is a Dell Optiplex 780
FOG version 1.2.0
only for knowledge
all ports are open?
Install wakeonlan package (apt-get install wakeonlan) and send wakeup command using this tool on fog server. (i.e. wakeonlan 00:11:22:33:44:55)
wakeonlan helped me to debug wakeonlan feature in fog in the past.
Specifically, UDP port number 9
Well I can’t seem to connect to the internet at all. I plug the ethernet cable into a port on the wall (as opposed to the switch) and … nothing. Tried deleting the two network connections to no avail. Since the last time the server connected to the internet, I’ve installed a DHCP server. It’s not running now to avoid crashing the campus network. I had some trouble at the beginning assigning the FOG server a static IP address (the server wanted to think it was on the campus network when it wasn’t), but solved that by creating a network connection with the IP address desired. Perhaps that caused a problem of some sort?
I’ve tried using a different port and a different cable and also removed the following line from the local host file: “127.0.1.1 server name”, but that has not helped.
[quote=“MikeoftheLibrary, post: 35917, member: 20568”]I had some trouble at the beginning assigning the FOG server a static IP address (the server wanted to think it was on the campus network when it wasn’t), but solved that by creating a network connection with the IP address desired…[/quote]
Actually that wasn’t the only thing I did. First I added the following to /etc/network/interfaces:
iface eth0 inet static
broadcast 192.168.x.x (not the same as address)
Then I created a network connection with the address and netmask above which has allowed imaging to take place. Taking that stanza out allows the server to connect to the internet and download wakeonlan. It seems to be needed for the DHCP server to work. Could this setup be the problem?
The wakeonlan command also produces a “network unreachable” error.
Success! After substituting the broadcast address for 255.255.255.255 and typing the MAC in with capital letters, I was able to use the wakeonlan command to turn one of the client computers on from the FOG server. However a wake up task from FOG itself still did not work (and I’m assuming the same would hold true for imaging tasks). According to WireShark, the WOL magic packet wasn’t even sent.
EDIT: The testwol.php script does not work either.
Figured it out. In the file /var/www/fog/lib/fog/WakeOnLan.class.php there is the following line:
[COLOR=#007700][FONT=monospace]if( [/FONT][/COLOR][COLOR=#0000bb][FONT=monospace]socket_sendto[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000bb][FONT=monospace]$soc[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#0000bb][FONT=monospace]$strRaw[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#0000bb][FONT=monospace]strlen[/FONT][/COLOR][COLOR=#007700]FONT=monospace, [/FONT][/COLOR][COLOR=#0000bb][FONT=monospace]0[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#dd0000][FONT=monospace]“255.255.255.255”[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#0000bb][FONT=monospace]9[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) )[/FONT][/COLOR]
[COLOR=#000000]I replaced “255.255.255.255” with the network’s broadcast address and now it works fine. The old FOG server did not require this change so I may have to reverse it before going into production.[/COLOR]
I think, then, you’re attempting to wakeonlan systems whom are not in the same subnet as your fog server?
There are only three computers strung together and not connected to the outside world. All of them are on the 192.168.1.x subnet with a subnet mask of 255.255.255.0. Perhaps the DHCP config file is not correct? When installing isc-dhcp-server, I had the FOG server connected to the campus network which may have caused problems.
disable your dhcp on fog server and configure dnsmasq. i’ve been using dnsmasq for small networks and works like a charm. This can not solve your problem, but don’t disturb your dhcp campus service.
[quote=“Thiago, post: 35967, member: 21790”]disable your dhcp on fog server and configure dnsmasq. i’ve been using dnsmasq for small networks and works like a charm. This can not solve your problem, but don’t disturb your dhcp campus service.[/quote]
So if DNSMasq can’t solve my problem what good is it right now? We’ve already got two campus DNS servers. Admittedly there has been an issue with FOG not successfully pinging hosts, but I will deal with that later.
“Maybe” this can not solve your problem.
I work at a university that has a central dhcp/dns linux server (i can’t change), and all departments are on different ip classes/vlans. because of this, that dnsmasq has been my solution since fog 0.32.
For me, ping must be enabled in Win7 clients (permit [B]Eco - ICMPv4-In/ICMPv6-In[/B] in Windows Firewall, adjust scope of rule to match your needs).
It actually might solve an unrelated problem. Ever since installing FOG, the ping hosts function on the hostnames page would not work despite having put in the address of the campus DNS server. In version 1.2 it is unbelievably slow so I disabled it. I have not tried to troubleshoot it since we have other software which can let us know if the computers are on. However DNSMasq may be able to fix that. Thank you for telling me about it.
Today we successfully deployed the FOG server into production, including integrating it with the campus network. Wake On Lan, for both the Wake Up task and imaging works fine. I am not 100% sure what the problem was. My suspicion is that the localhost file (/etc/hosts) may hold the answer. At some point the line which read: “127.0.1.1 FOG Server Name” became “192.168.x.x FOG Server Name”. Not sure why I did that, but the change prevented the computer from properly connecting with the network. Perhaps that was interfering with WOL as well? Others are welcome to experiment and report back their results. While I’m hesitant to call this thread solved without a better idea of the cause, the problem does seem to be fixed.
I’m thinking the original setup was set to 127.0.1.1?
My guess is it was only broadcasting traffic across your local machine. (127.0.1.255)?
It was. Debian creates that line by default. I fooled around with the localhosts file and DHCP config in order to get the isolated network running and in the process changed the former. Perhaps I was telling the computer there was only one machine on the network? I don’t understand enough about computer networking and how a PHP script creates a magic packet to fully answer the question.
Curiously WOL still does not work for uploading images, but since our technician computers are within 20 feet of my desk that is not a big issue.
UPDATE: Well WOL worked once for an image upload. Still not going to worry much about it though.