How to: Static IPv6 on Ubuntu 16.04

in #linux9 years ago

This is a short tutorial about configuring a static IPv6 address on Ubuntu 16.04. to make sure that people do not face the same problems I had to solve.

A Story about a static IPv6 on Ubuntu 16.04

I had to change my ISP to get a synchronous internet connection (Upload speed equals download speed), because I want to provide a better performance on my hosted services. The problem: The new ISP only provides an external IPv6 address. Due to that I also had to configure my network to support IPv6.

On my Ubuntu machines I faced a big issue that bugged me for the last two weeks and in this article I will share my solution with you.

Set a static IPv6 address

According to some guides on google it is quite easy to configure a static IPv6 address for Ubuntu and Linux in general – Just edit /etc/network/interfaces and set your address like this:

iface eth0 inet6 static
address 2a03:6120:13ab:b620:2150:5eff:fcb2:c831

If you see some other guides that also define a netmask or a gateway, you should just look for another one or you should really understand what you are doing there. In 99% of the cases it is enough to only configure the address and all other information will be received from your router.

Restart the network service and check your configuration using

ip addr

which should return something like this

[…]
inet6 2a03:6120:13ab:b620:2150:5eff:fcb2:c831/128 scope global
[…]

Looks good, doesn’t it?

Where I lost my nerves

It does, I thought the same, but what happens to me is that after a random time the global IPv6 address was gone and I was no longer able to access the machine until I pressed the hardware reboot button.

So what the fuck is happening here? All tutorials show only the steps above – Does it work for them and am I the only dude that faces this problem? I googled a lot and found some really old bugs regarding that issue on the Ubuntu bug-tracker, but no real solution. I started to try every little possible solution that I’ve found on forums for two weeks, but the problem still persists.

Finally, I found a hint in the Ubuntu Wiki that solves the issue and I am so happy about it that I’ve decided to write this post. But to understand the problem, we will have a quick look on one of the biggest disadvantages of IPv6 first.

Privacy in IPv6

Actually IPv6 is quite great, because the huge address pool allows each device to have its own external IP address so everyone else can access it. But due to this huge address pool the ISPs no longer need to change your external address.

If you have an ISP that provides an external IPv4 address to you will have some kind of forced disconnect one time per day. The initial reason for this was that the ISP has only a small set of IPv4 addresses and wants to make sure that no address is blocked by an unused connection. Now, with IPv6, this is no longer the case and most ISPs will not change your external address.

This is quite great if you host a service, but for a normal user its a huge disadvantage as you can be tracked by your IP forever. It would be Googles and Facebooks wet dream, as they are spending a bunch of money to track us, because all this would no longer be needed if you always have the same external IP address.

NoPrivacyComic
Source

To solve this kind of problem most operating systems have some kind of IPv6 privacy extension. For Linux the privacy extension makes sure that your address will change from time to time to make it harder to track you. Do you know now what happened to me? Exactly, the privacy extension is enabled in Ubuntu 16.04 by default and my static configuration got changed after some time by the OS.

As I do not use the machine to surf in the internet, but to host services, I do not need this extension at all. It can be disabled by setting

net.ipv6.conf.all.use_tempaddr = 0
net.ipv6.conf.default.use_tempaddr = 0

In the /etc/sysctl.d/10-ipv6-privacy.conf file. And wolla, my static IPv6 address is finally a static one.

I hope that this may save you some time! :)

follow me
Source

Thanks for reading and best regards!

Sort:  

Indeed, however I heard that IPV6 discloses the MAC address of the PC so it's inherently less secure than IPV6, i wonder if you can comment on that.

Hmm .. I am not sure about this .. I read that ipv6 is more or less static by design because the ip is generated by the os based on the mac adress.. so I would say you are right, because you may be able to regenerate the mac from the ip. But if you choose your own static ipv6 adress that should no longer be possible :)

Coin Marketplace

STEEM 0.04
TRX 0.33
JST 0.097
BTC 63953.04
ETH 1857.95
USDT 1.00
SBD 0.38