Skip to content

Instantly share code, notes, and snippets.

@bsiegert
Created February 15, 2016 20:38
Show Gist options
  • Save bsiegert/3c0bacdda2ab8f35bb3a to your computer and use it in GitHub Desktop.
Save bsiegert/3c0bacdda2ab8f35bb3a to your computer and use it in GitHub Desktop.

Making networking work on NetBSD on GCE needs the "Local Subnet" extension to DHCP from RFC 3442, which NetBSD's dhclient does not support.

In my example, the local IP is 10.240.0.4, the default gateway is supposed to be 10.240.0.1. The DHCP reply contains a netmask of 255.255.255.255 (/32), so the gateway is on a different "subnet". Here is the incantation to make the default route work:

route add -net 10.240.0.1/32 -link -cloning -iface vioif0
route add default -ifa 10.240.0.4 10.240.0.1

netstat -rnf inet then shows:

Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use    Mtu Interface
default            10.240.0.1         UGS         -        -      -L vioif0
10.240.0.1         42:01:0a:f0:00:01  UHLc        -        -      -L vioif0
10.240.0.1/32      link#1             UCS         -        -      -  vioif0
10.240.0.4         42:01:0a:f0:00:04  UHLl        -        -      -  lo0
10.240.0.4/32      link#1             UC          -        -      -  vioif0
127/8              127.0.0.1          UGRS        -        -  33648  lo0
127.0.0.1          lo0                UHl         -        -  33648  lo0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment