IPv6: Difference between revisions

From Braindump
Jump to navigation Jump to search
No edit summary
 
Line 1: Line 1:
=== Scope ===
=== Scope ===
Hexadecimal counting, one character is 4 bits count from 0-10 and then a,b,c,d,e,f
Decimal counting goes to 10. Hexadecimal counts to 16. It uses the numbers 0-10 and then A,B,C,D,E,F. Computers use binary counting with bit 0 or 1 and 4-bit groups can be expressed in hexadecimal.
0000 0 0x0
{| class="wikitable"
0001 1 0x1
|+
0010 2 0x2
!
0100 4 0x4
!BIN
1000 8 0x8
!DEC
1010 10 0xA
!HEX
1011 11 0xB
|-
1100 12 0xC
|
1111 15 0xF
|0000
|0
|0
|-
|
|0001
|1
|1
|-
|
|0010
|2
|2
|-
|
|0011
|3
|4
|-
|
|0100
|4
|4
|-
|
|0101
|5
|5
|-
|
|0110
|6
|6
|-
|
|0111
|7
|7
|-
|
|1000
|8
|8
|-
|
|1001
|9
|9
|-
|
|1010
|10
|A
|-
|
|1011
|11
|B
|-
|
|1100
|12
|C
|-
|
|1101
|13
|D
|-
|
|1110
|14
|E
|-
|
|1111
|15
|F
|-
|
|1_0000
|16
|10
|-
|
|1_0001
|17
|11
|-
|
|0111_1111
|127
|7F
|-
|
|1000_0000
|128
|80
|-
|
|1111_1111
|255
|FF
|}
Two characters together is a byte 1000 0000 is 0x80 and 1111 1111 is 0xFF is 255
Two characters together is a byte 1000 0000 is 0x80 and 1111 1111 is 0xFF is 255


Line 21: Line 124:


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




Line 39: Line 143:
  /56 efg0 is for the subnet-id
  /56 efg0 is for the subnet-id
  /64 bits for end users to subdivide
  /64 bits for end users to subdivide
=== clients ===
=== 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.
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
OPNSense - WAN IPv6 DHCP Client: Request Prefix-only - LAN IPv6 track WAN, Prefix-ID 0x0
WAN IPv6 DHCP Client: Request Prefix-only
 
LAN IPv6 track WAN, Prefix-ID 0x0
IPv6 Prefix ID
IPv6 Prefix ID
Manual configuration V
Manual configuration V


DHCPv6 Configured
DHCPv6 Configured
Line 58: Line 156:


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


Line 67: Line 166:


Stanza should have included Prefix-ID to make it /64
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/ipv6.rst
https://github.com/opnsense/docs/blob/master/source/manual/radvd.rst
https://github.com/opnsense/docs/blob/master/source/manual/radvd.rst


Line 81: Line 182:


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




IPv6


assign IP address


Setup routes


IPv6, assign IP address
Setup routes
DNS servers
DNS servers


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


Prefix must be /64
Prefix must be /64

Revision as of 09:15, 28 August 2023

Scope

Decimal counting goes to 10. Hexadecimal counts to 16. It uses the numbers 0-10 and then A,B,C,D,E,F. Computers use binary counting with bit 0 or 1 and 4-bit groups can be expressed in hexadecimal.

BIN DEC HEX
0000 0 0
0001 1 1
0010 2 2
0011 3 4
0100 4 4
0101 5 5
0110 6 6
0111 7 7
1000 8 8
1001 9 9
1010 10 A
1011 11 B
1100 12 C
1101 13 D
1110 14 E
1111 15 F
1_0000 16 10
1_0001 17 11
0111_1111 127 7F
1000_0000 128 80
1111_1111 255 FF

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