1
So you can wake on lan, because the ethernet cables are not for data only, they transmit amperage too. If they are directly connected to the motherboard can someone throw a packet and turn off your pc.? And is it more easyer on windows hosts.?
1
So you can wake on lan, because the ethernet cables are not for data only, they transmit amperage too. If they are directly connected to the motherboard can someone throw a packet and turn off your pc.? And is it more easyer on windows hosts.?
1
The opposite of what you are asking about is very common - Wake On LAN (WOL). To answer your question it will be much easier to explain that first.
WOL
WOL requires that these capabilities are present
The network in the powered down PC must have built in support in its driver.
The motherboard (BIOS) must support a low power mode that still provides a small amount of power to the NIC when the PC is otherwise off.
A second PC / network appliance must be on the LAN (for the sake of this simplified example - you can do this over the Internet) and it must have software to generate a special packet.
When the PC is off, the PC that will command it to turn on creates a magic packet:
The magic packet is a broadcast frame containing anywhere within its payload 6 bytes of all 255 (FF FF FF FF FF FF in hexadecimal), followed by sixteen repetitions of the target computer's 48-bit MAC address, for a total of 102 bytes.
This packet is sent to everyone on the LAN. Each NIC checks the MAC address in it, and if it's a match, then tells the motherboard to power up the system.
With A UDP packet
For your question, it's far easier. The PC is up and MB/ NIC don't need to be aware of a special packet. A simple program, or script leveraging a program like nc, can be setup to listen for a UDP packet on a particular port with predefined contents.
Since UDP is connectionless, no overhead (transactional packets) is involved. A single packet is sufficient. What happens after receipt could be anything - power down, start another program, delete the contents of the hard drive...
You could send this packet from anywhere assuming the proper routing exists - it is just a normal point to point UDP message.
You could also, and in reality MUST, work in security features into the packet contents to authenticate the packet.
It would actually be a decent intro project to socket programming.
TCP Solution
Using a TCP packet requires overhead and regular messages to keep the socket alive, so that wouldn't fit your requirements.
But you could set up a firewall rule on the PC using iptables that would identify the TCP packet, and transform it into something usable as a trigger to fire off a program to carry out the desired activity. A bit kludgey but totally doable.
3Wake-on-LAN works with magic packets (no amperage), PoE (power over Ethernet) powers a device quite literally but doesn't need to turn it on (it just provides power). To turn a device off you, you would need to have it respond o another (custom) magic packet. In the case of PoE, just cut the power. – GiantTree – 2016-12-28T00:48:57.050
This is tangential, but in the wake on lan protocol, a magic packet is defined as: The magic packet is a broadcast frame containing anywhere within its payload 6 bytes of all 255 (FF FF FF FF FF FF in hexadecimal), followed by sixteen repetitions of the target computer's 48-bit MAC address, for a total of 102 bytes. I'm not sure where the no amperage comment comes from, but hopefully this clarifies it for some. – Argonauts – 2016-12-28T00:57:08.283
I am not sure if you can do a ssh connection in 1 packet or not, but a ssh connect followed by shutdown -h now or shutdown -s for windows would work. Also powershell. I don't know about 1 packet, but probably be done in 2-5. 1. send user/pass 2. receive acknowledgement 3. shutdown – cybernard – 2016-12-28T01:04:17.393
@cybernard SSH is normally over TCP and TCP requires a handshake which requires a packet from sender to receiver called the SYN, then a packet from reveicer to sender called the ACK. Then a packet from sender to receiver which I think is known as the SYN ACK. I don't know if or to what extent you can do SSH over UDP. e.g. http://superuser.com/questions/1127871/ssh-connection-under-udp anyhow SSH isn't going to be done in one packet. It needs to negotiate the encryption. It wouldn't even have a chance to really get started.
– barlop – 2016-12-28T04:59:29.9131might make more sense to do it with a UDP packet(as they don't requires a 3 way handshake), but maybe that, like I guess maybe WOL, requires support in the UEFI/BIOS as well as the NI(network interface). – barlop – 2016-12-28T05:03:30.920