Skip to content

Commit 0e6b8c5

Browse files
committed
Update README and example config.
1 parent 589d2fb commit 0e6b8c5

3 files changed

Lines changed: 71 additions & 19 deletions

File tree

README.md

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# wol-socket-proxy
22

3-
A socket proxy with wake-on-lan feature.
3+
A socket proxy with wake-on-lan and IPMI power control feature.
44

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.
611

712
## Requirements
813

914
Python 3.12+
1015

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.
1217

1318
## Usage
1419

@@ -47,23 +52,50 @@ The `wolsocketproxy.conf` has the following structure:
4752
```json5
4853
{
4954
// 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+
5077
// Define forwarding routes
5178
"routes": [
5279
{
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"
5886
},
5987
// ... more routes ...
6088
],
6189

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+
]
68100
}
69101
```

docker/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ services:
88
- /mnt/data/wolsocketproxy/config:/app/config:Z
99
restart: always
1010
# Only host network can forward wol packets
11+
# If you only use IPMI, then you do not need this
1112
network_mode: host
1213

wolsocketproxy.conf.example

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
11
{
2+
"machines": {
3+
"some-server": {
4+
"mac_address": "11:22:33:44:55:66",
5+
"wake_up_method": "ipmi",
6+
"ipmi_config_name": "some-server-ipmi",
7+
"online_check_method": "http",
8+
"online_check_http_url": "http://192.168.1.124/health",
9+
"online_check_timeout": 300,
10+
"online_check_http_expected_code": 200,
11+
"ipmi_force_reset_if_power_up_failed": true,
12+
"ipmi_max_reset_try_count": 3
13+
}
14+
},
215
"routes": [
316
{
417
"local_address": "0.0.0.0",
518
"local_port": 12345,
6-
"target_address": "192.168.0.100",
7-
"target_port": 22,
19+
"target_machine_name": "some-server",
20+
"target_address": "192.168.1.124",
21+
"target_port": 12345,
822
"protocol": "tcp"
923
}
1024
],
11-
"mac_mappings": {
12-
"192.168.0.100": "11:22:33:44:55:66"
13-
}
25+
"ipmi_configs": [
26+
{
27+
"name": "some-server-ipmi",
28+
"redfish_url": "https://192.168.1.123/",
29+
"username": "admin",
30+
"password": "123456"
31+
}
32+
]
1433
}

0 commit comments

Comments
 (0)