Skip to content

Instantly share code, notes, and snippets.

@afresh1
Last active May 8, 2020 17:24
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afresh1/274a19b78e8983e0dc9dd4ff1dfd407f to your computer and use it in GitHub Desktop.
Save afresh1/274a19b78e8983e0dc9dd4ff1dfd407f to your computer and use it in GitHub Desktop.
Find the default IPv6 gateway and start forwarding traffic on OpenBSD and Comcast (XFinity)
#!/bin/sh
egress=$1
internal=$2
# This should set up ipv6 on XFinity or Comcast on OpenBSD 6.1
# Stop everything
/usr/bin/pkill dhcp6c
route -qn delete -inet6 default
ifconfig $egress -inet6
# Turn on autoconf so we can find our default gateway
/sbin/ifconfig $egress inet6 autoconf
# Wait until we get a gateway
gateway=
while [ -z "$gateway" ]; do
sleep 1
gateway=$( route -qn get -inet6 default | awk '/gateway/ { print $2 }' )
done
# Now, add the default gateway statically,
# for reasons I don't understand
route -qn add -inet6 default $gateway
/usr/local/sbin/dhcp6c $egress $internal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment