Running Multiple PreSearch nodes on one host using multiple IP addresses

nano /etc/sysctl.conf
change/verify net.ipv4.ip_forward to = 1

For each IP address (change the number after the : to the next higher number each time; change the docker network to the next higher subnet [,, etc], increment the docker bridge name for each IP [bridge-ps2, bridge-ps3, etc.]):

cd /etc/sysconfig/network-scripts/

cp ifcfg-eno1 ifcfg-eno1:0

nano ifcfg-e*1:0
change DEVICE=eno1 to DEVICE=eno1:0
change IPADDR= to your other IP

/etc/init.d/network restart

docker network create --subnet --gateway= --attachable --opt '' bridge-ps1
optional to verify: docker network inspect bridge-ps1

Set the to-source to the other IP address from above

iptables -t nat -I POSTROUTING -p all -s ! -o bridge-ps1 -j SNAT --to-source {IP-ADDRESS}

docker run --rm --network bridge-ps1 byrnedo/alpine-curl
validate IP matches

screen -S presearch

docker stop presearch-node ; docker rm presearch-node ; docker stop presearch-auto-updater ; docker rm presearch-auto-updater ; docker run -d --name presearch-auto-updater --restart=unless-stopped -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --cleanup --interval 300 presearch-node ; docker pull presearch/node ; docker run -dt --network bridge-ps1 --name presearch-node --restart=unless-stopped -v presearch-node-storage:/app/node -e REGISTRATION_CODE={REGISTRATION-CODE} presearch/node ; docker logs -f presearch-node
ctrl-a d

validate reboot works properly

iptables troubleshooting

iptables -t nat -v -L POSTROUTING -n --line-number

iptables -t nat -D POSTROUTING {line-number}

This article was updated on 2023-08-03

I'm nabeards. I'm a full stack JavaScript developer. I travel full time, a.k.a., Professional Wanderer, a.k.a., Digital Nomad.