SimplerCloud Pte Ltd

×
×

How to configure static IPv6 address on Ubuntu?

Back

To configure static IPv6 address on your servelet running Ubuntu Linux operating system, please login to your servelet using SSH as root. The file that you need to modify is "/etc/network/interfaces".

1. First, please make a backup copy of the /etc/network/interfaces file first.

cp /etc/network/interfaces /etc/network/interfaces.bak

2. Open the /etc/network/interfaces file using your favourite text editor (nano or vi):

nano /etc/network/interfaces

or

vi /etc/network/interfaces

You will see below normal network configuration for servelets running Ubuntu:

===
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp
===

Add below lines at the end of the file:

===
# IPv6 for eth0
iface eth0 inet6 static
        pre-up modprobe ipv6
        address 2400:c980:0000:0002::xxxx
        netmask 64
        gateway 2400:c980:0000:0002::1
===

Note that 2400:c980:0000:0002::xxxx should be the static IPv6 address which we have assigned to your servelet.

Save the file.

3. For Ubuntu 12.04, you can issue below command to activate the changes:

/etc/init.d/networking restart

For Ubuntu 14.04, you would need to restart your servelet for the changes to take effect.

4. You can then verify if the correct IPv6 address has been installed on your servelet by issuing below command:

ifconfig eth0

For example:

===
root@ns2:/etc/network# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 06:0c:6c:01:12:98
          inet addr:103.25.202.165  Bcast:103.25.202.255  Mask:255.255.255.0
          inet6 addr: fe80::40c:6cff:fe01:1298/64 Scope:Link
          inet6 addr: 2400:c980:0:2::2/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2505260 errors:0 dropped:14 overruns:0 frame:0
          TX packets:640650 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:203319645 (203.3 MB)  TX bytes:74852651 (74.8 MB)
===

Note the line:

          inet6 addr: 2400:c980:0:2::2/64 Scope:Global

and verify that the correct IPv6 address is being shown.

That's all! :)

Was this article helpful?
Dislike0 Like0
Views: 20419