Files

22 lines
853 B
Bash
Raw Permalink Normal View History

#!/bin/sh
# gw-entrypoint.sh — shared by all simulated ZT exit gateways.
#
# Argument 1: this gateway's IP (within 10.11.12.0/24)
# Argument 2: router's ZT-side IP (10.11.12.1 by default; here we use the
# docker-compose gateway of the zt-exit-net network).
set -eu
my_ip="${1:?missing my_ip}"
router_ip="${2:-10.11.12.1}"
echo 1 > /proc/sys/net/ipv4/ip_forward
# Reply to ARP for our own IP (already done by the kernel). Make sure we
# can reach the WIBLAN subnet by routing back through the router.
ip route replace 10.11.13.0/24 via "$router_ip" 2>/dev/null || true
# Simple ping responder is all we need for pre-flight tests. No NAT/NAT
# rules required because test traffic only verifies the policy routing on
# the router side, not end-to-end internet egress.
echo "[gw ${my_ip}] up; routes via ${router_ip}"
exec sleep infinity