Skip to content

Commit ce622de

Browse files
authored
improve the coherence requirements faq - re iptables (#1480)
1 parent 8f6226f commit ce622de

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

docs-source/content/faq/coherence-requirements.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,52 @@ the output is now an empty list.
9090
After making this change, restart your domain(s) and the Coherence cluster
9191
should now form correctly.
9292

93-
94-
93+
#### Make iptables updates permanent across reboots
94+
95+
The recommended way to make `iptables` updates permanent across reboots is
96+
to create a `systemd` service that applies the necessary updates during
97+
the startup process.
98+
99+
Here is an example, but you may need to adjust this to suit your own
100+
environment:
101+
102+
* Create a `systemd` service:
103+
104+
```bash
105+
echo 'Set up systemd service to fix iptables nat chain at each reboot (so Coherence will work)...'
106+
mkdir -p /etc/systemd/system/
107+
cat > /etc/systemd/system/fix-iptables.service << EOF
108+
[Unit]
109+
Description=Fix iptables
110+
After=firewalld.service
111+
After=docker.service
112+
113+
[Service]
114+
ExecStart=/sbin/fix-iptables.sh
115+
116+
[Install]
117+
WantedBy=multi-user.target
118+
EOF
119+
```
120+
121+
* Create the script to update `iptables`:
122+
123+
```bash
124+
cat > /sbin/fix-iptables.sh << EOF
125+
#!/bin/bash
126+
echo 'Fixing iptables rules for Coherence issue...'
127+
TIMES=$((`iptables -t nat -v -L POST_public_allow -n --line-number | wc -l` - 2))
128+
COUNTER=1
129+
while [ $COUNTER -le $TIMES ]; do
130+
iptables -t nat -v -D POST_public_allow 1
131+
((COUNTER++))
132+
done
133+
EOF
134+
```
135+
136+
* Start the service (or just reboot):
137+
138+
```bash
139+
echo 'Start the systemd service to fix iptables nat chain...'
140+
systemctl enable --now fix-iptables
141+
```

0 commit comments

Comments
 (0)