add openbsd connection share

This commit is contained in:
gonzalo-
2021-10-31 15:16:53 +01:00
committed by GitHub
parent a5d5533acf
commit 223d3fb192

View File

@ -0,0 +1,15 @@
#!/bin/sh
USB_IFACE=$(ifconfig urndis0 | grep urndis0 | awk '{print $1}' | tr -d ':')
USB_IP=${2:-10.0.0.1}
if [ "${USB_IFACE}" == "urndis0" ]; then
ifconfig ${USB_IFACE} ${USB_IP}
sysctl -w net.inet.ip.forwarding=1
pfctl -e
echo "match out on egress inet from ${USB_IFACE}:network to any nat-to (egress:0)" | pfctl -f -
echo "sharing connecting from upstream interface to usb interface ${USB_IFACE} ..."
else
echo "can't find usb interface with ip $USB_IP"
exit 1
fi