IPv6 tunnel pada OpenVZ VPS
Last Updated on Wednesday, 13 December 2017 06:15 Written by BiRU Wednesday, 13 December 2017 06:14
Sebelumnya pastikan dulu os dalam vps openvz dapat membuat device tun.
|
1
2
|
[root@kebo]# cat /dev/net/tuncat: /dev/net/tun: File descriptor in bad state |
Jika hasilnya tidak seperti di atas , silahkan kontak customer support untuk mengaktifkan permission pembuatan tun.
Oke lanjut,,
Sebelumnya pastikan sudah mendaftar di tunnelbroker dan sudah membuat tunnel pada control panelnya.
Download dan install aplikasi tb-tun untuk membuat interface tun.
|
1
2
3
4
5
6
|
yum -y install iproute gcccd /tmpwget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/tb-tun/tb-tun_r18.tar.gztar -xf tb-tun_r18.tar.gzgcc tb_userspace.c -l pthread -o tb_userspacecp /tmp/tb_userspace /usr/bin/ |
Buat init script untuk menjalankannya
|
1
|
nano /etc/init.d/ipv6tb |
sesuaikan ipv4 dan ipv6 dengan ip public vps dan yang didapat dari tunnelbroker
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#! /bin/sh### BEGIN INIT INFO# Provides: ipv6# Required-Start: $local_fs $all# Required-Stop: $local_fs $network# Default-Start: 2 3 4 5# Default-Stop: 0 1 6# Short-Description: starts the ipv6 tunnel# Description: ipv6 tunnel start-stop-daemon### END INIT INFO# /etc/init.d/ipv6tbtouch /var/lock/ipv6tbIPV4_VPS="xxx.xxx.xxx.xxx"IPV4_TB="xxx.xxx.xxx.xxx"CLIENT_IPV6_TB="xxxx:xxx:xx:xxx::2/64"ROUTED_64_TB="xxxx:xxx:xx:xxx::/64"case "$1" in start) echo "Starting ipv6tb " setsid /usr/bin/tb_userspace tb $IPV4_TB $IPV4_VPS sit > /dev/null 2>&1 & sleep 3s ifconfig tb up ifconfig tb inet6 add $CLIENT_IPV6_TB ifconfig tb inet6 add $ROUTED_64_TB ifconfig tb mtu 1480 route -A inet6 add ::/0 dev tb route -A inet6 del ::/0 dev venet0 ;; stop) echo "Stopping ipv6tb" ifconfig tb down route -A inet6 del ::/0 dev tb killall tb_userspace ;; *) echo "Usage: /etc/init.d/ipv6tb {start|stop}" exit 1 ;;esacexit 0 |
Ubah chmod dan jadikan startup
|
1
2
|
chmod 0755 /etc/init.d/ipv6tbupdate-rc.d ipv6tb defaults |
Kemudian jalankan script tersebut
|
1
|
/etc/init.d/ipv6tb start |
Sekarang coba cek apakah ipv6 sudah bisa digunakan
|
1
2
3
4
5
6
7
8
9
10
11
|
[root@kebo]# ping6 -c 5 ipv6.google.comPING ipv6.google.com(fra02s20-in-x12.1e100.net) 56 data bytes64 bytes from fra02s20-in-x12.1e100.net: icmp_seq=1 ttl=58 time=11.4 ms64 bytes from fra02s20-in-x12.1e100.net: icmp_seq=2 ttl=58 time=11.3 ms64 bytes from fra02s20-in-x12.1e100.net: icmp_seq=3 ttl=58 time=11.4 ms64 bytes from fra02s20-in-x12.1e100.net: icmp_seq=4 ttl=58 time=11.4 ms64 bytes from fra02s20-in-x12.1e100.net: icmp_seq=5 ttl=58 time=11.3 ms--- ipv6.google.com ping statistics ---5 packets transmitted, 5 received, 0% packet loss, time 4018msrtt min/avg/max/mdev = 11.349/11.411/11.456/0.127 ms |















