Build a Chroot with debootstrap, example a Ubuntu lucid
sudo debootstrap lucid /opt/chroots/lucid.linfati.cl/
now, create a /usr/local/bin/go-chroot file with
#/bin/sh
case "$1" in
sethost)
echo virtu-$2 | sudo tee /opt/chroots/$2.linfati.cl/etc/debian_chroot
;;
run)
sudo pbuilder --execute \
--aptcache "" \
--no-targz \
--buildplace /opt/chroots/$2.linfati.cl \
-- /bin/su -
;;
*)
$0 sethost $1
$0 run $1
;;
esac
exit 0
and run
go-chroot lucid
if you have a ssh keys configured to root user in a ssh-server, you can do a vpn over ssh using a tun interface
copy the text to /etc/init/vpn2ssh.conf, change 1.2.3.4 for the ip of the vpn server and do “start vpn2ssh”
# vpn2ssh - vpn over ssh to ssh server manager
#
# vpn over ssh to ssh server manager
description "vpn over ssh to va.linfati.cl manager"
author "Rodrigo Linfati <rodrigo@linfati.cl>"
version "0.1"
start on started gdm
stop on stopping gdm
respawn
expect fork
env vpnserver=1.2.3.4
env idtun=309
env iplocal=172.30.9.2
env ipremote=172.30.9.1
pre-start exec sleep 60
exec ssh -C -f -w $idtun:$idtun $vpnserver ifconfig tun$idtun $ipremote pointopoint $iplocal up
post-start exec ifconfig tun$idtun $iplocal pointopoint $ipremote up
Note: on ssh server need “PermitTunnel=yes” on sshd_config
Modificamos los siguientes archivos
/etc/sysconfig/network ( solo añadir lineas que falten )
HOSTNAME=el_nombre_de_la_maquina
NETWORKING=yes
NETWORKING_IPV6=yes
IPV6_AUTOTUNNEL=yes
/etc/sysconfig/network-scripts/ifcfg-sit1″)
DEVICE=sit1
BOOTPROTO=none
ONBOOT=yes
IPV6INIT=yes
IPV6TUNNELIPV4=ipv4_servidor_del_tunel
IPV6TUNNELIPV4LOCAL=ipv4_cliente_del_tunel
IPV6ADDR=ipv6_cliente_del_tunel
/etc/sysconfig/static-routes-ipv6″)
sit1 2000::/3 ipv6_servidor_del_tunel
Y activamos la configuracion!
/etc/init.d/network reboot
Recent Comments