View Single Post
Halftux's Avatar
Posts: 878 | Thanked: 2,535 times | Joined on Feb 2012 @ Germany
#62
Hi,

in the last version 1.0.9 I included a setup page for a bt pan connection.

Prerequirements for pan:
[N900]
/etc/bluetooth/main.conf
comment out: DisablePlugins =network,input,hal

Here some instruction how to use it for:

Linux BT

Connect a (old) linux system with bt pan:

- [PC] make the adapter visible
Code:
hciconfig -a hci0 piscan
- [N900] in the normal bluetooth setup switch on bt and make the adapter visible. Furthermore make a new trusted device and choose the pc. Now they should be paired.

- [PC] if you don't know the bt-mac address from N900 you can look for example with this command
Code:
hcitool scan
-[PC] connect with pand to N900 mac address
Code:
pand --connect 00:00:00:00:00:00
-[N900] in genwall go to route->BT tab and save you ips and choose dnsmasq only lan. Now you can push the start button.

-[PC] bring device up and get ip address
Code:
ifconfig bnep0 up
dhclient bnep0
Now you have a normal network up.


Connect a (new) linux system with bt pan:

- [PC] make the adapter visible
Code:
hciconfig -a hci0 piscan
- [N900] switch on bluetooth and make it discoverable

- [PC] pair with your N900 by add a new device

- [PC] run bluez script with the mac from N900
Code:
cd /usr/share/doc/bluez/examples
./test-network 00:00:00:00:00:00 nap
- [N900] in genwall go to route->BT tab and save you ips and choose dnsmasq only lan. Now you can push the start button.

- [PC] if the device is not up bring device up and get an ip address
Code:
ifconfig bnep0 up
dhclient bnep0

In case you want forward internet from pc to phone

[PC] avtivate forwarding
old
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
new
Code:
sysctl -w net.ipv4.conf.all.forwarding=1

permanent:Add net.ipv4.conf.all.forwarding=1 to /etc/sysctl.conf
[PC] activate masquerade source is the bt pan Network
Code:
sudo iptables -t nat -A POSTROUTING -s 192.168.8.0/24 -j MASQUERADE
[N900] go to route->Gate tab and add the bt pan ip from PC as a new gateway.


In case you want forward internet from N900 to PC

-[N900] before you push the start button select dnsmasq forward

your N900 should have proper internet connection and a bt pan connection
- [PC] set a default route to ip from N900 bnep0 device
Code:
sudo route add default gw 192.168.8.2
- [N900] genwall
{local-basics}
1.:select wan device gprs/usb/wlan
2. I would "accept connection from local machine"... makes live easier
3. If you want to connect from pc->N900 without openning ports. I would also recommend to "Accept connection from local lan".

{for/out}
4. activate forwarding and set lan device to bnep
5. Masquerade wan device should be active
6. If you like to connect for example from wifi to ssh from the pc you can forward the port to the ip address from pc bnep0 device.
Use for ssh the ip from n900 wifi/usb/gprs and it will automatic connect to the pc.
{local-basics}
7.gen rules
8. push the start button
Attached Images
 

Last edited by Halftux; 2015-01-04 at 17:05. Reason: added picture
 

The Following 4 Users Say Thank You to Halftux For This Useful Post: