Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:dedicated-server:network:ipv6:prefix [2019/03/04 14:44]
dedibox [/48 IPv6 prefix] Clarifications about SLAAC
en:dedicated-server:network:ipv6:prefix [2020/09/21 15:30]
dedibox
Line 9: Line 9:
  
 Each customer can request a /48 IPv6 prefix for free. Each customer can request a /48 IPv6 prefix for free.
-If you have not yet ordered your block yet, you can [[en:​dedicated-server:​network:​ipv6:​start|do it now from the management console]].+If you have not yet ordered your block, you can [[en:​dedicated-server:​network:​ipv6:​start|do it now from the management console]].
  
 <note important>​On servers supporting [[en:​dedicated-server:​network:​ipv6:​slaac|IPv6 SLAAC]], [[en:​dedicated-server:​network:​ipv6:​slaac#​activation|SLAAC has to be enabled]] in order to ensure that DHCPv6 works correctly. If disabled, a server will not be able to learn its IPv6 default route.</​note>​ <note important>​On servers supporting [[en:​dedicated-server:​network:​ipv6:​slaac|IPv6 SLAAC]], [[en:​dedicated-server:​network:​ipv6:​slaac#​activation|SLAAC has to be enabled]] in order to ensure that DHCPv6 works correctly. If disabled, a server will not be able to learn its IPv6 default route.</​note>​
-<note important>​Because of known bug in Dibbler, we don't recommend ​this client anymore.</​note>​+<note important>​We don't recommend ​to use the dibbler ​client anymore, as there is a known bug with it.</​note>​
  
-====== How to configure the DHCPv6 client ======+====== ​1 - How to configure the DHCPv6 client ======
  
 We will use ''​dhclient''​. We will use ''​dhclient''​.
Line 20: Line 20:
 You'll need to edit the following file ''/​etc/​dhcp/​dhclient6.conf''​ : You'll need to edit the following file ''/​etc/​dhcp/​dhclient6.conf''​ :
 <​code>​ <​code>​
-interface "eth0" {+interface "eno1" {
    send dhcp6.client-id DUID;    send dhcp6.client-id DUID;
 } }
 </​code>​ </​code>​
  
-You will have to adapt the interface name (''​eth0''​) and the ''​DUID'',​ [[https://​console.online.net/​fr/​network/​|available in your console]].+You will have to adapt the interface name (''​eno1''​) and the ''​DUID'',​ [[https://​console.online.net/​fr/​network/​|available in your console]].
 ===== Start your DHCPv6 client at boot ===== ===== Start your DHCPv6 client at boot =====
  
 Once the client is configured, you'll need to create a new ''<​nowiki>​SystemD</​nowiki>''​ service. Once the client is configured, you'll need to create a new ''<​nowiki>​SystemD</​nowiki>''​ service.
  
-Create the following file, adapting the interface name (''​eth0''​) and the DUID ''/​etc/​systemd/​system/​dhclient.service'':​+Create the following file, adapting the interface name (''​eno0''​) and the DUID ''/​etc/​systemd/​system/​dhclient.service'':​
  
 <​code>​ <​code>​
 [Unit] [Unit]
 Description=dhclient for sending DUID IPv6 Description=dhclient for sending DUID IPv6
-Wants=network.target +After=network-online.target 
-Before=network.target+Wants=network-online.target
  
 [Service] [Service]
 +Restart=always
 +RestartSec=10
 Type=forking Type=forking
-ExecStart=/usr/​sbin/​dhclient -cf /​etc/​dhcp/​dhclient6.conf -6 -P -v eth0+ExecStart=/​sbin/​dhclient -cf /​etc/​dhcp/​dhclient6.conf -6 -P -v eno1 
 +ExecStop=/​sbin/​dhclient -x -pf /​var/​run/​dhclient6.pid
  
 [Install] [Install]
-WantedBy=multi-user.target+WantedBy=network.target
 </​code>​ </​code>​
  
Line 50: Line 53:
 Then, enable it for every reboot: ''​systemctl enable dhclient.service''​. Then, enable it for every reboot: ''​systemctl enable dhclient.service''​.
  
 +====== 2 - How to configure the network ======
 ===== Configure the Network on Ubuntu 16 & Debian 8 and 9 ===== ===== Configure the Network on Ubuntu 16 & Debian 8 and 9 =====
  
 <​note>​The following commands have to be used as root or with ''​sudo''</​note>​ <​note>​The following commands have to be used as root or with ''​sudo''</​note>​
  
-Start by editing ''/​etc/​network/​interfaces''​ as follow:+Start by editing ''/​etc/​network/​interfaces''​ as follows:
 <​code>​ <​code>​
 auto eno1 auto eno1
 iface eno1 inet6 static iface eno1 inet6 static
     address IPV6ADDRESS     address IPV6ADDRESS
-    netmask ​PREFIXLEN+    netmask ​PREFIXLENGTH
 </​code>​ </​code>​
  
Line 66: Line 70:
  
 <note tip>The network interface is initialized with the command ''​allow-hotplug''​ by default on **Debian 9**. It is possible that the network restart fails with this configuration. In this case, you can initialize the network with ''​auto''​ to avoid the problem.</​note>​ <note tip>The network interface is initialized with the command ''​allow-hotplug''​ by default on **Debian 9**. It is possible that the network restart fails with this configuration. In this case, you can initialize the network with ''​auto''​ to avoid the problem.</​note>​
-==== Alternate configuration without SystemD====+ 
 + ==== Alternate configuration without SystemD====
  
 If you don't use ''<​nowiki>​SystemD</​nowiki>''​ to start your services, you can configure your ''/​etc/​network/​interfaces''​ as follow: If you don't use ''<​nowiki>​SystemD</​nowiki>''​ to start your services, you can configure your ''/​etc/​network/​interfaces''​ as follow:
Line 78: Line 83:
  
 Still adapting your interface name (''​eno1''​) to your needs, as well as the IPv6 address and the Netmask. Still adapting your interface name (''​eno1''​) to your needs, as well as the IPv6 address and the Netmask.
 +===== Configure the Network using Netplan =====
 +
 +<​note>​The following commands have to be used as root or with ''​sudo''</​note>​
 +
 +Ubuntu uses since the release of Ubuntu 18.04 LTS a new tool to [[en:​dedicated-server:​network:​network-configuration-with-netplan|configure the network]], called ''​netplan''​. ​
 +
 +It replaces the classical network configuration with new configuration files, written in YAML format, and located in the ''/​etc/​netplan''​ directory. For more information regarding ''​netplan'',​ refer to the official [[http://​manpages.ubuntu.com/​manpages/​bionic/​man5/​systemd.network.5.html|Ubuntu documentation]].
 +
 +
 +Open the default configuration file ''/​etc/​netplan/​01-netcfg.yaml''​ in a text editor, and edit it as follows: ​
 +
 +<​code>​
 +# This file describes the network interfaces available on your system
 +# For more information,​ see netplan(5).
 +network:
 +  version: 2
 +  renderer: networkd
 +  ethernets:
 +    enp1s0:
 +      dhcp4: no
 +      dhcp6: no
 +      addresses:
 +       - "​aaa.bbb.ccc.ddd/​24"​ # The main IP address of your Dedibox server
 +       - "<​IPv6_FROM_YOUR_BLOCK>/<​SUBNETMASK>"​ # An IP address from your IPv6 block and it's subnet mask
 +      gateway4: aaa.bbb.ccc.1 # The gateway is the IP address of your Dedibox, ending on .1
 +      nameservers:​
 +       ​addresses:​ [62.210.16.6,​ 62.210.16.7]
 +      routes:
 +       - to: 0.0.0.0
 +         via: aaa.bbb.ccc.1
 +         ​on-link:​ true
 +</​code>​
 +
 +You'll need to replace ''​enp1s0''​ with the proper interface name.\\
 +To find the interface name of your machine, use the ''​ifconfig''​ command.
 +
 +Reboot your server once you have configured the new network settings. ​
 +
 +<note tip>The [[https://​yaml.org/​|YAML language]] uses a strict syntax formatting, you can use the command ''​netplan --debug''​ to check your file for possible errors.</​note>​
 +
  
 ===== Configure the Network on CentOS 7 ===== ===== Configure the Network on CentOS 7 =====
Line 148: Line 193:
 To test the IPv6  on your server in rescue mode, reboot the server in rescue mode with the "​Ubuntu 14 - Trusty"​ mode. The ''​dhclient''​ is already available on it. To test the IPv6  on your server in rescue mode, reboot the server in rescue mode with the "​Ubuntu 14 - Trusty"​ mode. The ''​dhclient''​ is already available on it.
  
-Create the file which will contain your DUID with the help of the [[#configurer_le_client_dhcpv6|above documentation]].+Create the file which will contain your DUID with the help of the [[#how_to_configure_the_dhcpv6_client|documentation ​above]].
 You can find your DUID in [[https://​console.online.net/​fr/​network/​|your console]]. You can find your DUID in [[https://​console.online.net/​fr/​network/​|your console]].
  
Line 157: Line 202:
  
 After, add the IPv6 address to your network interface: After, add the IPv6 address to your network interface:
-<​code>/​sbin/​ifconfig <​interface>​ inet6 add IPV6ADDRESS/​PREFIXLENGH</​code>​+<​code>/​sbin/​ifconfig <​interface>​ inet6 add IPV6ADDRESS/​PREFIXLENGTH</​code>​
  
 Then you can try to ping6: Then you can try to ping6:
 <​code>​ping6 ipv6.google.com</​code>​ <​code>​ping6 ipv6.google.com</​code>​