Skip to content

Instantly share code, notes, and snippets.

@moredure
Last active January 8, 2021 21:15
Show Gist options
  • Select an option

  • Save moredure/47c2887890db9a070b0284dcfcbb49e5 to your computer and use it in GitHub Desktop.

Select an option

Save moredure/47c2887890db9a070b0284dcfcbb49e5 to your computer and use it in GitHub Desktop.
Failover Proxy for service migration using iptables (like aiven do)
#!/bin/bash
iptables -t nat -A PREROUTING -p tcp --dport $PORT -j DNAT --to-destination $TARGET:$PORT
iptables -t nat -A POSTROUTING -j MASQUERADE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment