How to Set Up Your Own IPv6 Server Just In 10 Minutes
IPv6 is moving around the planet, in many countries IPv6 support is already natively from its provider, if you do not already have IPv6 but you want whatever you have it – you can do it using this short tutorial.
What is important is that traffic will be launched through our own leased server, and not through an unknown hosting provider.
First, you need a server that has an IPv6 connection, we will use the server from DigitalOcean for $ 5 bucks with the latest version of OS Ubuntu.
Configuring the server
Note: part of the software can not be installed, it is marked as optional, it should be installed only if you have a dynamic IP and you want to automatically configure access when updating the IP
After receiving the server, you need to update the available packages on it:
sudo apt-get update -y sudo apt-get upgrade -y
Install Git, Apache, and PhP (the last two are optional):
sudo apt-get -y git
If you do not plan autotuning when changing the IP address, you can skip this command:
sudo apt-get -y apache2 php libapache2-mod-php php-mcrypt
Now it’s time to download a script that will help you configure the tunnel github.com/sskaje/6in4:
git clone https://github.com/sskaje/6in4.git
Copy the script to /bin for the usual call:
sudo cp ./bin/6to4 /bin/6to4
Now, grant the right to launch:
sudo chmod +x /bin/6to4
Copy the settings file:
sudo cp ./etc/config.ini /etc/config.ini
Edit the settings file:
ifconfig | grep 'inet6 addr:' $ ifconfig | grep 'inet6 addr:' inet6 addr: fe80::000:000:000:000/64 Scope:Link inet6 addr: 2a03:000:0:000::00:0000/64 Scope:Global
We need the one with the Global:
inet6 addr: 2a03: 000: 0: 000 :: 00: 0000/64 Scope: Global
Open the file with the settings for editing:
sudo nano /etc/config.ini
We remove “;” at the lines:
- IPV6_NETWORK =
- IPV6_CIDR =
Press CNTRL + x, save and proceed to add the network:
sudo 6to4 add 1 18.104.22.168
Where 22.214.171.124 is your external IP, you can learn it, for example here.
In response you will get something like this:
Please set up tunnel on your machine with following parameters: Server IPv4 Address: 126.96.36.199 Server IPv6 Address: 2a03:000:0:000::1/64 Client IPv4 Address: 188.8.131.52 Client IPv6 Address: 2a03:000:0:000::2/64 Routed /64: 2a03:g0e0:00g0:3402::/64
Now it remains to register the settings in your router.
The example below is the Apple Airport setting:
Other routers can be configured the same way.
Configuring Routing on the Server
Now back to the server and configure the routing from the virtual IPv6 interface – in the main:
sudo ip6tables -t nat -A POSTROUTING -s 22a03:g0e0:00g0:3402::/64 -o eth0 -j MASQUERAD
2a03: g0e0: 00g0: 3402::/ 64 – this is your Routed /64 or any IP that will come to any of your devices from the router after saving the settings
Allow traffic forwards:
sudo sysctl -w net.ipv6.conf.all.forwarding=1
Checking the configuration
After that, save the settings on the router, reboot the router. You should have earned IPv6. IPv6 addresses will come to the connected devices.
You can check the operation of IPv6 here – ipv6-test.com
Pay attention – if you change the IP address (external), you will lose IPv6, the access updates after changing the address will be discussed in the next article (or you can use the instruction from the repository github.com/sskaje/6in4)
After configuring IPv6, you need to be vigilant – all your devices inside your home network will receive a public IPv6 address! if you are not sure of the security of the devices – enable the blocking of incoming ipv6 connections on your router.
PS: Telegram/Youtube/Google servers work through IPv6 like many others. You can verify this by running ping6 google.com