arrow_upward

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HE IPv6 Tunnel for OpenVZ Containers
#1
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
[Image: 9a7dcdcb0798d5e3e73b53e87eefd91f.png]
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.
[Image: 3f009a67ca0b4b26871ea4420db78ce0.png]

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)
[Image: f14a48a2bb30b44b1ac626932c7a81dd.png]

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][Image: a1bf1d370425f687813c431e8dbb7f22.png][/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]
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?
Lets Create the Init.d script!
nano /etc/init.d/ipv6hetb
Paste it in there with the require info

#!/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
Then press CTRL+X then press "y" then press enter

An example of the settings would be here
Spoiler Expand
#!/bin/bash
touch /var/lock/ipv6hetb
 
 #Variables
 SERVER_IP4_ADDR="216.218.226.238" #Server IP From Hurricane Electric
 CLIENT_IP4_ADDR="192.168.1.2" #Your server IPv4 Address
 CLIENT_IP6_ADDR="2005:490:c:6af::2/64" #Client IPv6 Address from Hurricane Electric
 ROUTED_IP6_ADDR="2005:490:d:6af::2/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

Then we should make it executable then run the service!
chmod +x /etc/init.d/ipv6hetb
service ipv6hetb start

Now we have IPv6 on our server!
Now lets verify it using
ifconfig
if you see a device called "tb" you followed this guide right!

Lets try pinging an IPv6 Server!
ping6 -c 4 google.com
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
listen [::]:80;
listen [::]:443 ssl; #if you use SSL

A typical example for the server block would be
Spoiler Expand
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
server_name localhost;

root /path/to/your/web/root/;
location / {
index index.html;
}
}

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!
#2
I'm gonna try updating it later with info from your post.
http://FreeVPS.club - Free VPSs!
#3
Here is a simple installation script that I made
Just run this command to install ipv6 tunneler

NOTES:
Run it as root (It checks the user though)
You should have TUN/TAP Enabled (I think the tun/tap checking works)

NOTE: init.d systems only (Not tested since I don't have an available OpenVZ system to mess with. (Still adding a tun/tap adapter on my KVM vps))
wget https://dev.1conan.com/workspace/ShellScripts/ipv6hetb.sh --no-check-certificate && bash ipv6hetb.sh

This should probably work on a CentOS 6 System

Please use at your own risk
This shouldn't do any harm to your VPS. It only adds 2 files which you can delete to reverse it.
http://FreeVPS.club - Free VPSs!
#4
(09-22-2015, 03:20 PM)Conan Wrote: Here is a simple installation script that I made
Just run this command to install ipv6 tunneler

NOTES:
Run it as root (It checks the user though)
You should have TUN/TAP Enabled (I think the tun/tap checking works)

NOTE: init.d systems only (Not tested since I don't have an available OpenVZ system to mess with. (Still adding a tun/tap adapter on my KVM vps))
wget https://dev.1conan.com/workspace/ShellScripts/ipv6hetb.sh --no-check-certificate && bash ipv6hetb.sh

This should probably work on a CentOS 6 System

Please use at your own risk
This shouldn't do any harm to your VPS. It only adds 2 files which you can delete to reverse it.

If you wanna mess with an OpenVZ VPS I have one from Layer.ae. I'll be wiling to give you the panel details if you wanna mess around with it.
#5
(09-27-2015, 08:13 PM)karatekidmonkey Wrote:
(09-22-2015, 03:20 PM)Conan Wrote: Here is a simple installation script that I made
Just run this command to install ipv6 tunneler

NOTES:
Run it as root (It checks the user though)
You should have TUN/TAP Enabled (I think the tun/tap checking works)

NOTE: init.d systems only (Not tested since I don't have an available OpenVZ system to mess with. (Still adding a tun/tap adapter on my KVM vps))
wget https://dev.1conan.com/workspace/ShellScripts/ipv6hetb.sh --no-check-certificate && bash ipv6hetb.sh

This should probably work on a CentOS 6 System

Please use at your own risk
This shouldn't do any harm to your VPS. It only adds 2 files which you can delete to reverse it.

If you wanna mess with an OpenVZ VPS I have one from Layer.ae. I'll be wiling to give you the panel details if you wanna mess around with it.

It needs an IPv4 address since this tutorial ads a 6in4 tunnel.

An IPv6-only VPS would be useless for this script.

It should work. IDK my KVM VPS had some problems.
http://FreeVPS.club - Free VPSs!
#6
Yeah, it is IPv6 only....I have too many KVM boxes. I was going to buy an OpenVZ box soon from HostUS but that went down once the promo was over. I'll go search around in my LastPass vault and see if I can dig up any more panel login details. Sorry about that.

EDIT: There are some trial VPSs on FreedomainClub as well as FreeVPS. Like:
https://freevps.us/thread-16979.html
#7
(09-16-2015, 10:42 PM)Conan Wrote: I'm gonna try updating it later with info from your post.

It's not too hard to setup an IPv6 tunnel inside an OpenVZ container.
#8
(09-29-2015, 06:01 AM)KBStorm Wrote:
(09-16-2015, 10:42 PM)Conan Wrote: I'm gonna try updating it later with info from your post.

It's not too hard to setup an IPv6 tunnel inside an OpenVZ container.

No one is asking you.
This was meant to make it easier.

Adding 6in4 tunnels on OpenVZ isn't as easy as adding it on a KVM/Dedicated server.
http://FreeVPS.club - Free VPSs!
#9
(09-29-2015, 10:26 AM)Conan Wrote:
(09-29-2015, 06:01 AM)KBStorm Wrote:
(09-16-2015, 10:42 PM)Conan Wrote: I'm gonna try updating it later with info from your post.

It's not too hard to setup an IPv6 tunnel inside an OpenVZ container.

No one is asking you.
This was meant to make it easier.

Adding 6in4 tunnels on OpenVZ isn't as easy as adding it on a KVM/Dedicated server.

Yes, I have to agree with that. Tried it with both my ZXPlay box as well as VisiChat's free trial VPS, the KVM one was definitely easier Smile


Possibly Related Threads…
Thread
Author
Replies
Views
Last Post
1,811
03-25-2020, 04:11 PM
Last Post: fChk

person_pin_circle Users browsing this thread: 1 Guest(s)
Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting