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
Last revision Both sides next revision
en:dedicated-server:network:ipv6:prefix [2016/06/30 12:21]
dedibox [Configure the Network on CentOS 7]
en:dedicated-server:network:ipv6:prefix [2019/12/19 15:44]
dedibox [How to configure the DHCPv6 client]
Line 1: Line 1:
 ======= /48 IPv6 prefix ======= ======= /48 IPv6 prefix =======
 +
 +<note tip> ​
 +**Requirements:​**
 +  * You have an account at [[https://​console.online.net|console.online.net]]\\
 +  * You have a [[https://​www.online.net/​fr/​serveur-dedie|Dedibox]] dedicated server
 +</​note>​
 +
  
 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]].+If you have not yet ordered your block yet, you can [[en:​dedicated-server:​network:​ipv6:​start|do it now from the management console]].
  
-<note important>​Because of known bug in Dibblerwe don't recommend ​this client anymore.</​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 disableda server will not be able to learn its IPv6 default route.</​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 ====== ====== How to configure the DHCPv6 client ======
Line 12: 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 ''​SystemD''​ 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 +Before=network-pre.target 
-Before=network.target+Wants=network-pre.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>​
 +
 +<​note>''​dhclient'''​s path may vary depending on your OS. To know the exact path, use the following command: ''​which dhclient''</​note>​
  
 Then, enable it for every reboot: ''​systemctl enable dhclient.service''​. Then, enable it for every reboot: ''​systemctl enable dhclient.service''​.
  
-===== Configure the Network on Ubuntu ​16 & Debian 8 =====+===== Configure the Network on Ubuntu ​18.04 with Netplan ​=====
  
 +<note tip>​Starting from **version 18.04 (Bionic Beaver)** Ubuntu uses [[http://​netplan.io|Netplan]] for the network configuration. The use of ''​dhclient''​ is no longer required.</​note>​
 <​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 ​the file ''/​etc/​netplan/01-netcfg.yaml''​ as follows, then save it and exit the text editor 
 <​code>​ <​code>​
 +network:
 +  version: 2
 +  renderer: networkd
 +  ethernets:
 +    enp1s0f0:
 +      dhcp4: yes
 +      dhcp6: yes
 +      addresses:
 +        - <​YOUR_IPv6_ADDRESS>/<​PREFIXLENGTH>​
 +</​code>​
 +
 +Then open the file ''/​etc/​systemd/​networkd.conf''​ and edit it as follows, then save the file and exit the text editor: ​
 +
 +<​code>​
 +DUIDType=vendor
 +DUIDRawData=<​THE_DUID_OF_YOUR_SUBNET>​
 +</​code>​
 +
 +Apply the configuration to Netplan: ​
 +<​code>​
 +sudo netplan apply
 +</​code>​
 +
 +The IPv6 connection will automatically configured during the boot process of your server. ​
 +
 +===== Configure the Network on Ubuntu 16 & Debian 8 and 9 =====
 +
 +<​note>​The following commands have to be used as root or with ''​sudo''</​note>​
 +
 +Start by editing ''/​etc/​network/​interfaces''​ as follows:
 +<​code>​
 +auto eno1
 iface eno1 inet6 static iface eno1 inet6 static
     address IPV6ADDRESS     address IPV6ADDRESS
-    netmask ​PREFIXLEN+    netmask ​PREFIXLENGTH
 </​code>​ </​code>​
  
Line 54: Line 101:
 With Debian & old versions of Ubuntu, it's usually ''​eth0''​. With Debian & old versions of Ubuntu, it's usually ''​eth0''​.
  
 +<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 ''​SystemD''​ 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:
 <​code>​ <​code>​
 iface eno1 inet6 static iface eno1 inet6 static
Line 71: Line 119:
 <​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>​
  
-After configuring your ''​dhclient''​ and ''​SystemD'',​ you'll need to edit ''/​etc/​sysconfig/​network-scripts/​ifcfg-eth0'':​+After configuring your ''​dhclient''​ and ''​<​nowiki>​SystemD</​nowiki>​'',​ you'll need to edit ''/​etc/​sysconfig/​network-scripts/​ifcfg-eth0'':​
 <​code>​ <​code>​
 # Generated by parse-kickstart # Generated by parse-kickstart
Line 109: Line 157:
 If the configuration is not working for you, check your interface name with the following command: If the configuration is not working for you, check your interface name with the following command:
 <​code>​ifconfig -a</​code>​ <​code>​ifconfig -a</​code>​
 +
 +Also, your server need to be configured to accept ''​RA''​ (Router Advertisement).\\
 +By default, your server won't accept to forward packets from an interface to another if it's automatically configured (through ''​DHCPv6''​).
 +
 +If you need to forward IPv6 packets and use an automated configuration,​ you'll need to set your ''​sysctl''​ ''​net.ipv6.conf.all.accept_ra''​ to ''​2''​ in ''/​etc/​sysctl.conf''​.\\
 +This is useful usually for Hypervisor Host such as ''​Proxmox''​. ​
  
 The examples are given for ''​eth0''/''​eno1'',​ if your main interface have a different name, you'll need to modify it in all of your configurations files. The examples are given for ''​eth0''/''​eno1'',​ if your main interface have a different name, you'll need to modify it in all of your configurations files.
Line 130: Line 184:
 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]].
  
 <​code>​nano /​etc/​dhcp/​dhclient6.conf</​code>​ <​code>​nano /​etc/​dhcp/​dhclient6.conf</​code>​
  
-Thenadd the IPv6 address to your network interface:+Firststart the ''​dhclient''​: 
 +<​code>​dhclient -cf /​etc/​dhcp/​dhclient6.conf -6 -P -v <​interface></​code>​
  
-<​code>/​sbin/​ifconfig <​interface>​ inet6 add IPV6ADDRESS/​PREFIXLENGH</​code>​ +After, add the IPv6 address to your network interface:​ 
- +<​code>/​sbin/​ifconfig <​interface>​ inet6 add IPV6ADDRESS/​PREFIXLENGTH</​code>​
-And then, start the ''​dhclient'':​ +
-<​code>​dhclient -cf /​etc/​dhcp/​dhclient6.conf -6 -P -v <​interface>​</​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>​