executable_mjru-vpn.sh 490 B

123456789101112131415161718192021
  1. #!/usr/bin/env bash
  2. set -o errexit
  3. set -o xtrace
  4. set -o pipefail
  5. # This scripts establish a VPN tunnel to Majordomo and setups NAT rules.
  6. tap="$1"
  7. openvpn --config /etc/openvpn/mj-client.conf
  8. # NAT
  9. iptables -t nat -A POSTROUTING -o "$tap" -j MASQUERADE
  10. iptables -A FORWARD -i "$tap" -o br0 -m state --state RELATED,ESTABLISHED -j ACCEPT
  11. iptables -A FORWARD -i br0 -o "$tap" -j ACCEPT
  12. # HMS billing
  13. ip r add 78.108.80.178/32 via 172.16.100.3
  14. ip r add 78.108.80.171/32 via 172.16.100.3