|
1 | 1 | # wol-socket-proxy |
2 | 2 |
|
3 | | -A socket proxy with wake-on-lan feature. |
| 3 | +A socket proxy with wake-on-lan and IPMI power control feature. |
4 | 4 |
|
5 | | -It can forward TCP(bidirectional) and UDP(send-only) traffic from local machine to remote machine, and send a magic packet to wake it (wake-on-lan) before forwarding traffic if the remote machine does not respond to ICMP ping. |
| 5 | +It can forward TCP(bidirectional) and UDP(send-only) traffic from local machine to remote machine, and: |
| 6 | + |
| 7 | +- send a magic packet to wake it (wake-on-lan) |
| 8 | +- invoke IPMI power on to wake it |
| 9 | + |
| 10 | +before forwarding traffic if the remote machine does not respond to ICMP ping or some HTTP URL. |
6 | 11 |
|
7 | 12 | ## Requirements |
8 | 13 |
|
9 | 14 | Python 3.12+ |
10 | 15 |
|
11 | | -The remote machine must accept and respond to ICMP ping requests. |
| 16 | +The remote machine must accept and respond to ICMP ping requests if you use `ping` method. |
12 | 17 |
|
13 | 18 | ## Usage |
14 | 19 |
|
@@ -47,23 +52,50 @@ The `wolsocketproxy.conf` has the following structure: |
47 | 52 | ```json5 |
48 | 53 | { |
49 | 54 | // NOTE: Comments are not allowed in actual config file |
| 55 | + |
| 56 | + // Define machines |
| 57 | + "machines": { |
| 58 | + "some-server": { |
| 59 | + "ip_address": "192.168.1.124", // the IP address of this machine, optional |
| 60 | + "mac_address": "11:22:33:44:55:66", // The MAC address of this machine, optional |
| 61 | + "wake_up_method": "ipmi", // How to wake up this machine |
| 62 | + // "ipmi" - You must specify "ipmi_config_name" |
| 63 | + // "wol" - You must specify "mac_address" |
| 64 | + "ipmi_config_name": "some-server-ipmi", // IPMI config of this machine, must match what defined in "ipmi_configs" |
| 65 | + "online_check_method": "http", // How to check this machine is online |
| 66 | + // "http" - You must specify "online_check_http_url" |
| 67 | + // "ping" - You must specify "ip_address" |
| 68 | + "online_check_http_url": "http://192.168.1.124/health", // The URL used to check if machine is online, optional |
| 69 | + "online_check_timeout": 300, // Timeout when checking machine is online, seconds, optional, default is 300 |
| 70 | + "online_check_http_expected_code": 200, // Expected HTTP status code when using "http" method, optional, default is 200 |
| 71 | + "ipmi_force_reset_if_power_up_failed": true, // Use IPMI power reset if this machine is not online after timeout, optional, default is false |
| 72 | + "ipmi_max_reset_try_count": 3 // Max IPMI power reset retry count before giving-up, optional, default is 3 |
| 73 | + }, |
| 74 | + // ... more machines ... |
| 75 | + }, |
| 76 | + |
50 | 77 | // Define forwarding routes |
51 | 78 | "routes": [ |
52 | 79 | { |
53 | | - "local_address": "0.0.0.0", // The local address to listen |
54 | | - "local_port": 12345, // The local port to listen |
55 | | - "target_address": "192.168.0.100", // The target address forwarding to |
56 | | - "target_port": 22, // The target port forwarding to |
57 | | - "protocol": "tcp" // The protocol to use |
| 80 | + "local_address": "0.0.0.0", // The local address to listen |
| 81 | + "local_port": 12345, // The local port to listen |
| 82 | + "target_machine_name": "some-server", // The target machine name, must match what defined in "machines" |
| 83 | + "target_address": "192.168.1.124", // The target address forwarding to |
| 84 | + "target_port": 12345, // The target port forwarding to |
| 85 | + "protocol": "tcp" // The protocol to use, can choose "tcp" or "udp" |
58 | 86 | }, |
59 | 87 | // ... more routes ... |
60 | 88 | ], |
61 | 89 |
|
62 | | - // Tell the program about the MAC address of each IP in routes |
63 | | - "mac_mappings": { |
64 | | - // Key is IP address, and value is MAC address, case-insensitive |
65 | | - "192.168.0.100": "11:22:33:44:55:66", |
66 | | - // ... more items ... |
67 | | - } |
| 90 | + // Define IPMI configs, optional |
| 91 | + "ipmi_configs": [ |
| 92 | + { |
| 93 | + "name": "some-server-ipmi", // IPMI config name |
| 94 | + "redfish_url": "https://192.168.1.123/", // IPMI Redfish API base URL (should not contain /redfish/v1) |
| 95 | + "username": "admin", // IPMI Redfish API login username |
| 96 | + "password": "123456" // IPMI Redfish API login password |
| 97 | + }, |
| 98 | + // ... more IPMI configs ... |
| 99 | + ] |
68 | 100 | } |
69 | 101 | ``` |
0 commit comments