How to Assign an IPv6 Address to Another NIC in Linux VPS - ServaRICA

In our VPS there are 2 scenarios to add an IPv6 address in VPS

Those are

  •  If VPS has 2 network interfaces (eth0&eth1)
  •  If VPS has 1 network interface (eth0)

Command to check how many network interface your VPS has  -->  ip link show

1. If your VPS OS has two network interfaces (eth0 & eth1) then please follow the below instructions to add IPv6 to your VPS: 

** Please note for this scenario IPv6 address should be in eth1**

1.1 For Debian OS:

Step 1: vi /etc/network/interfaces

Step 2: Adding IPv6 address in the file

auto eth0
allow-hotplug eth0
iface eth0 inet static
        address IPv4 address/24
        gateway IPv4 gateway
        dns-nameservers 8.8.8.8,8.8.4.4

auto eth1
allow-hotplug eth1
iface eth1 inet6 static
        address IPv6 address/36
        gateway IPv6 gateway
        dns-nameservers 2001:4860:4860::8844

Step 3: Restart network --> service networking restart

 

1.2 For Ubuntu OS:

Step 1: vi /etc/netplan/50-cloud-init.yaml

Step 2: Adding IPv6 address in the file

network:
    ethernets:
        eth0:
            addresses:
                - IPv4 address/24
            gateway4: IPv4 gateway
            dhcp4: false
            nameservers:
               addresses:
                  - 8.8.8.8
        eth1:
         addresses:
           - IPv6 address/36
         gateway6: 2602:ffd5:1:100::1
         dhcp6: false
         nameservers:
           addresses:
            - 2001:4860:4860::8844

Step 3: Apply network changes --> netplan apply

 

1.3 Centos OS: 

Step 1: vi /etc/sysconfig/network-scripts/ifcfg-eth1

Step 2: Adding IPv6 address in the file

TYPE="Ethernet"
DEVICE="eth1"
BOOTPROTO="static"
ONBOOT="yes"
IPV6ADDR="IPv6 address/36"
IPV6_DEFAULTGW="2602:ffd5:1:100::1"
IPV6INIT="yes"
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"

Step 3: Add the following name server in /etc/resolv.conf

nameserver 8.8.8.8
nameserver 2001:4860:4860::8844

Step 4: Restart the network systemctl restart network

 

2. If your VPS OS has only one network interface(eth0) then please follow the below instructions to add IPv6 to your VPS

2.1 For Debian OS:

Step 1: vi /etc/network/interfaces

Step 2: Adding IPv6 address in the file

auto eth0
allow-hotplug eth0
iface eth0 inet static
        address IPv4 address/24
        gateway IPv4 gateway
        dns-nameservers 8.8.8.8,8.8.4.4

iface eth0 inet6 static
pre-up modprobe ipv6
        address IPv6 address/36
        gateway IPv6 gateway
        dns-nameservers 2001:4860:4860::8844

Step 3: Restart network --> service networking restart

 

2.2 For Ubuntu OS:

Step 1: vi /etc/netplan/50-cloud-init.yaml

Step 2: Adding IPv6 address in the file

network:
    ethernets:
        eth0:
            addresses:
                - IPv4 address/24
 		- IPv6 address/36
            gateway4: IPv4 gateway
            gateway6: 2602:ffd5:1:100::1
            dhcp4: false
	    dhcp6: false
            nameservers:
               addresses:
                  - 8.8.8.8
	          - 2001:4860:4860::8844

Step 3: Apply network changes --> netplan apply

 

2.3 Centos OS: 

Step 1: vi /etc/sysconfig/network-scripts/ifcfg-eth0

Step 2: Adding IPv6 address in the file

TYPE="Ethernet"
DEVICE="eth0"
BOOTPROTO="static"
ONBOOT="yes"
IPADDR="IPv4 address"
NETMASK="IPv4 netmask
GATEWAY="IPv4 gateway"
IPV6INIT="yes"
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6ADDR="IPv6 address/36"
IPV6_DEFAULTGW="2602:ffd5:1:100::1"

Step 3: Please add the following nameservers in /etc/resolv.conf

nameserver 8.8.8.8
nameserver 2001:4860:4860::8844

Step 4: Restart the network systemctl restart network 


*** If you face any issues after IP address is configured or while configuring IP address please contact us through chat or a ticket ***

  • ipv6
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to enable Two- factor Authentication for client area

What is Two-factor Authentication? Two-factor authentication adds an additional layer of...

Add SPF record for e-mail hosted at Servarica

Adding a txt SPF record for e-mail services hosted at ServaRICA   In order to make sure e-mail...

Powered by WHMCompleteSolution