new: macos connection share script now autodetects the usb interface and uses en0 as default upstream (closes #597)
This commit is contained in:
parent
a7e37115d9
commit
ab63ecccd7
@ -1,9 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# name of the ethernet gadget interface on the host
|
UPSTREAM_IFACE=${1:-en0}
|
||||||
USB_IFACE=${1:-en8}
|
USB_IFACE=''
|
||||||
# host interface to use for upstream connection
|
USB_IP=${2:-10.0.0.1}
|
||||||
UPSTREAM_IFACE=${2:-en7}
|
|
||||||
|
for i in $(ifconfig -lu); do
|
||||||
|
if ifconfig $i | grep -q "${USB_IP}" ; then USB_IFACE=$i; fi;
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$USB_IFACE" ]
|
||||||
|
then
|
||||||
|
echo "can't find usb interface with ip $USB_IP"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "sharing connecting from upstream interface $UPSTREAM_IFACE to usb interface $USB_IFACE ..."
|
||||||
|
|
||||||
sysctl -w net.inet.ip.forwarding=1
|
sysctl -w net.inet.ip.forwarding=1
|
||||||
pfctl -e
|
pfctl -e
|
||||||
|
Loading…
x
Reference in New Issue
Block a user