OpenVZ

A. Enable TUN/TAP Device

1. login SSH ke server VPS

2. Lihat vps-id accountnya dari HyperVm

misal disana yg ingin diaktifkan tun/tab device di vps nya adalah wew.vm (1.2.3.3 ) vps-id : 1000

3. beri akses ke vps-node yg bersangkutan dg referensi di  http://wiki.openvz.org/VPN_via_the_TUN/TAP_device

Allow your container to use the tun/tap device by running the following commands on the host node:

vzctl set 1000 –devices c:10:200:rw –save
vzctl set 1000 –capability net_admin:on –save

And create the character device file inside the container (execute the following on the host node):

vzctl exec 1000 mkdir -p /dev/net
vzctl exec 1000 mknod /dev/net/tun c 10 200

vzctl exec 1000 chmod 600 /dev/net/tun

4. cek account vps apakah sudah aktif atau belum tun./tap nya :

- jika sudah berhasil infonya File descriptor in bad state

login ke vpsnya :
[root@wew vz]# vzctl enter  1000
entered into CT 1000
[root@server /]#

[root@server /]# cat /dev/net/tun
cat: /dev/net/tun: File descriptor in bad state

- jika belum berhasil infonya : no such device

B. Enable module iptable_nat di vps

1. dari server harus di load module iptable_nat
utk cek di /etc/vz/vz.conf

## IPv4 iptables kernel modules
IPTABLES=”ip_conntrack ip_conntrack_ftp ipt_LOG ipt_conntrack ipt_helper ipt_state ipt_REJECT ipt_tos ipt_limit ipt_multiport iptable_filter iptable_mangle iptable_nat ip_nat_ftp ipt_TOS ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length”

referensi ini bisa dilihat di http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf di halaman 69-70

2. restart vpsnya vps-id tadi
[root@wew vz]# vzctl restart 1000

3. cek iptable di vps
login ke vpsnya :
[root@wew vz]# vzctl enter  1000
entered into CT 1000
[root@server /]#

[root@server /]# iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
SNAT       all  –  10.8.0.0/24          anywhere            to:1.1.2.3
SNAT       all  –  10.8.1.0/24          anywhere            to:1.1.2.3

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

brarti sudah bisa.
jika belum, maka ada keterangan errornya

Thanks.

4 Users Response In " Bagaimana Enable TUN/TAP device dan Iptables di account dan Server VPS "

Subscribes to this post Comments Feeds or leave a trackback
wew says in January 22nd 2010 at 5:57 pm    

hehe,,, ternyata berguna juga tulisan e.. :p

gampang le nggoleki… -_-’

bakulpecel says in January 26th 2010 at 2:20 pm    

TUN/TAP niku fungsine nggo nopo to mas ?

wew says in January 26th 2010 at 3:38 pm    

@bakulpecel :

wah, kulo nggih namung, meng “enable” ke mawon ko mas.. :D

nek fungsine, kados e kagem Private Network, namung virtual :)

Tessie says in April 11th 2011 at 6:56 pm    

4tUGus I’m impressed! You’ve managed the almost impossible.

Post Comments