IPv6

From Braindump
Revision as of 10:56, 2 April 2023 by Jan (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Scope

Hexadecimal counting, one character is 4 bits count from 0-10 and then a,b,c,d,e,f 0000 0 0x0 0001 1 0x1 0010 2 0x2 0100 4 0x4 1000 8 0x8 1010 10 0xA 1011 11 0xB 1100 12 0xC 1111 15 0xF Two characters together is a byte 1000 0000 is 0x80 and 1111 1111 is 0xFF is 255

IPv6 Addresses are 128 bits long, written down in 8 times 2 bytes long separated by a colon, 2 colons to shorten a long row of zero's

1 means loopback address, so "own interface"

FE80::/10 is used for local communication.

FF01::/16 is used for Multicast addresses, where the network gets to decide which service is closest.

2001::/16 is used for Global Unicast Addresses.


The mask /16 defines how many bits are used for the network part. The rest is the host part, routing works on the network part

Each interface has one or more addresses. The link will have a default fe80 address which is not routable outside the link scope

fe80::7c0e:e6ff:fe7b:40f0/64
fe80 is link-local address
ff:fe (plus the first 'bit') makes eui-48 mac an eui-64
rfc8064 replace the address with a hash

The gateway gets an IP address from the provider. Global address starts with 2001, the provider is abcd, the subnet is efg0, the

2001:db8:efg0:1234::1/128
/16 2001 is for unicast addresses
/48 0db8 is for the providers, db8 specifically is for documentation
/56 efg0 is for the subnet-id
/64 bits for end users to subdivide



clients

Google Android does not support DHCPv6. It must use SLAAC for assigning IPv6 addresses. SLAAC must use /64 prefixes with EUI-64 host addresses.

OPNSense WAN IPv6 DHCP Client: Request Prefix-only LAN IPv6 track WAN, Prefix-ID 0x0 IPv6 Prefix ID Manual configuration V


DHCPv6 Configured

a000 - ::f000

/usr/local/sbin/radvd -p /var/run/radvd.pid -C /var/etc/radvd.conf -m syslog /var/etc/rarvd.conf

       foreach ($stanzas as $stanza) {
           $radvdconf .= "#\tprefix {$stanza} {\n";
           $stanza = strtok($stanza, '/');
           $stanza = $stanza."/64";
           $radvdconf .= "\tprefix {$stanza} {\n";

Stanza should have included Prefix-ID to make it /64


https://github.com/opnsense/docs/blob/master/source/manual/ipv6.rst https://github.com/opnsense/docs/blob/master/source/manual/radvd.rst

src/etc/inc/plugins.inc.d/dhcpd.inc

list (, $networkv6) = interfaces_primary_address6($dhcpv6if, $ifconfig_details); if (is_subnetv6($networkv6)) {

   $stanzas[] = $networkv6;

} $stanzas[] = "{$subnetv6}/{$vip['subnet_bits']}";

https://github.com/opnsense/core/blob/master/src/etc/inc/plugins.inc.d/dhcpd.inc#L353 Add If statement to replace prefix to /64




IPv6, assign IP address Setup routes DNS servers

DHCPv6 SLAAC M Managed Flag, advertise dhcpv6 exists O Other Flag, use DHCP to assign other parameters A Autonomous, use SLAAC Prefix to use EUI-64 and Privacy address

Prefix must be /64