Coder Social home page Coder Social logo

reboot-on-lan's Introduction

reboot-on-lan

A silly Linux kernel module that allows a machine to be rebooted remotely with a single network packet.
Why? If you're often messing with a system over SSH, you'll probably understand why this can be useful. Indeed, even if the machine doesn't respond to SSH anymore, you may be able to reboot it and start fresh!

Instructions

  1. Build and insert the kernel module on the machine that will need to be rebooted. If you really love this module, you can autoload it on every boot.
  2. On your local machine, edit reboot-on-lan.sh and update the IP and MAC address (and password, if you changed it)
  3. Execute reboot-on-lan.sh. This sends a magic packet that triggers the reboot.

Disclaimer

  • Use at your own risk! And especially don't use it at work. This is a truly horrible solution. The magic packet will transit unencrypted.
    Anyone who learns your IP/MAC address/password (that includes anyone who can see your traffic) will be able to reboot your machine.
  • This requires the machine to have a running kernel with working IP connectivity.
  • The network packet will trigger an emergency restart - see https://github.com/torvalds/linux/blob/457c89965399115e5cd8bf38f9c597293405703d/kernel/reboot.c#L56\ This is the same thing that happens when you use the Magic SysRQ (Alt+PrintScreen+B).
    If you don't like this, you can change the module code to issue an orderly_reboot() instead.

Notes

This reuses the same "Magic Packet" format as Wake-on-LAN ( https://en.wikipedia.org/wiki/Wake-on-LAN )
As opposed to Wake-on-LAN, since this module requires the remote machine to have an IP address, there's no need for directed broadcast support or a static ARP table on the router. It should work out of the box as long as the machine is reachable via IP.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.