09-12-2015, 06:27 PM
HE IPv6 Tunnel for OpenVZ Containers
Want to have IPv6 on your VPS but your hosting company doesn't provide one? Want to be future proof your server or let IPv6 users access your website over IPv6? Then read my guide! This will teach you how to use the HE tunnel on your OpenVZ container without contacting your host for IPv6 IPs!
NOTE: Refer to https://freevps.us/thread-16343-post-188...#pid188783 for systemd Distros (CentOS 7/Debian 8/ETC.)
Requirements:
TUN/TAP Adapter Enabled
iproute
gcc
Almost any Linux OS
First, you need to register on Hurricane Electric (Obviously).
URL: https://tunnelbroker.net/register.php
Once you are finished registering, you can move now on to the next step.
Then, Lets start creating our tunnel.
URL: https://tunnelbroker.net/new_tunnel.php
First, Input your Server IP Address in the text box.
Next, Find the Tunnel Server that is closest to the location of your OpenVZ server.
(I'd recommend you to ping it, then ping the others and find the one with the lowest latency)
Next, the most exciting part, the part where we connect it!
All the Info we need from that page is:
Server IPv4 Address
[font=arial, sans-serif]Client IPv4 Address[/font]
[font=arial, sans-serif][font=arial, sans-serif]Client IPv6 Address[/font][/font]
[font=arial, sans-serif][font=arial, sans-serif][font=arial, sans-serif]Routed /64[/font][/font][/font]
[font=arial, sans-serif][font=arial, sans-serif][font=arial, sans-serif][/font][/font][/font]
[font=arial, sans-serif][font=arial, sans-serif][font=arial, sans-serif]We need to compile and install a tiny program that we will use to tunnel[/font][/font][/font]
Lets Create the Init.d script!
Paste it in there with the require info
Then press CTRL+X then press "y" then press enter
An example of the settings would be here
Then we should make it executable then run the service!
Now we have IPv6 on our server!
Now lets verify it using
if you see a device called "tb" you followed this guide right!
Lets try pinging an IPv6 Server!
If it successfully ran, You really have IPv6 now!
Now, on to adding IPv6 to Nginx
Nginx:
We just need to add this to our server block
A typical example for the server block would be
Apache Users: I intentionally didn't add this because I don't use Apache lol
Thanks to 4810
I used some of his guides as a "template" (Not literally) for making this
Want to have IPv6 on your VPS but your hosting company doesn't provide one? Want to be future proof your server or let IPv6 users access your website over IPv6? Then read my guide! This will teach you how to use the HE tunnel on your OpenVZ container without contacting your host for IPv6 IPs!
NOTE: Refer to https://freevps.us/thread-16343-post-188...#pid188783 for systemd Distros (CentOS 7/Debian 8/ETC.)
Requirements:
TUN/TAP Adapter Enabled
iproute
gcc
Almost any Linux OS
First, you need to register on Hurricane Electric (Obviously).
URL: https://tunnelbroker.net/register.php
Once you are finished registering, you can move now on to the next step.
Then, Lets start creating our tunnel.
URL: https://tunnelbroker.net/new_tunnel.php
First, Input your Server IP Address in the text box.
Next, Find the Tunnel Server that is closest to the location of your OpenVZ server.
(I'd recommend you to ping it, then ping the others and find the one with the lowest latency)
Next, the most exciting part, the part where we connect it!
All the Info we need from that page is:
Server IPv4 Address
[font=arial, sans-serif]Client IPv4 Address[/font]
[font=arial, sans-serif][font=arial, sans-serif]Client IPv6 Address[/font][/font]
[font=arial, sans-serif][font=arial, sans-serif][font=arial, sans-serif]Routed /64[/font][/font][/font]
[font=arial, sans-serif][font=arial, sans-serif][font=arial, sans-serif][/font][/font][/font]
[font=arial, sans-serif][font=arial, sans-serif][font=arial, sans-serif]We need to compile and install a tiny program that we will use to tunnel[/font][/font][/font]
Code: (Select All)
cd ~ #Lets Go to our home Dir
wget https://tb-tun.googlecode.com/files/tb-tun_r18.tar.gz #Lets get the source code!
tar -xvf tb-tun_r18.tar.gz #Why not extract it?
gcc tb_userspace.c -l pthread -o tb_userspace #Compile it!
mv tb_userspace /usr/bin/tb_userspace #Move it over to the bin folder
chmod +x /usr/bin/tb_userspace #Make it executable of course!. How would it run if it wasnt?
Code: (Select All)
nano /etc/init.d/ipv6hetb
Code: (Select All)
#!/bin/bash
touch /var/lock/ipv6hetb
#Variables
SERVER_IP4_ADDR="0.0.0.0" #Server IP From Hurricane Electric
CLIENT_IP4_ADDR="0.0.0.0" #Your server IPv4 Address
CLIENT_IP6_ADDR="::/64" #Client IPv6 Address from Hurricane Electric
ROUTED_IP6_ADDR="::/64" #Your Routed IPv6 From Hurricane Electric
case "$1" in
start)
echo "Starting ipv6hetb "
setsid tb_userspace tb $SERVER_IP4_ADDR $CLIENT_IP4_ADDR sit > /dev/null 2>&1 &
sleep 3s
ifconfig tb up
ifconfig tb inet6 add $CLIENT_IP6_ADDR
ifconfig tb inet6 add $ROUTED_IP6_ADDR
ifconfig tb mtu 1480
route -A inet6 add ::/0 dev tb
route -A inet6 del ::/0 dev venet0
;;
stop)
echo "Stopping ipv6hetb"
ifconfig tb down
route -A inet6 del ::/0 dev tb
killall tb_userspace
;;
*)
echo "Usage: /etc/init.d/ipv6hetb {start|stop}"
exit 1
;;
esac
exit 0
An example of the settings would be here
Spoiler Expand
Then we should make it executable then run the service!
Code: (Select All)
chmod +x /etc/init.d/ipv6hetb
service ipv6hetb start
Now we have IPv6 on our server!
Now lets verify it using
Code: (Select All)
ifconfig
Lets try pinging an IPv6 Server!
Code: (Select All)
ping6 -c 4 google.com
Now, on to adding IPv6 to Nginx
Nginx:
We just need to add this to our server block
Code: (Select All)
listen [::]:80;
listen [::]:443 ssl; #if you use SSL
A typical example for the server block would be
Spoiler Expand
Apache Users: I intentionally didn't add this because I don't use Apache lol
Thanks to 4810
I used some of his guides as a "template" (Not literally) for making this
http://FreeVPS.club - Free VPSs!