HOWTO network/bluetooth/phone/C702

Après un billet humoristique, voici un billet un peu plus technique (enfin…).

Ok, vous me direz : tu as un abonnement 3G+, tu l’uutilises et voilà basta.
Trop facile 🙂 Si tu ne veux pas griller ton abonnement et que ton patron ne t’étrippe pas en recevant la facture, alors essayons d’être malin.

Bon avec un Linux, iptables, BNEP ( Bluetooth Network Encapsulation Protocol), une clef USB Bluetooth et le démon pand, tu peux toi aussi publique ne rien payer 🙂 (Ok, je pete un peu les plombs).

Bref:

 # apt-get install bluez-utils 

Ensuite, il faut tout d’abord vérifier que tout se passe bien :

 root@titux:/etc/bluetooth # hciconfig -a hci0: Type: USB BD Address: 00:0A:94:11:C4:9B ACL MTU: 120:20 SCO MTU: 64:8 UP RUNNING PSCAN ISCAN RX bytes:992040 acl:4648 sco:0 events:2842 errors:0 TX bytes:255624 acl:3499 sco:0 commands:213 errors:0 Features: 0xff 0xff 0x05 0x00 0x00 0x00 0x00 0x00 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH HOLD SNIFF PARK Link mode: SLAVE ACCEPT Name: 'titux-0' Class: 0x3e0100 Service Classes: Networking, Rendering, Capturing Device Class: Computer, Uncategorized HCI Ver: 1.1 (0x1) HCI Rev: 0x0 LMP Ver: 1.1 (0x1) LMP Subver: 0x757 Manufacturer: Silicon Wave (11) 

Et avoir configurer et avoir les démons bluetooth opérationnel sur votre station :

 # ps axf [...] 21042 ? Ss 0:00 hcid: processing events 21044 ? Ss 0:00 /usr/sbin/sdpd [...] # cat /etc/bluetooth/rfcomm.conf rfcomm0 { bind yes; device 00:22:98:A3:B2:23; channel 7; comment "Titux"; } 

Ok, votre téléphone est autoriser à se connecter 🙂
Continuons :

 # modprobe bnep # pand --listen --role NAP --master --autozap 

Ok, on peut maintenant se connecter niveau bluetooth (Niveau 2). Voyons niveau 3, si on peut envoyer des paquets IP. Pour cela, installons un serveur DHCP. Pour ma part, je sers des IP en 192.168.1.[10-200]/24 (RFC1918) et maintenant donnons lui accès au net :

 # ip link set bnep0 up # ip addr add 192.168.1.1/24 dev bnep0 # iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -d 0.0.0.0/0 -j SNAT --to 217.169.242.159 

Ok 🙂 On peut surfer, avoir des flux RSS, Twitter, … La liberté quoi (ok près de sa station :-)).

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.