Tips Tricks Tutorials

WEB-NES-BAY

Learn Tips and tricks on Linux, Hacking, linux, PHP, Perl, Web, Hardware

bookmark bookmark
WEBNESBAY On July - 10 - 2009

Its very easy to set up a Bluetooth personal area network in linux environment. I will setup this environment in Debian Ubuntu. For setting up we need kernel 2.6x

After connecting you need IP Tables if you want access the other network

Lets Begin the setting up process

Step 1

Install the below packages by apt-get command

sudo apt-get install bluetooth

sudo apt-get install bluez-utils

sudo apt-get install dhcp3-server

sudo apt-get install kdebluetooth (For KDE Environment)

Step 2

Pairing bluetooth devices

Edit hcid.conf as a root

/etc/bluetooth/hcid.conf change lm accept; to lm accept, master;

Step 3

Edit /etc/default/bluetooth change

PAND_ENABLED=0 to 1

and PAND_OPTIONS=”" to PAND_OPTIONS = “–listen –role=NAP –devup /ets/bluetooth/pan/dev-up”

Step 4

mkdir /etc/bluetooth/pan

touch /etc/bluetooth/pan/dev-up

Now keep the following code in /etc/bluetooth/pan/dev-up

#!/bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward
ifup bnep0
sleep 2
/etc/init.d/dhcp3-server restart

Make the code executable

chmod +x /etc/bluetooth/pan/dev-up

Step 5

Now we need to add the network interface in bluetooth

iface bnep0 inet static
address 10.0.254.1
netmask 255.255.255.240

post-up iptables -t nat -A POSTROUTING -s 10.0.254.0/24 -j MASQUERADE
post-up iptables -A FORWARD -i bnep0 -o eth0 -j ACCEPT
post-up iptables -A FORWARD -o bnep0 -i eth0 -j ACCEPT
pre-down /etc/init.d/dhcp3-server stop

eth0 is the interface you will be NAT-ed behind. Your external interface.

Step 6

Change the IPs and network settings as you like, just make sure to also reflect it in your dhcp.

In /etc/dhcp3/dhcpd.conf make sure you set

where ip-of-dns-server-goes-here is the IP address of the dns server to use. You can see the server you’re using in /etc/resolv.conf.

Declare a subnet for the PAN segment, should be the subnet you used for the bnetp device in /etc/network/interfaces. Replace the option routers 10.0.254.1; with the IP you have given your bnep0 interface in /etc/network/interfaces.

subnet 10.0.254.0 netmask 255.255.255.0 {
range 10.0.254.1 10.0.254.10;
option domain-name-servers 10.0.1.1;
option domain-name “bluetoothap.int.yourdomain.com”;
option routers 10.0.254.1;
option broadcast-address 10.0.254.255;
default-lease-time 600;
max-lease-time 7200;
}

Now restart the bluetooth daemon

/etc/init.d/bluetooth restart
Pair your device with your machine. After pairing you can able to access the network using blue tooth PAN Service for another computer

Troubleshooting

1. See if your bnep0 device is going up when a connection is requested and the interface is asked to come up.  You can test this with below command

watch -n1 “ifconfig”

You should see bnep0 coming up when you fire up your bluetooth client device to try and access the PAN network.

2. See that the script /etc/bluetooth/pan/dev-up is being executed, if you have not given a executable files

3.Watch the output of syslog to see if the dhcp server is assigned an IP to your device.

tail -f /var/log/syslog

tail -f /var/log/messages

4. Once you see the IP, try to ping your device with the ping command.

Bluetooth PAN settings for Nokia 6000 series
Menu:

Settings -> Connectivity -> Data Accounts.

In the list you should see your bluetooth AP.

Go to

Settings -> Connectivity -> Internet Settings -> Internet Profiles -> New profile

For Connect Using choose the bluetooth icon with the name of your bluetooth machine, the one showing in the data accounts, and also the PC you paired your Nokia.

Now make this profile active for internet, java and streaming. Make sure you press save.

Now you should be able to browse the internet trough your Mobile

Reference: howtoforge.com

Related posts:

  1. How to hack bluetooth mobile phone
  2. Install No Machine NX Server and client
Categories: Linux

Comments are closed.