uplink-gemini/articles/2022-01-06_000-ipv6-on-omnios.gmi
Matjaz Mesnjak 97fc149f49 Initial commit.
2022-01-07 15:32:19 +01:00

96 lines
3.9 KiB
Plaintext

# IPv6 on Omnios
How can I enable IPv6 on my Omnios server? It turns out it is actually simple. Most of it is configured automatically.
First we need to create a new address object with `ipadm`. Let's see what we have before we start:
``` bash code
root@server:# ipadm
ADDROBJ TYPE STATE ADDR
lo0/v4 static ok 127.0.0.1/8
bge0/v4 dhcp ok 192.168.5.136/24
lo0/v6 static ok ::1/128
```
These are my three existing address objects - `lo0/v4` is link-local IPv4, `lo0/v6` is link-local IPv6 that was created automatically at install time and `bge0/v4` that is my IPv4 address - a local network.
Now let's create `bge0/v6`.
``` bash code
root@server:# ipadm create-addr -T addrconf bge0/v6
```
This is it. We created new address object. Let's take a look how the list of addresses looks like now.
``` bash code
root@server:# ipadm
ADDROBJ TYPE STATE ADDR
lo0/v4 static ok 127.0.0.1/8
bge0/v4 dhcp ok 192.168.5.136/24
lo0/v6 static ok ::1/128
bge0/v6 addrconf ok fe80::9a4b:e1ff:fe08:8847/10
```
Note the new `bge0/v6` line. We have got a new IPv6 address. It is calculated from the MAC address of the interface.
Next we need to start IPv6 daemon We do that like this:
``` bash code
root@server:# /usr/lib/inet/in.ndpd
```
IPv6 is up and running. Lets ping some other device on the network:
``` bash code
root@server:# ping fe80::daec:5eff:fe17:e369
fe80::daec:5eff:fe17:e369 is alive
```
And last let us check our new configuration:
``` bash code
root@server:# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
bge0: flags=1004943<UP,BROADCAST,RUNNING,PROMISC,MULTICAST,DHCP,IPv4> mtu 1500 index 2
inet 192.168.5.136 netmask ffffff00 broadcast 192.168.5.255
ether 98:4b:e1:8:88:47
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
inet6 ::1/128
bge0: flags=20002000941<UP,RUNNING,PROMISC,MULTICAST,IPv6> mtu 1500 index 2
inet6 fe80::9a4b:e1ff:fe08:8847/10
ether 98:4b:e1:8:88:47
bge0:1: flags=20002080941<UP,RUNNING,PROMISC,MULTICAST,ADDRCONF,IPv6> mtu 1500 index 2
inet6 fd4a:c012:3f23:0:9a4b:e1ff:fe08:8847/64
bge0:2: flags=20002080941<UP,RUNNING,PROMISC,MULTICAST,ADDRCONF,IPv6> mtu 1500 index 2
inet6 2a01:261:2f0:6300:9a4b:e1ff:fe08:8847/64
```
We now have three IPv6 addresses. `bge0` that starts with `fe80` is a link-local address. It is used for getting the configuration from the router. Then there is `bge0:1` that starts with `fd4a`. This is a unique local address. And then there is `bge0:2` that starts with `2a01`. This is part of prefix assigned to me by my ISP. The address is globaly unique.
Let's test it some more ... I have a pihole server on my network that already uses IPv6. Let's ping it ...
``` bash code
root@server:# ping pi.hole
pi.hole is alive
root@server:# man ping
root@server:# ping -s -A inet6 -a pi.hole
PING pi.hole: 56 data bytes
64 bytes from pi.hole (fd4a:c012:3f23:0:9d9:b40a:5dc2:97df): icmp_seq=0. time=2,063 ms
64 bytes from pi.hole (fd4a:c012:3f23:0:9d9:b40a:5dc2:97df): icmp_seq=1. time=0,921 ms
64 bytes from pi.hole (fd4a:c012:3f23:0:9d9:b40a:5dc2:97df): icmp_seq=2. time=1,110 ms
64 bytes from pi.hole (fd4a:c012:3f23:0:9d9:b40a:5dc2:97df): icmp_seq=3. time=0,989 ms
64 bytes from pi.hole (fd4a:c012:3f23:0:9d9:b40a:5dc2:97df): icmp_seq=4. time=0,993 ms
^C
----pi.hole PING Statistics----
5 packets transmitted, 5 packets received, 0% packet loss
round-trip (ms) min/avg/max/stddev = 0,921/1,215/2,063/0,479
```
Works like a charm.
## More reading:
=> https://docs.oracle.com/cd/E23824_01/html/821-1453/ipv6-config-tasks-64.html Configuring an IPv6 Interface
=> https://www.tutorialspoint.com/ipv6/ipv6_address_types.htm IPv6 addressing