Skip to content

Commit

Permalink
Merge pull request ChristianLempa#115 from ChristianLempa:wakeonlan
Browse files Browse the repository at this point in the history
Wakeonlan integration
  • Loading branch information
ChristianLempa authored Aug 11, 2023
2 parents d0305c2 + 07c5fad commit 9788707
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
16 changes: 16 additions & 0 deletions linux/etherwake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Etherwake

Etherwake is a command-line utility for sending [Wake-on-LAN (WoL)](../networking/wakeonlan.md) magic packets to wake up a device over a network connection. It allows you to wake up a device by specifying its MAC address as an argument, and it sends the magic packet to the broadcast address of the network interface that is specified.

Here's an example of how to use Etherwake to wake up a device with a specific MAC address:

```sh
sudo etherwake -i eth0 00:11:22:33:44:55
```

In this example, `sudo` is used to run the command with administrative privileges, `-i eth0` specifies the network interface to use (in this case, `eth0`), and `00:11:22:33:44:55` is the MAC address of the device to wake up.

The command sends a Wake-on-LAN magic packet to the broadcast address of the `eth0` network interface, which should wake up the device with the specified MAC address if Wake-on-LAN is enabled on the device.

Note that the exact syntax and options for `etherwake` may vary depending on your operating system and version of the utility. You can usually find more information and examples in the `etherwake` manual page (`man etherwake`).

62 changes: 62 additions & 0 deletions linux/ethtool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Ethtool

**Ethtool** is a command-line utility used in [Linux](../linux/linux.md) systems to query and control network interface settings. It provides information about the network interface cards (NICs) installed on a system, such as link status, driver information, speed, duplex mode, and more, and allows you to modify certain settings of a network interface.


## Using Ethtool to view network interface information

To view general information about a specific network interface (e.g., eth0), use the following command:

```sh
ethtool interface_name
```

If you want to retrieve only the link status of an interface, you can use the -i option followed by the interface name:

```sh
ethtool -i interface_name
```


## Using Ethtool to change network interface settings

**Ethtool** allows you to modify certain settings of a network interface. For example, you can manually set the speed and duplex mode, enable or disable features like [Wake-on-LAN](../networking/wakeonlan.md) or [autonegotiation](../networking/autonegotiation.md), configure flow control settings, and adjust ring buffer sizes.

### Manually set the speed and duplex mode of a network interface

To manually set the speed and duplex mode of a network interface (e.g., eth0) to a specific value, use the following command:

```sh
ethtool -s interface_name speed interface_speed duplex interface_duplex
```

If you want to enable or disable autonegotiation on a specific interface, you can use the following command:

```sh
ethtool -s interface_name autoneg on
ethtool -s interface_name autoneg off
```

### Enable Wake On LAN (WoL) on the network adapter

Use the following command to check if your network interface supports Wake On LAN (WoL):

```sh
sudo ethtool interface_name | grep "Wake-on"
```

If the output shows "Wake-on: d", it means that Wake On LAN (WoL) is disabled.

To enable Wake On LAN (WoL), use the following command:

```sh
sudo ethtool -s interface_name wol g
```

### Make the Wake On LAN (WoL) setting persistent across reboots

To make the Wake On LAN (WoL) setting persistent across reboots, add the following line to the `/eth/network/interfaces` file:

```sh
post-up /usr/sbin/ethtool -s interface_name wol g
```
7 changes: 7 additions & 0 deletions networking/autonegotiation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Autonegotiation

**Autonegotiation** is a feature in Ethernet networking that allows two connected devices to automatically negotiate and establish the best possible parameters for communication. When two devices with **autonegotiation** capability are connected, they exchange information about their supported capabilities, such as link speed (e.g., 10 Mbps, 100 Mbps, 1 Gbps), duplex mode (e.g., half-duplex or full-duplex), and flow control.

Based on this information, the devices negotiate and agree upon the highest mutually supported settings for optimal communication.

**Autonegotiation** helps ensure compatibility and optimal performance between network devices. It eliminates the need for manual configuration and allows network devices to adapt to different speeds and duplex modes based on the capabilities of the connected devices.
14 changes: 14 additions & 0 deletions networking/wakeonlan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Wake On LAN (WOL)

**Wake on LAN (WoL)** is a network protocol that allows a device to be powered on remotely over a network connection. It works by sending a special network message, called a magic packet, to the device's MAC address, which triggers the device to power on from a low-power state. **Wake on LAN (WoL)** is commonly used to remotely wake up computers for maintenance or to access files, among other purposes.


## Using Wake on LAN (WoL)

Some operating systems have settings that can enable or disable **Wake on LAN (WoL)** for network interfaces. For example, on [Linux](../linux/linux.md), you can use the [ethtool](../linux/ethtool.md) command to enable **Wake on LAN (WoL)** for a network interface.

Some network card drivers may have settings or options that control **Wake on LAN (WoL)** behavior. You can usually find these settings in the advanced properties or settings for the network adapter in the Device Manager on Windows or with the [ethtool](../linux/ethtool.md) command on [Linux](../linux/linux.md).

### Enabling Wake on LAN (WoL)

Enabling **Wake on LAN (WoL)** typically involves a combination of these methods, depending on the device and operating system you are using. Once **Wake on LAN (WoL)** is enabled, you can use a utility like [etherwake](../linux/etherwake.md) or `wakeonlan` to send magic packets to wake up the device remotely.

0 comments on commit 9788707

Please sign in to comment.