Last active
May 8, 2020 17:24
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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