Is Your Personal Area Network Giving You the BlueZ?
For the routed solution, you need to create a separate network/subnet for your PAN and route packets between this and the existing private network/ISP-connected machine. In this configuration pan0 will be the default gateway device and also provide the DHCP service for the PAN. Thus, pan0 will require a static IP configuration and its DHCP service will be separate from any other DHCP and dedicated to the PAN. For clarity, let's use the 10.0.0.0/24 private IP network range for this purpose. This time, there are four steps to get your routed PAN up and running:
Configure pan0 with static IP information.
Configure and run DHCP for the PAN.
Turn on IP forwarding to route packets between pan0 and wlan0/eth0.
Enable NAT on the wlan0/eth0 interface.
Then:
ifconfig pan0 10.0.0.1 netmask 255.255.255.0 ↪broadcast 10.0.0.255 up
Use your system tools to make permanent settings.
Below is a small DHCP configuration for the routed PAN:
# small dhcp config for bluetooth PAN
ddns-update-style none;
authoritative;
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.10 10.0.0.100;
option domain-name-servers 192.168.0.1;
option domain-name "bluetooth.net";
option routers 10.0.0.1;
option broadcast-address 10.0.0.255;
default-lease-time 600;
max-lease-time 7200;
host btmobile {
hardware ethernet 78:e7:d1:ab:d5:6f;
fixed-address 10.0.0.5;
}
}
Alter the DNS information as necessary.
pan0 should be configured and up and running before you start the DHCP service. The next step involves enabling IP forwarding so that packets are routed between pan0 and your existing interface (wlan0/eth0).
In older systems, IP forwarding is enabled by echoing a value of “1” into the appropriate system file:
echo 1 > /proc/sys/net/ipv4/ip_forward
In more recent systems, this is achieved by editing /etc/sysctl.conf:
# Controls IP packet forwarding net.ipv4.ip_forward = 1
The setting also may be available in your distribution's firewall configuration GUI tool. If none of these methods work on your system, consult your distribution's documentation.
Finally, you need to tell the kernel netfilter software to “masquerade” (NAT) PAN packets through the wlan0/eth0 interface. You may be able to do this using your distribution's firewall configuration GUI tool (the IP forwarding setting may be available here too). If not, it can be achieved using the iptables command:
iptables -A POSTROUTING -t nat -o wlan0 -j MASQUERADE
Substitute eth0 for wlan0 if you are using the routing option because your Linux box connects directly to your ISP and your eth0 interface has an ISP-assigned, routable IP address (Figure 2).
If all has gone well up to this point, your NAP service should be active a few seconds after you connect/authenticate your remote BT device. You should, for example, be able to ping the device from your Linux box. If IP is not yet running, you can use l2ping <MAC-ADDRESS> to ping the remote device.
BlueZ v.4 does not appear to provide separate configurations for GN and PANU modes of PAN operation, but this is of no consequence because, as was noted above, these are subsumed by the NAP mode. If you only want to connect remote BT devices to your Linux box, and do not require access to the local network or Internet, you simply can omit step 1 from the bridged solution and either employ the DHCP configuration from the routed solution or manually set IP parameters for pan0 and your BT devices.
In fact, Bluetooth is supposed to implement the draft Link-local Autoconfiguration Protocol (variously known elsewhere as Avahi, Bonjour, Rendezvouz and APIPA), so you could try using this for IP configuration instead of running a DHCP service. However, I had no joy with this approach under BlueZ v.4, so I leave it as a potential solution for those of an experimental nature. I would be happy to hear that this facility is alive and well in the BlueZ package if anyone succeeds where I have failed.
For those who want to retain the old ways of configuring and running the Bluetooth facilities, the development team has provided a legacy implementation in the form of a package that contains the separate dæmons as provided in BlueZ 3.x. This package is called Bluez-compat and should satisfy the change-resistant among you. Michael Schmidt (see Resources) has produced a useful how-to document covering the legacy formats.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- Designing Electronics with Linux
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Dynamic DNS—an Object Lesson in Problem Solving
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Using Salt Stack and Vagrant for Drupal Development
- Reply to comment | Linux Journal
2 hours 27 min ago - Dynamic DNS
3 hours 1 min ago - Reply to comment | Linux Journal
3 hours 59 min ago - Reply to comment | Linux Journal
4 hours 49 min ago - Not free anymore
8 hours 51 min ago - Great
12 hours 38 min ago - Reply to comment | Linux Journal
12 hours 46 min ago - Understanding the Linux Kernel
15 hours 1 min ago - General
17 hours 31 min ago - Kernel Problem
1 day 3 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?





Comments
how to setup pan0
Hi,
This article is a non-starter for me as the bluetooth daemon fails to create a pan0 device. Any pointers on configuring the myriad config files to get bluetoothd to create pan0?