[筆記] GCP IPv6 沒有 default route
`/etc/dhcp/dhclient-exit-hooks.d/ipv6`
```bash
# To enable this script set the following variable to "yes"
RUN="yes"
interface_index=1
if [ "$RUN" != "yes" ]; then
exit 0
fi
if [ "$reason" != "BOUND6" ]; then
exit 0
fi
new_ipv6_gateway=$(curl -s http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/$interface_index/gateway-ipv6 -H "Metadata-Flavor: Google")
if [ -z "$(ip -6 route show default)" ]; then
action=add
else
action=replace
fi
ip -6 route $action default via $new_ipv6_gateway dev $interface
```
Ref:
- https://serverfault.com/a/528425/865075
- https://cloud.google.com/compute/docs/ip-addresses/configure-ipv6-address#ipv6-assignment
- https://groups.google.com/g/ipv6hackers/c/zB527nJS1xI
2024-07-25 00:17:01
留言
Last fetch: --:--
現在還沒有留言!