You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/ns-ha/README.md
+42-18Lines changed: 42 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Limitations:
14
14
- WAN must be configured with DHCP
15
15
- Extra packages such as NUT are not supported
16
16
- rsyslog configuration is not synced: if you need to send logs to a remote server, you must use the controller
17
-
- Hotspot is not supported since it requires a new registration when the primary node goes down because the MAC address associated with the hotspot interface will be different
17
+
- Hotspot is not supported since it requires a new registration when the main node goes down because the MAC address associated with the hotspot interface will be different
18
18
19
19
The following features are supported:
20
20
@@ -54,12 +54,36 @@ The setup process configures the following:
54
54
- Configures conntrackd to sync the connection tracking table
55
55
56
56
In this example:
57
-
-`main` is the primary node, with LAN IP `192.168.100.238` and HA IP `10.12.12.1`
58
-
-`backup` is the backup node, with LAN IP `192.168.100.237` and HA IP `10.12.12.2`
57
+
-`main_node_ip` is the main node, with LAN IP `192.168.100.238` and HA IP `10.12.12.1`
58
+
-`backup_node_ip` is the backup node, with LAN IP `192.168.100.239` and HA IP `10.12.12.2`
59
59
- the virtual IP is `192.168.100.240`
60
60
61
-
1. On the primary node:
62
-
- Name the primary firewall `main`
61
+
### Automatic configuration
62
+
63
+
The package provides a script to configure the HA cluster automatically:
64
+
```
65
+
ns-ha-config <main_ip> <backup_ip> <virtual_ip>
66
+
```
67
+
68
+
The script will:
69
+
- configure the main node with the main IP and virtual IP
70
+
- read the password and public key from the main node
71
+
- configure the backup node with the backup IP and virtual IP using SSH: you may need to enter the password of the backup node
72
+
73
+
Assumptions:
74
+
75
+
- the LAN of the main node has a static IP address on the LAN interface already set to `main_node_ip`
76
+
- the LAN of the backup node has a static IP address on the LAN interface already set to `backup_node_ip`
The `password` and `pubkey` fields must be used in the backup node configuration.
75
99
- Apply the configuration:
@@ -82,12 +106,12 @@ In this example:
82
106
83
107
2. On the backup node:
84
108
- Name the backup firewall `backup`
85
-
- Set `eth0` (LAN) to static IP: `192.168.100.237/24`
109
+
- Set `eth0` (LAN) to static IP: `192.168.100.239/24`
86
110
- Set `eth1` (WAN) to DHCP (no PPPoE)
87
111
- The `eth2` interface will be used for the HA configuration
88
-
- Setup the configuration that will: create the `ha` zone, configure the IP for the HA interface, setup keepalived. Use the `password` and `pubkey` from the primary node:
112
+
- Setup the configuration that will: create the `ha` zone, configure the IP for the HA interface, setup keepalived. Use the `password` and `pubkey` from the main node:
The HA cluster consists of two nodes: one is the primary and the other is the backup.
100
-
All configurations must be always done on the primary node.
123
+
The HA cluster consists of two nodes: one is the main and the other is the backup.
124
+
All configurations must be always done on the main node.
101
125
The configuration is then automatically synchronized to the backup node.
102
126
103
-
Keepalived runs a specially crafted rsync script (`/etc/keepalived/scripts/ns-rsync.sh`) on the primary node to:
127
+
Keepalived runs a specially crafted rsync script (`/etc/keepalived/scripts/ns-rsync.sh`) on the main node to:
104
128
- export WireGuard interfaces, IPsec interfaces, and routes to `/etc/ha`
105
129
- synchronize all files listed by `sysupgrade -l` and custom files added with the `add_sync_file` option from scripts inside `/etc/hotplug.d/keepalived` directory;
106
130
files are synchronized to the backup node inside the directory `/usr/share/keepalived/rsync/`
@@ -113,16 +137,16 @@ The event is triggered with an `ACTION` parameter that can be:
113
137
During this phase, all directories (like `/etc/openvpn` and `/etc/ha`) are synched to the original position.
114
138
Also WireGuard interfaces, IPsec interfaces and routes are imported from the `/etc/ha` directory but in disabled state.
115
139
116
-
- `NOTIFY_MASTER`: the script can be executed both on the primary and on the backup node:
117
-
- on the primary node, after keepalived is started: this is the normal startup state
140
+
- `NOTIFY_MASTER`: the script can be executed both on the main and on the backup node:
141
+
- on the main node, after keepalived is started: this is the normal startup state
118
142
- on the backup node, after a switchover has been done: this is the failover state;
119
-
all WireGuard interfaces, IPsec interfaces and routes previously imported from the `/etc/ha` are enabled if they were enabled on the primary node
143
+
all WireGuard interfaces, IPsec interfaces and routes previously imported from the `/etc/ha` are enabled if they were enabled on the main node
120
144
121
-
- `NOTIFY_BACKUP`: the script is executed on the backup node, after keepalived is started or if the primary returns up after a downtime
145
+
- `NOTIFY_BACKUP`: the script is executed on the backup node, after keepalived is started or if the main returns up after a downtime
122
146
All non-required services are disabled, including WireGuard interfaces, IPsec interfaces and routes.
123
147
124
-
The backup node keeps the configuration in sync with the primary node, but most services, including crontabs, are disabled.
125
-
The following cronjobs are disabled on the backup node and enabled on the primary node:
148
+
The backup node keeps the configuration in sync with the main node, but most services, including crontabs, are disabled.
149
+
The following cronjobs are disabled on the backup node and enabled on the main node:
0 commit comments