Channel Bonding sur UMTS

January 8th, 2012

Lien original http://wiki.leipzig.freifunk.net/ChannelBonding

Server
Configuration du serveur openvpn situé chez un hébergeur (ovh, dedibox, etc…) :

/etc/openvpn0.conf

local SERVER0_IP
port SERVER0_PORT

/etc/openvpn1.conf

local SERVER1_IP
port SERVER1_PORT
proto udp
dev tap0

ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key
dh /etc/openvpn/keys/dh2048.pem
tls-auth /etc/openvpn/keys/ta.key 0

keepalive 2 10

mode server
tls-server

client-to-client

max-clients 10
tun-mtu 1500

daemon
verb 3

cipher DES-EDE3-CBC  # Triple-DES

comp-lzo

status /var/log/openvpn-status.log

persist-key
persist-tun

bonding VPN’s

bonding.sh

#!/bin/bash

modprobe bonding mode=3 miimon=100
modprobe tun

ifconfig tap0 down
ifconfig tap1 down

tunctl -u root -g root -t tap0
tunctl -u root -g root -t tap1

ifconfig tap0 up
ifconfig tap1 up

openvpn /etc/openvpn/openvpn.conf &
openvpn /etc/openvpn/openvpn2.conf &
sleep 10

ifconfig bond0 hw ether 00:11:22:33:44:55
ifconfig bond0 10.10.0.1 netmask 255.255.255.252 broadcast 10.10.0.3 up

ifenslave bond0 tap0 tap1

ip addr add 10.10.10.1/24 dev tap0 scope link
ip addr add 10.10.11.1/24 dev tap1 scope link

cleanup.sh

#!/bin/bash
ip addr del 10.10.0.1/32 dev lo
ip addr del 10.10.10.1/24 dev tap1
ip addr del 10.10.11.1/24 dev tap0

killall -9 openvpn

rmmod bonding
rmmod tap

Client

UMTS connect

USB-Stick
idProduct          0x4400
iManufacturer           1 Novatel Wireless
iProduct                2 Novatel Wireless HSUPA Modem

modules: option, serailusb

pppd updetach defaultroute usepeerdns noipdefault debug noauth asyncmap 0 ipcp-accept-local ipcp-accept-remote modem crtscts user vodafone password 42 connect ‘/usr/sbin/chat -t5 -v -e -E -f umts_vodafone.chat’ 100 115200 /dev/ttyUSB1

PCMCIA-Karte
modules: nozomi

pppd updetach defaultroute usepeerdns noipdefault debug noauth asyncmap 0 ipcp-accept-local ipcp-accept-remote modem crtscts user eplus password 42 connect ‘/usr/sbin/chat -t5 -v -e -E -f umts_eplus.chat’ 100 115200 /dev/noz0

umts_eplus.chat

ABORT   BUSY
ABORT   'NO CARRIER'
ABORT   ERROR
REPORT  CONNECT
TIMEOUT 10
""      "AT&F"
OK      "ATE1"
OK      'AT+CGDCONT=1,"IP","internet.eplus.de"'
SAY     "Calling UMTS/GPRS"
TIMEOUT 30
OK      "ATD*99***1#"
CONNECT ' '

umts_vodafone.chat

ABORT   BUSY
ABORT   'NO CARRIER'
ABORT   ERROR
REPORT  CONNECT
TIMEOUT 10
""      "AT&F"
OK      "ATE1"
OK      'AT+CGDCONT=1,"IP","web.vodafone.de"'
SAY     "Calling UMTS/GPRS"
TIMEOUT 30
OK      "ATD*99***1#"
CONNECT ' '

openvpn config

/etc/openvpn0.conf

remote SERVER0_IP SERVER0_PORT

/etc/openvpn1.conf

remote SERVER1_IP SERVER1_PORT
client

dev tap0
proto udp

ping 2
ping-restart 10

resolv-retry infinite

cipher DES-EDE3-CBC  # Triple-DES

tls-client

persist-key
#persist-tun

tun-mtu 1500

ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/client1.crt
key /etc/openvpn/keys/client1.key
tls-auth /etc/openvpn/keys/ta.key 1

ns-cert-type server

comp-lzo

verb 3

bonding VPN’s

#!/bin/bash

ip route del default
ip route del default

ppp_ip0=`ip addr show ppp0 | grep inet | awk '{ print $2 }'`
ppp_ip1=`ip addr show ppp1 | grep inet | awk '{ print $2 }'`
ppp_pip0=`ip addr show ppp0 | grep inet | awk '{ print $4 }'`
ppp_pip1=`ip addr show ppp1 | grep inet | awk '{ print $4 }'`
ppp_gwip0=`ipcalc "$ppp_pip0" | grep Address | awk '{ print $2 }'`
ppp_gwip1=`ipcalc "$ppp_pip1" | grep Address | awk '{ print $2 }'`

echo "$ppp_ip0"  "$ppp_ip1"  "$ppp_pip0"  "$ppp_pip1"  "$ppp_gwip0"  "$ppp_gwip1" 

ip route add "$ppp_gwip0" dev ppp0 src "$ppp_ip0" scope link table 100
ip route add "$ppp_gwip1" dev ppp1 src "$ppp_ip1" scope link table 101
ip route add default via "$ppp_gwip0" dev ppp0 table 100
ip route add default via "$ppp_gwip1" dev ppp1 table 101
ip rule add from "$ppp_ip0" table 100 prio 20000
ip rule add from "$ppp_ip1" table 101 prio 20001

modprobe bonding mode=3 miimon=100
modprobe tun

tunctl -d tap0
tunctl -d tap1

echo  "$ppp_ip0" "$ppp_ip1"
openvpn --config /etc/openvpn/openvpn.conf --local "$ppp_ip0" --script-security 2 --up /vpn/entap0.sh &
openvpn --config /etc/openvpn/openvpn2.conf --local "$ppp_ip1" --script-security 2 --up /vpn/entap1.sh &

ifconfig bond0 hw ether 55:44:33:22:11:00
ifconfig bond0 10.10.0.2 netmask 255.255.255.252 broadcast 10.10.0.3 up

ip route add default via 10.10.0.1 dev bond0

echo "nameserver 208.67.222.222" > /etc/resolv.conf

#mtr -t google.de 2>&1 |tee /vpn/logs/mtr

 

#!/bin/bash
ip addr add 10.10.10.2/24 dev tap0
ifenslave bond0 tap0
#!/bin/bash
ip addr add 10.10.11.2/24 dev tap1
ifenslave bond0 tap1

cleanup network-foo

cleanup.sh

#!/bin/bash

ip addr del 10.10.0.2/32 dev lo
ip addr del 10.10.10.2/24 dev tap1
ip addr del 10.10.11.2/24 dev tap0

killall -9 openvpn
killall -9 openvpn

ppp_ip0=ip addr show ppp0 | grep inet | awk '{ print $2 }'
ppp_ip1=ip addr show ppp1 | grep inet | awk '{ print $2 }'

ip addr del "$ppp_ip0" dev ppp0
ip addr del "$ppp_ip1" dev ppp1

killall -9 pppd
killall -9 pppd

pccardctl eject
pccardctl insert

ip route flush table 100
ip route flush table 101

rmmod bonding
rmmod tap

[fai-locaux] FTTH DIY HowTo – Début du premier jet

January 4th, 2012

https://lists.fdn.fr/wws/arc/fai-locaux/2010-11/msg00068.html

Et un post intéressant sur linuxfr.org,

http://linuxfr.org/news/fibrer-cest-faisable-par-une-bande-de-copains

FTTH rural: Pourquoi pas les poteaux ?

December 26th, 2011

Birdy pose la question du déploiement de la fibre optique sur poteau, en milieu rural…

http://arnaud.luquin.info/?cat=14

L’auto-déploiement de fibres optiques dans les campagnes fait son chemin

December 22nd, 2011

Nombreux sont les blogs à proposer des réflexions sur la façon de déployer des fibres optiques dans nos campagnes. A l’heure où l’Etat et les opérateurs se désengagent de plus en plus des zones, soit-disant, non rentables, des collectifs de particuliers commencent à prendre le relai…

Voici un billet bien pensé sur la question…

http://exnihili.com/blog2/1658349976/ftth-prends-toi-z-en-main-c-est-ton-destin

Fibre optique dans la campagne Anglaise

December 22nd, 2011

Pour commencer, quelques tranchées…

Eclatement de la fibre…

Raccordement de l’habitant!

Xen : Augmenter la taille de disque d’un domU

August 2nd, 2011

Cet article résume rapidement la liste des commandes et les points importants pour redimensionner un DomU utilisant des fichiers comme disque.

#Créer un fichier temporaire pour augmenter la taille (ici 1Go)
dd if=/dev/zero of=/tmp/temps_expand bs=1024k count=1000

#Stopper votre machine virtuelle
xm shutdown test.example.com

#Sauvegarder votre image (on ne sait jamais)
cp -a /xen/domains/test.example.com/disk.img /xen/domains/test.example.com/disk.img

#Ajouter le ficher disque temporaire au fichier disque du serveur virtuel.
cat /tmp/temps_expand >> /xen/domains/test.example.com/disk.img
#Pour l’agrandir de 10 Gio d’un coup, on peut par exemple faire
for i in $(seq 1 10); do echo « $i »; cat /tmp/temps_expand >> /xen/domains/test.example.com/disk.img; done

#Prendre en compte le changement de taille.
resize2fs -f /xen/domains/test.example.com/disk.img

#Redémarrer le serveur virtuel
xm create test.example.com.cfg

Cet article a été honteusement pompé depuis cette adresse

http://blog.admin-linux.org/howto/howto-xen-redimensionnement-du-disque-dun-domu

J’ai testé la manip depuis Xen 4.0 sous debian 6, KS 2G et cela fonctionne à merveille.

Merci à son auteur…

Install Xen sur KS 2G OVH Debian 6

July 14th, 2011

root@ks369475:~# aptitude install linux-image-xen-amd64 linux-modules-xen-amd64

Impossible de trouver un paquet dont le nom ou la description correspond à « linux-modules-xen-amd64 »
Impossible de trouver un paquet dont le nom ou la description correspond à « linux-modules-xen-amd64 »
Les NOUVEAUX paquets suivants vont être installés :
firmware-linux-free{a} initramfs-tools{a} klibc-utils{a} libklibc{a} libuuid-perl{a} linux-base{a}
linux-image-2.6.32-5-xen-amd64{a} linux-image-xen-amd64
Les paquets partiellement installés suivants seront configurés :
linux-image-2.6.26-2-xen-amd64
0 paquets mis à jour, 8 nouvellement installés, 0 à enlever et 0 non mis à jour.
Il est nécessaire de télécharger 29,4 Mo d’archives. Après dépaquetage, 102 Mo seront utilisés.
Voulez-vous continuer ? [Y/n/?] Y
Prendre : 1 http://mirror.ovh.net/debian/ squeeze/main libklibc amd64 1.5.20-1+squeeze1 [53,5 kB]
Prendre : 2 http://mirror.ovh.net/debian/ squeeze/main klibc-utils amd64 1.5.20-1+squeeze1 [179 kB]
Prendre : 3 http://mirror.ovh.net/debian/ squeeze/main initramfs-tools all 0.98.8 [89,5 kB]
Prendre : 4 http://mirror.ovh.net/debian/ squeeze/main libuuid-perl amd64 0.02-4 [10,4 kB]
Prendre : 5 http://mirror.ovh.net/debian/ squeeze/main linux-base all 2.6.32-35 [173 kB]
Prendre : 6 http://mirror.ovh.net/debian/ squeeze/main linux-image-2.6.32-5-xen-amd64 amd64 2.6.32-35 [28,7 MB]
Prendre : 7 http://mirror.ovh.net/debian/ squeeze/main firmware-linux-free all 2.6.32-35 [151 kB]
Prendre : 8 http://mirror.ovh.net/debian/ squeeze/main linux-image-xen-amd64 amd64 2.6.32+29 [4 360 B]
29,4 Mo téléchargés en 8s (3 555 ko/s)
Préconfiguration des paquets…
Sélection du paquet libklibc précédemment désélectionné.
(Lecture de la base de données… 25218 fichiers et répertoires déjà installés.)
Dépaquetage de libklibc (à partir de …/libklibc_1.5.20-1+squeeze1_amd64.deb) …
Sélection du paquet klibc-utils précédemment désélectionné.
Dépaquetage de klibc-utils (à partir de …/klibc-utils_1.5.20-1+squeeze1_amd64.deb) …
Sélection du paquet initramfs-tools précédemment désélectionné.
Dépaquetage de initramfs-tools (à partir de …/initramfs-tools_0.98.8_all.deb) …
Sélection du paquet libuuid-perl précédemment désélectionné.
Dépaquetage de libuuid-perl (à partir de …/libuuid-perl_0.02-4_amd64.deb) …
Sélection du paquet linux-base précédemment désélectionné.
Dépaquetage de linux-base (à partir de …/linux-base_2.6.32-35_all.deb) …
Sélection du paquet linux-image-2.6.32-5-xen-amd64 précédemment désélectionné.
Dépaquetage de linux-image-2.6.32-5-xen-amd64 (à partir de …/linux-image-2.6.32-5-xen-amd64_2.6.32-35_amd64.deb) …
Sélection du paquet firmware-linux-free précédemment désélectionné.
Dépaquetage de firmware-linux-free (à partir de …/firmware-linux-free_2.6.32-35_all.deb) …
Sélection du paquet linux-image-xen-amd64 précédemment désélectionné.
Dépaquetage de linux-image-xen-amd64 (à partir de …/linux-image-xen-amd64_2.6.32+29_amd64.deb) …
Traitement des actions différées (« triggers ») pour « man-db »…
Paramétrage de libklibc (1.5.20-1+squeeze1) …
Paramétrage de klibc-utils (1.5.20-1+squeeze1) …
Paramétrage de initramfs-tools (0.98.8) …
update-initramfs: deferring update (trigger activated)
Paramétrage de linux-image-2.6.26-2-xen-amd64 (2.6.26-22) …
update-initramfs: Generating /boot/initrd.img-2.6.26-2-xen-amd64
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
W: mdadm: no arrays defined in configuration file.
Generating grub.cfg …
Warning: update-grub_lib is deprecated, use grub-mkconfig_lib instead
Found linux image: /boot/bzImage-2.6.38.2-xxxx-grs-ipv6-64
Found linux image: /boot/vmlinuz-2.6.32-5-xen-amd64
Found linux image: /boot/vmlinuz-2.6.26-2-xen-amd64
Found initrd image: /boot/initrd.img-2.6.26-2-xen-amd64
No volume groups found
done
Paramétrage de libuuid-perl (0.02-4) …
Paramétrage de linux-base (2.6.32-35) …
Paramétrage de linux-image-2.6.32-5-xen-amd64 (2.6.32-35) …
Running depmod.
Running update-initramfs.
update-initramfs: Generating /boot/initrd.img-2.6.32-5-xen-amd64
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
W: mdadm: no arrays defined in configuration file.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.32-5-xen-amd64 /boot/vmlinuz-2.6.32-5-xen-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 2.6.32-5-xen-amd64 /boot/vmlinuz-2.6.32-5-xen-amd64
Generating grub.cfg …
Warning: update-grub_lib is deprecated, use grub-mkconfig_lib instead
Found linux image: /boot/bzImage-2.6.38.2-xxxx-grs-ipv6-64
Found linux image: /boot/vmlinuz-2.6.32-5-xen-amd64
Found initrd image: /boot/initrd.img-2.6.32-5-xen-amd64
Found linux image: /boot/vmlinuz-2.6.26-2-xen-amd64
Found initrd image: /boot/initrd.img-2.6.26-2-xen-amd64
No volume groups found
done
Paramétrage de firmware-linux-free (2.6.32-35) …
Paramétrage de linux-image-xen-amd64 (2.6.32+29) …
Traitement des actions différées (« triggers ») pour « initramfs-tools »…
update-initramfs: Generating /boot/initrd.img-2.6.32-5-xen-amd64
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
W: mdadm: no arrays defined in configuration file.

État actuel : 0 paquet cassé [-1].
root@ks369475:~#

Apres, il faut modifier l’ordre de boot des kernel pour faire prendre en compte le nouveau kernel  XEN par grub2

Modifier le ficher /etc/default/grub

# La configs des noyaux est ici : /boot/grub/grub.cfg
#GRUB_DEFAULT=0 1er noyau de /boot/grub/grub.cfg#2eme noyau de /boot/grub/grub.cfg, le noyau XEN
GRUB_DEFAULT=1

Renommer le fichier /etc/grub.d/10_linux

mv /etc/grub.d/10_linux /etc/grub.d/50_linux

update-grub

Modifier /etc/xen/xend-config.sxp comme ceci :

(network-script ‘network-route netdev=eth0′)
(vif-script     vif-route)

Ensuite, il faut transferer les 2 fichiers qui correspondent aux machines virtuelles deja existantes et qui peuvent etre dans /home/xen/domains.

Dans ces fichiers, il faut remplacer les references a sda par xvda car les noms ont change entre la version de Xen de debian 5 et celle de debian 6.

De la meme façon, il faut déplacer les fichiers présents dans /etc/xen

Voilà!

Configuration du réseau en IPV6 sur un kimsufi

March 14th, 2011

Le post de description est ici

Et la solution pour supprimer l’alerte kernel: IPv6 addrconf prefix with wrong length 56

Installation dom0 Xen sur Debian Lenny 64 bits, Kimsufi 250G 2010 à 17,93€ TTC chez OVH ;-)

June 2nd, 2010

dpkg -i  linux-image-2.6.26-2-xen-amd64_2.6.26-22_amd64.deb linux-modules-2.6.26-2-xen-amd64_2.6.26-22_amd64.deb

apt-get install grub mdadm initramfs-tools

fdisk -l
Disque /dev/sda: 250.0 Go, 250059350016 octets
255 heads, 63 sectors/track, 30401 cylinders
Units = cylindres of 16065 * 512 = 8225280 bytes
Identifiant disque: 0x0cf1421a

Périphérique Amorce    Début         Fin      Blocs    Id  Système
/dev/sda1   *           1         392     3148708+  83  Linux
/dev/sda2             393       30336   240525180   83  Linux
/dev/sda3           30337       30401      522112+  82  Linux swap / Solaris

grub-install –recheck /dev/sda

grub
>root (hd0,0)
>find /boot/grub/stage2 # si pas trouvé, essayer find grub/stage2
>       hd(0,0)
>       hd(1,0) # vous obtenez ceci si vous êtes en RAID

# on utilise le résultat du find
>setup (hd0)
>setup (hd1) # uniquement si vous êtes en RAID
>quit

apt-get install xen-tools

reboot

sqlite et C++ builder 6

September 18th, 2008
Eli Wheaton wrote:
> I'm having a problem trying to get SQLite to work with a C++Builder6
> project.
> Does anyone have any advice on how to do this?

Hi Eli,

I am using Borland's BCB6 with SQLite.

I have built SQLite DLL's using both the Borland compiler, and also the
MinGW/Msys tool set. I currently use MinGW to build the DLL from CVS source,
since it is simpler to use. The current SQLite Makefile has an implib target
which will build the import library that the Borland compiler needs to link
against the DLL.

If you don't need to build SQLite from source you can simply download the
current SQLite.DLL library from the web site
http://www.hwaci.com/sw/sqlite/download.html. You will also need the
sqlite.h header file which is included in the sqlite_source.zip file that
you can download from the same site.

To build a project that uses the DLL you will need to generate a Borland
import library. BCB6 comes with a command line tool called implib that will
do this. Simply open a command promt window, change to the directory where
the DLL is located, and run the following command (assuming that the Borland
bin directory is on your path);

implib -a sqlite.lib sqlite.dll

The -a argument is required to generate the correct symbol names in the
import library.

Now create a project that uses SQLite. The sample code at
http://www.hwaci.com/sw/sqlite/quickstart.html should work just fine for a
test. You will need to make sure the project options have the path to the
sqlite.h include file, and the path to the sqlite.lib library files set.
Build your project to generate your executable. Finally, you need to copy
the SQLite.DLL file into the same directory as your executable (or into the
Windows/System directory) since that is where Windows will look for the DLL.

You can now run your program, and it should create an SQLite database and
execute the SQL statement you give it.

Good luck.