#!/usr/bin/env bash set -euo pipefail PROG="nat-share" # Defaults SUBNET_PREFIX="10.42.0" NETMASK="24" DHCP_NETMASK="255.255.255.0" DHCP_START_HOST="10" DHCP_END_HOST="254" LEASE_TIME="12h" UPSTREAM="" IFACE="" DNS_SERVER="" BACKEND="auto" PXE_ROOT="" PXE_SCRIPT="netboot.ipxe" HTTP="" HTTP_PORT="8079" usage() { cat >&2 < Start a DHCP + DNS (dnsmasq) NAT server on , sharing the host's upstream internet connection with clients on that link. The interface is unmanaged from NetworkManager while the server runs; every change (IP, NetworkManager state, forwarding sysctl, firewall rules) is reverted on exit. Runs in the foreground. Press Ctrl+C to stop and restore. Options: -u, --upstream Upstream/WAN interface to NAT through (default: interface of the current default route) -s, --subnet /24 subnet prefix for the served link (default: ${SUBNET_PREFIX}, gateway .1) --range DHCP host range within the /24 (default: ${DHCP_START_HOST}-${DHCP_END_HOST}) --lease