From 11501bed2f3b9a0f6fb923d92d96884ed31e9e1d Mon Sep 17 00:00:00 2001 From: Simone Margaritelli Date: Mon, 30 Sep 2019 21:59:33 +0200 Subject: [PATCH] macos connection share script --- README.md | 2 +- scripts/macos_connection_share.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 scripts/macos_connection_share.sh diff --git a/README.md b/README.md index f568794..da6fc3e 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ usage: ./scripts/create_sibling.sh [OPTIONS] #### Host Connection Share -If you connect to the unit via `usb0` (thus using the data port), you might want to use the `scripts/linux_connection_share.sh` script to bring the interface up on your end and share internet connectivity from another interface, so you can update the unit and generally download things from the internet on it. +If you connect to the unit via `usb0` (thus using the data port), you might want to use the `scripts/(linux|macos)_connection_share.sh` script to bring the interface up on your end and share internet connectivity from another interface, so you can update the unit and generally download things from the internet on it. ### UI diff --git a/scripts/macos_connection_share.sh b/scripts/macos_connection_share.sh new file mode 100755 index 0000000..2528067 --- /dev/null +++ b/scripts/macos_connection_share.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# name of the ethernet gadget interface on the host +USB_IFACE=${1:-en8} +# host interface to use for upstream connection +UPSTREAM_IFACE=${2:-en7} + +sysctl -w net.inet.ip.forwarding=1 +pfctl -e +echo "nat on ${UPSTREAM_IFACE} from ${USB_IFACE}:network to any -> (${UPSTREAM_IFACE})" | pfctl -f -