Search:  
Gentoo Wiki

HOWTO_Configure_a_bluetooth_network_access_point

This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

Introduction

This HOWTO describes how to configure a bluetooth network access point using ethernet bridging. You need this if you want to access your local area network by using a bluetooth connection. It's compatible with all bluetooth devices which support the PAN profile.

Requisites

You will need at least (FIXME: might be lower requisites):

Code: emerge dependencies
 
  $ emerge \
    >=net-wireless/bluez-utils-2.16-r1 \
    >=sys-apps/baselayout-1.11.11-r3 \
    >=net-misc/bridge-utils-1.0.6 \
    >=sys-apps/hotplug-20040923
  

And bridge support in your kernel:

Code: kernel bridge support
 
$ grep CONFIG_BRIDGE /usr/src/linux/.config
CONFIG_BRIDGE=m
  

Adding bridging support in the kernel:

Networking  --->
     Networking options  --->
         <M> 802.1d Ethernet Bridging

Bridge configuration

Remove your current configuration from your network interface by replacing it with, don't forget to remove your default gateway:


File: /etc/conf.d/net
 
 config_eth0=( "null" )
  


Define an ethernet bridge in /etc/conf.d/net and configure it as it would be your current configuration for your network interface:


File: /etc/conf.d/net
 
 bridge_lan="eth0"
 config_lan=( "192.168.0.1 netmask 255.255.255.0" )
 routes_lan=(
      "default gw 192.168.0.1"
 )

 brctl_lan=( "stp off"
            "setfd 0" )

  

Remember to update any script that makes reference to eth0 and change that for lan, for example if you use pppoe you should have to update your /etc/ppp/pppoe.conf file to use lan instead of eth0: change "ETH=eth0" to "ETH=lan".


The stp off and setfd 0 settings ensure that the bridge won't wait the usual 30 seconds before relaying traffic to a new network card. This is to ensure that other bridges on the same network has been detected. But since each bluetooth connection is its own interface we would need to wait 30 seconds before transmitting data to a new bluetooth connection if this was used.


Code: Create a new network script for the lan ethernet bridge, and start it
 
 $ cd /etc/init.d/
 $ ln -s net.lo net.lan
 $ /etc/init.d/net.lan start
  


Code: Don't forget to update your runlevel configuration
 
 $ rc-update del net.eth0
 $ rc-update add net.lan default
  

Configure bnep startup script

Now we need to enable new bluetooth connections to be added to the bridge. For this we will be using the dev-up script that is called by the PAN daemon when a new network interface is added:

File: /etc/bluetooth/pan/dev-up
 
    #!/bin/sh
    # dynamic bnep* configuration for Bluetooth NAP
    ifconfig $1 up
    brctl addif lan $1
  


Code: Set the eXecute bit on the script:
 $ chmod 0755 /etc/bluetooth/pan/dev-up

Bluetooth configuration

Configure bluetooth with BNEP protocol support enabled as described in HOWTO The host-to-host Bluetooth, enable pand:

File: /etc/conf.d/bluetooth
 
 PAND_ENABLE=true
 PAND_OPTIONS="--listen --role NAP"
  


Code: Restart the bluetooth initscript
 
 $ /etc/init.d/bluetooth restart
  

Troubleshooting

How can I see which clients are connected?

Code: show connections
 
 $ pand --show
  

How can I see if the Ethernet bridge is working?

Code: show devices in bridge
 
 $ brctl show
 bridge name     bridge id               STP enabled     interfaces
 lan             8000.0007611f5ab8       no              bnep0
                                                         eth0
  

Like any bluetooth device, the bnep interfaces only coming up once a device connects to the pan network.

You probably need a DHCP server on your network. I'm using a DHCP server which runs on an other machine which is reachable through the bridge.

Concerns or Compliments? Please use the Discussion section.

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Configure_a_bluetooth_network_access_point"

Last modified: Mon, 24 Dec 2007 04:10:00 +0000 Hits: 27,316