If you chose DHCP when first installing the OS, you may want to edit the networking configuration manually (to switch to a static IP).
Openbsd requires one hostname.if per device, where the letters 'if' are replaced with an abbreviation followed by a device number. So, for example, an Atheros IEEE 802.11a/b/g/n wifi device is abbreviated by athn0, and will need an /etc/hostname.athn0 file.
Replace if with your own device name. Inside /etc/hostname.if0, put:
inet 192.168.1.2 255.255.255.0 inet alias 192.168.1.3 255.255.255.0 inet6 2001:0db8:0000:0000:0000:0000:0000:0000 48 inet6 alias 2001:0db8:0000:0000:9b1d:3511:387e:143a 48 inet6 alias 2001:0db8:0000:0000:1465:fed1:8daf:66ff 48 inet6 alias 2001:0db8:0000:0000:11b4:4a36:2941:d6bd 48 inet6 alias 2001:0db8:0000:0000:ad2c:5b99:2b1a:89d1 48 inet6 alias 2001:0db8:0000:0000:921d:28ad:4729:8d93 48 inet6 alias 2001:0db8:0000:0000:c9bb:45f7:c494:1fc1 48 inet6 alias 2001:0db8:0000:0000:5142:9b81:dec2:186c 48 inet6 alias 2001:0db8:0000:0000:a118:dd85:a14f:72d7 48 inet6 alias 2001:0db8:0000:0000:91f2:4943:de98:c9d5 48 inet6 alias 2001:0db8:0000:0000:18a4:1ca3:5d31:2ddc 48 inet6 alias 2001:0db8:0000:0000:31af:1656:16cf:611a 48 inet6 alias 2001:0db8:0000:0000:8d27:5b44:3e75:4b86 48 inet6 alias 2001:0db8:0000:0000:a259:79f6:fa54:a5e2 48 inet6 alias 2001:0db8:0000:0000:59d8:f8ae:18a3:3644 48 inet6 alias 2001:0db8:0000:0000:1dc7:c1c7:7b16:1151 48 inet6 alias 2001:0db8:0000:0000:1c46:b131:e9de:edc1 48 inet6 alias 2001:0db8:0000:0000:e72b:6165:b6fb:161f 48 inet6 alias 2001:0db8:0000:0000:244c:47c2:f8fd:4bc2 48 inet6 alias 2001:0db8:0000:0000:f664:e887:826d:64c5 48 inet6 alias 2001:0db8:0000:0000:f8e7:1ca5:4852:9e78 48 inet6 alias 2001:0db8:0000:0000:59e5:7568:ab7f:289f 48 inet6 alias 2001:0db8:0000:0000:111e:6834:a1b1:64ff 48 inet6 alias 2001:0db8:0000:0000:de32:1311:18d4:6f8b 48 inet6 alias 2001:0db8:0000:0000:5714:1f81:156f:572b 48 inet6 alias 2001:0db8:0000:0000:2589:ad14:872a:fa94 48 inet6 alias 2001:0db8:0000:0000:5b15:e14f:812e:fa84 48 inet6 alias 2001:0db8:0000:0000:5982:9c11:c2eb:c6ed 48 inet6 alias 2001:0db8:0000:0000:abaf:88e4:69e1:f2a5 48 inet6 alias 2001:0db8:0000:0000:a52b:5de1:ceba:b65a 48 inet6 alias 2001:0db8:0000:0000:7e8b:f585:f2e7:66a1 48 inet6 alias 2001:0db8:0000:0000:46ad:1add:cb77:154b 48 inet6 alias 2001:0db8:0000:0000:b664:368a:d94b:3ce8 48
Let's look at the first two lines:
inet 192.168.1.2 255.255.255.0 inet alias 192.168.1.3 255.255.255.0
The first line will set the device to use the static IP 192.168.1.2 with subnet mask 255.255.255.0. The second line will allow the device to use a second static IP, 192.168.1.3. It will be aliased to the first and have the same subnet mask.
Let's look at lines 3 and 4:
inet6 2001:0db8:0000:0000:0000:0000:0000:0000 48 inet6 alias 2001:0db8:0000:0000:9b1d:3511:387e:143a 48
The first one sets the device to use the static IPv6 address 2001:0db8:: with a /48 subnet, and the second one creates another IPv6 address 2001:0db8:0000:0000:9b1d:3511:387e:143a with a /48 subnet, aliased to the first IPv6 address. In this way, you can create dozens of unique IPv6 addresses so that each user on a shell account or bouncer can get a unique IPv6 address.
You will also need to specify the default gateway in /etc/mygate:
192.168.1.1 2001:0db8:0000:0000::1
Sometimes, to restart networking, I will run:
$ doas sh /etc/netstart
But this doesn't seem to properly reset the networking sometimes.
Watch out! Iked, without the -6 flag, will block all IPv6 traffic.
If you later decide you want to add a new ipv6 address, use ifconfig:
$ doas ifconfig if0 inet6 2001:0db8::/64
To delete the IPv6 address:
$ doas ifconfig if0 inet6 2001:0db8::/64 delete
Replace if0 with your specific interface.
To test if an IPv6 address is working, you can use netcat to connect to an IRC network that supports IPv6:
$ nc -s 2001:0db8:: ipv6.ircnow.org 6667 nick newnick user newuser * * :newuser PING :12345 PONG :12345
If that loads a message, then you configured the IPv6 address 2001:0db8:: correctly.