Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update openbsd_connection_share.sh #1116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions scripts/openbsd_connection_share.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@ if test $(whoami) != root; then
fi

if [ "${USB_IFACE}" == "urndis0" ]; then
ifconfig ${USB_IFACE} ${USB_IP}
sysctl -w net.inet.ip.forwarding=1
echo "match out on egress inet from ${USB_IFACE}:network to any nat-to (egress:0)" | pfctl -f -
pfctl -f /etc/pf.conf
echo "sharing connecting from upstream interface to usb interface ${USB_IFACE} ..."
ifconfig ${USB_IFACE} down > /dev/null 2>&1
ifconfig veb10 del vport10 > /dev/null 2>&1
ifconfig veb10 destroy > /dev/null 2>&1
ifconfig vport10 destroy > /dev/null 2>&1
ifconfig veb10 create && ifconfig veb10 up
ifconfig vport10 create && ifconfig vport10 up
ifconfig vport10 ${USB_IP} && \
ifconfig veb10 add vport10 && \
ifconfig veb10 add ${USB_IFACE} && \
ifconfig ${USB_IFACE} up && \
sysctl -w net.inet.ip.forwarding=1
echo "match out log on egress from vport10:network to any nat-to (egress)" | pfctl -f -
echo "sharing connecting from upstream interface to usb interface ${USB_IFACE} ..."
printf "Now you should be able to do: ssh [email protected]\n"
else
echo "can't find usb interface with ip ${USB_IFACE}"
exit 1
echo "can't find usb interface with ip $USB_IP"
exit 1
fi