# [Solved] Bnep issues  [Nap Gentoo - Client Windows ]

## Ciccio Bueo

Hi, I have some problem whit nap...

I not have the bnep0 interface:

```
 # /etc/init.d/net.bnep0 restart                               [ ok ]

bnep0: unknown interface: No such device

interface bnep0 does not exist!         
```

```
# ifconfig bnep0 192.168.2.1

SIOCSIFADDR: No such device

bnep0: unknown interface: No such device

```

```
# lsmod

Module                  Size  Used by

pppoe                  10496  2

pppox                   2664  1 pppoe

ppp_generic            21364  6 pppoe,pppox

slhc                    5920  1 ppp_generic

hci_usb                13160  2

snd_seq                50416  0

snd_via82xx            23136  1

snd_ac97_codec         82940  1 snd_via82xx

snd_pcm                81608  2 snd_via82xx,snd_ac97_codec

snd_timer              21540  2 snd_seq,snd_pcm

snd_page_alloc          7652  2 snd_via82xx,snd_pcm

snd_mpu401_uart         6368  1 snd_via82xx

snd_rawmidi            18976  1 snd_mpu401_uart

snd_seq_device          7148  2 snd_seq,snd_rawmidi

snd                    42808  10 snd_seq,snd_via82xx,snd_ac97_codec,snd_pcm,snd_timer,snd_mpu401_uart,snd_rawmidi,snd_seq_device

soundcore               7392  1 snd

bnep                   12384  2

vt1211                 21652  0

i2c_sensor              2816  1 vt1211

drm                    60756  0

via_agp                 7648  1

agpgart                29608  2 drm,via_agp

rfcomm                 35196  1

l2cap                  22116  9 bnep,rfcomm

bluetooth              43812  8 hci_usb,bnep,rfcomm,l2cap

```

my hcid.conf:

```
# cat /etc/bluetooth/hcid.conf

#

# HCI daemon configuration file.

#

# $Id: hcid.conf,v 1.7 2004/12/13 14:16:03 holtmann Exp $

#

# HCId options

options {

        # Automatically initialize new devices

        autoinit yes;

        # Security Manager mode

        #   none - Security manager disabled

        #   auto - Use local PIN for incoming connections

        #   user - Always ask user for a PIN

        #

        security auto;

        # Pairing mode

        #   none  - Pairing disabled

        #   multi - Allow pairing with already paired devices

        #   once  - Pair once and deny successive attempts

        pairing multi;

        # PIN helper

        pin_helper /usr/bin/bluepin; #/etc/bluetooth/pid.sh;

        # D-Bus PIN helper

        #dbus_pin_helper;

}

# Default settings for HCI devices

device {

        # Local device name

        #   %d - device id

        #   %h - host name

        name "Bluez %h %d";

        # Local device class

        class 0x100100;

        #class 0xFF0100

        # Default packet type

        #pkt_type DH1,DM1,HV1;

        # Inquiry and Page scan

        iscan enable; pscan enable;

        # Default link mode

        #   none   - no specific policy

        #   accept - always accept incoming connections

        #   master - become master on incoming connections,

        #            deny role switch on outgoing connections

        lm accept, master;

        # Default link policy

        #   none    - no specific policy

        #   rswitch - allow role switch

        #   hold    - allow hold mode

        #   sniff   - allow sniff mode

        #   park    - allow park mode

        lp rswitch,hold,sniff,park;

        # Authentication and Encryption (Security Mode 3)

        auth enable;

        encrypt enable;

}

```

```
 # cat .config | grep BNEP

CONFIG_BT_BNEP=m

CONFIG_BT_BNEP_MC_FILTER=y

CONFIG_BT_BNEP_PROTO_FILTER=y

```

I see the other device, and I can ping.

I don't find my error....  :Crying or Very sad: 

(sorry for my english...  :Wink:    )Last edited by Ciccio Bueo on Thu Sep 22, 2005 6:22 am; edited 2 times in total

----------

## the_mgt

You mean, you can ping with l2ping? That is a good sign.

I do not configure my bnep0 manually, i get ips from conf.d/net.

You have to first set up the pan with the pand, and after that, you can assign the bnep0 devices.

-----------------------------------------------------------------------------------------------------------------

On the "server":

in /etc/conf.d/bluetooth:

PAND_OPTIONS="--listen --role NAP --master  --autozap --persist --ethernet bnep0"

in /etc/conf.d/net:

iface_bnep0="192.168.2.1 broadcast 192.168.2.255 netmask 255.255.255.0"

------------------------------------------------------------------------------------------------------------------

On the "Client":

/usr/bin/pand  --connect 00:E0:98:85:36:8B --autozap --service NAP --persist

in /etc/conf.f/net:

config_bnep0=( "192.168.2.2 broadcast 192.168.2.255 netmask 255.255.255.0" )

routes_bnep0=( "default via 192.168.2.1" )

------------------------------------------------------------------------------------------------------------------

If you try these commands from the commandline, use the option "--nodetach  Do not become a daemon" for debugging.

Both pins should be identical and you should turn off encryption and auth for debugging in the beginning.

----------

## Ciccio Bueo

hi, 

I've change the conf whit your sugestion:

```
# cat /etc/bluetooth/rfcomm.conf

#

# RFCOMM configuration file.

#

# $Id: rfcomm.conf,v 1.1 2002/10/07 05:58:18 maxk Exp $

#

rfcomm0 {

        # Automatically bind the device at startup

        bind yes;

        # Bluetooth address of the device

        #device 00:12:62:C4:60:8E;

        device 00:10:60:A6:A2:D4;

        # RFCOMM channel for the connection

        channel 1;

        # Description of the connection

        comment "Connessione Portatile";

}

```

```
# cat /etc/bluetooth/hcid.conf

#

# HCI daemon configuration file.

#

# $Id: hcid.conf,v 1.7 2004/12/13 14:16:03 holtmann Exp $

#

# HCId options

options {

        # Automatically initialize new devices

        autoinit yes;

        # Security Manager mode

        #   none - Security manager disabled

        #   auto - Use local PIN for incoming connections

        #   user - Always ask user for a PIN

        #

        security auto;

        # Pairing mode

        #   none  - Pairing disabled

        #   multi - Allow pairing with already paired devices

        #   once  - Pair once and deny successive attempts

        pairing multi;

        # PIN helper

        pin_helper /usr/bin/bluepin;

        # D-Bus PIN helper

        #dbus_pin_helper;

}

# Default settings for HCI devices

device {

        # Local device name

        #   %d - device id

        #   %h - host name

        name "Bluez %h %d";

        # Local device class

        #class 0x100100;

        #class 0xFF0100

        class 0x3e0100;

        # Default packet type

        #pkt_type DH1,DM1,HV1;

        # Inquiry and Page scan

        iscan enable; pscan enable;

        # Default link mode

        #   none   - no specific policy

        #   accept - always accept incoming connections

        #   master - become master on incoming connections,

        #            deny role switch on outgoing connections

        lm accept;

        #, master;

        # Default link policy

        #   none    - no specific policy

        #   rswitch - allow role switch

        #   hold    - allow hold mode

        #   sniff   - allow sniff mode

        #   park    - allow park mode

        lp rswitch,hold,sniff,park;

        # Authentication and Encryption (Security Mode 3)

        auth enable;

        encrypt enable;

}

```

```
 # cat /etc/bluetooth/pin

1234

```

```
# cat /etc/conf.d/bluetooth

# Bluetooth configuraton file

# Start of hcid (allowed values are "true" and "false")

HCID_ENABLE=true

# Config file for hcid

HCID_CONFIG="/etc/bluetooth/hcid.conf"

# Start sdpd (allowed values are "true" and "false")

SDPD_ENABLE=true

# Start hidd (allowed values are "true" and "false")

HIDD_ENABLE=false

# Arguments to hidd

HIDD_OPTIONS=""

# Run hid2hci (allowed values are "true" and "false")

HID2HCI_ENABLE=false

# Bind rfcomm devices (allowed values are "true" and "false")

RFCOMM_ENABLE=true

# Config file for rfcomm

RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"

# Start dund (allowed values are "true" and "false")

DUND_ENABLE=false

# Arguments to dund

DUND_OPTIONS="--listen --persist"

# Start pand (allowed values are "true" and "false")

PAND_ENABLE=true

# Arguments to pand

PAND_OPTIONS="--listen --role NAP --master --autozap --persist --ethernet bnep0"#PAND_OPTIONS="--listen --role NAP"

```

```
# /etc/init.d/bluetooth restart

 * Shutting down Bluetooth ...

 *     Stopping pand ...                                                  [ ok ]

 *     Stopping rfcomm ...                                                [ ok ]

 *     Stopping sdpd ...                                                  [ ok ]

 *     Stopping hcid ...                                                  [ ok ] 

* Starting Bluetooth ...

 *     Starting hcid ...                                                  [ ok ] 

*     Starting sdpd ...                                                  [ ok ] 

*     Starting rfcomm ...                                                [ ok ] 

*     Starting pand ...                                                  [ ok ]
```

```
# ps -ae | grep hcid

10882 ?        00:00:00 hcid

tux3 matteo # ps -ae | grep sdpd

10884 ?        00:00:00 sdpd

```

```
# hciconfig -a

hci0:   Type: USB

        BD Address: 00:10:60:A5:BD:11 ACL MTU: 192:8 SCO MTU: 64:8

        UP RUNNING PSCAN ISCAN AUTH ENCRYPT

        RX bytes:893 acl:0 sco:0 events:107 errors:0

        TX bytes:2356 acl:0 sco:0 commands:71 errors:0

        Features: 0xff 0xff 0x0f 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: 'Bluez tux3 0'

        Class: 0x3e0100

        Service Classes: Networking, Rendering, Capturing

        Device Class: Computer, Uncategorized

        HCI Ver: 1.1 (0x1) HCI Rev: 0x20d LMP Ver: 1.1 (0x1) LMP Subver: 0x20d

        Manufacturer: Cambridge Silicon Radio (10)

```

But:

```
 # hcitool dev

Devices:

        hci0    00:10:60:A5:BD:11

tux3 matteo # hcitool scan

Scanning ...

        00:10:60:A6:A2:D4       PORTATILE

tux3 matteo # hcitool inq

Inquiring ...

        00:10:60:A6:A2:D4       clock offset: 0x31ee    class: 0x020104

tux3 matteo # l2ping 00:10:60:A6:A2:D4

Can't connect: Permission denied

```

```
 # cat /etc/conf.d/net

# /etc/conf.d/net:

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18 19:39:22 azarah Exp $

# Global config file for net.* rc-scripts

# This is basically the ifconfig argument without the ifconfig $iface

#

iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"

#iface_eth1="207.170.82.202 broadcast 207.0.255.255 netmask 255.255.0.0"

# For DHCP set iface_eth? to "dhcp"

# For passing options to dhcpcd use dhcpcd_eth?

#

#iface_eth0="dhcp"

#dhcpcd_eth0="..."

# For adding aliases to a interface

#

#alias_eth0="192.168.0.3 192.168.0.4"

# NB:  The next is only used for aliases.

#

# To add a custom netmask/broadcast address to created aliases,

# uncomment and change accordingly.  Leave commented to assign

# defaults for that interface.

#

#broadcast_eth0="192.168.0.255 192.168.0.255"

#netmask_eth0="255.255.255.0 255.255.255.0"

# For setting the default gateway

#

#gateway="eth0/192.168.0.1"

iface_bnep0="192.168.2.1 broadcast 192.168.2.255 netmask 255.255.255.0"

```

my clients is a windows xp sp2... and not see my server linux...

 :Crying or Very sad: 

----------

## the_mgt

First of all, i didn't arrive to connect to my pan from windows, last time i tried. It was possible from linux clients, but not from winxp. I will try when i reboot next time. (A friend of mine got it working with a GN, not NAP.) Are you able to see your linux servers bluetooth services from windows?

About your configs:

Try this as /etc/bluetooth/hcid.conf:

```

options {

        autoinit yes;

        security auto;

        pairing multi;

        pin_helper /etc/bluetooth/pin-helper; <- you use bluepin, which most of the time does not work

}

device {

        name "BlueZ (%d)";

        class 0x3e0100;

        iscan enable; pscan enable;

        lm master;

        lp rswitch,hold,sniff,park;

}

```

/etc/bluetooth/pin-helper should look like this:

```

#!/bin/sh

echo -n "PIN:"

cat /etc/bluetooth/pin

```

"chmod" the file to 755

Try to start your pand from commandline with pand --nodetach --listen --role NAP --master  --autozap --persist --ethernet bnep0, so it won't go into demon mode and you can see if your windows client does connect.

PS: I didn't set anything in rfcomm.conf, it looks like this:

```

rfcomm0 {

        bind no;

        device 11:22:33:44:55:66;

        channel 1;

        comment "Example Bluetooth device";

}

```

----------

## Ciccio Bueo

ok, now winxp clients see my linux NAP, but,  not start the connection.

tail -f /var/log/messages

```
Aug 30 14:55:45 tux3 hcid[10663]: Bluetooth HCI daemon

Aug 30 14:55:45 tux3 sdpd[10665]: Bluetooth SDP daemon

Aug 30 14:55:45 tux3 pand[10668]: Bluetooth PAN daemon version 2.19

Aug 30 14:55:45 tux3 hcid[10663]: Starting security manager 0

Aug 30 14:56:43 tux3 hcid[10663]: link_key_request (sba=00:10:60:A5:BD:11, dba=00:10:60:A6:A2:D4)

Aug 30 14:57:55 tux3 hcid[10663]: link_key_request (sba=00:10:60:A5:BD:11, dba=00:10:60:A6:A2:D4)

```

----------

## the_mgt

Ok, i am rebooting to windows now, to check if it works here. Could you try to reboot the winxp machine with some livecd, knoppix, or something like that, and see if your pan works with linux?

----------

## Ciccio Bueo

stop!

now works!!!  :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

I don use this how-to: http://gentoo-wiki.com/HOWTO_Configure_a_bluetooth_network_access_point

at the moment work whit manual command:

I use pppoe in kernel-mode

```
# ifconfig -a

dummy0    Link encap:Ethernet  HWaddr AE:E0:F0:8B:A6:9A

          BROADCAST NOARP  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

eth0      Link encap:Ethernet  HWaddr 00:40:63:DE:00:00

          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:390 errors:0 dropped:0 overruns:0 frame:0

          TX packets:387 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:371860 (363.1 Kb)  TX bytes:41671 (40.6 Kb)

          Interrupt:11 Base address:0x2000

eth1      Link encap:UNSPEC  HWaddr 00-40-63-50-00-04-A2-E6-00-00-00-00-00-00-00-00

          BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:86 errors:0 dropped:0 overruns:0 frame:0

          TX packets:86 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:5416 (5.2 Kb)  TX bytes:5416 (5.2 Kb)

ppp0      Link encap:Point-to-Point Protocol

          inet addr:82.58.221.60  P-t-P:192.168.100.1  Mask:255.255.255.255

          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1

          RX packets:376 errors:0 dropped:0 overruns:0 frame:0

          TX packets:357 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:3

          RX bytes:362183 (353.6 Kb)  TX bytes:31459 (30.7 Kb)

```

whit this how-to http://bluez.sourceforge.net/contrib/HOWTO-PAN

```

tux3 matteo # brctl addbr pan0 eth0

tux3 matteo # ifconfig pan0 192.168.0.3

tux3 matteo # brctl setfd pan0 0

tux3 matteo # brctl stp pan0 off

tux3 matteo # brctl addif pan0 eth0

tux3 matteo # brctl show

bridge name     bridge id               STP enabled     interfaces

pan0            8000.004063de0000       no              eth0

tux3 matteo # nano -w /etc/bluetooth/pan/dev-up

tux3 matteo # chmod 0755 /etc/bluetooth/pan/dev-up

```

restart the bluetooth...

```

tux3 matteo # /etc/init.d/bluetooth restart

 * Shutting down Bluetooth ...

 *     Stopping pand ...                                                  [ ok ]

 *     Stopping rfcomm ...                                                [ ok ]

 *     Stopping sdpd ...                                                  [ ok ]

 *     Stopping hcid ...                                                  [ ok ]

 * Starting Bluetooth ...

 *     Starting hcid ...                                                  [ ok ]

 *     Starting sdpd ...                                                  [ ok ]

 *     Starting rfcomm ...                                                [ ok ]

 *     Starting pand ...                                                  [ ok ]

```

from win I see che NAP and click on "connect"

```

tux3 matteo # tail -f /var/log/messages

Aug 30 15:44:27 tux3 pan0: port 1(eth0) entering learning state

Aug 30 15:44:27 tux3 pan0: topology change detected, propagating

Aug 30 15:44:27 tux3 pan0: port 1(eth0) entering forwarding state

Aug 30 15:47:09 tux3 pand[8239]: Accept failed. Interrupted system call(4)

Aug 30 15:47:09 tux3 sdpd[8236]: terminating...

Aug 30 15:47:09 tux3 hcid[8234]: Exit.

Aug 30 15:47:09 tux3 hcid[10585]: Bluetooth HCI daemon

Aug 30 15:47:09 tux3 hcid[10585]: Starting security manager 0

Aug 30 15:47:09 tux3 sdpd[10589]: Bluetooth SDP daemon

Aug 30 15:47:09 tux3 pand[10592]: Bluetooth PAN daemon version 2.19

Aug 30 15:49:15 tux3 hcid[10585]: pin_code_request (sba=00:10:60:A5:BD:11, dba=00:10:60:A6:A2:D4)

Aug 30 15:49:15 tux3 hcid[10585]: link_key_notify (sba=00:10:60:A5:BD:11, dba=00:10:60:A6:A2:D4)

Aug 30 15:49:18 tux3 pand[10598]: New connection from 00:10:60:A6:A2:D4 bnep0

Aug 30 15:49:18 tux3 device bnep0 entered promiscuous mode

Aug 30 15:49:18 tux3 pan0: port 2(bnep0) entering learning state

Aug 30 15:49:18 tux3 pan0: topology change detected, propagating

Aug 30 15:49:18 tux3 pan0: port 2(bnep0) entering forwarding state

```

and................

```
 # brctl show

bridge name     bridge id               STP enabled     interfaces

pan0            8000.001060a5bd11       no              eth0

                                                        bnep0

```

```
# pand --show bnep0 00:10:60:A6:A2:D4 NAP

```

YES!!! Tanks!!! Very Very Thanks!  :Very Happy: 

now I test the connection!

----------

## Ciccio Bueo

ok, the net works well.... but from clients I can't go to internet... 

On clients I have configire the connections:

ip 192.168.0.4

subnetmask 255.255.255.0

gw: 192.163.0.3 (the adress of my pan0)

DND (i use my provider adress...)

----------

## the_mgt

Cool!

The gw address should be your PAN-Server. On your PAN Server, you need a firewall, which does "masquerading". Do you have that? If not, try shorewall, it's pretty easy and has fine howtos.

----------

## Ciccio Bueo

Thanks!

I not have a firewall...  :Crying or Very sad: 

....at the moment! Now try to configure a firewall!  :Very Happy: 

----------

## the_mgt

Did you try Shorewall? It's easy, you need something like this in /etc/shorewall/masq:

```

#INTERFACE              SUBNET          ADDRESS         PROTO   PORT(S)

 ppp0                   eth0

 ppp0                   bnep0

```

But you use that bridge stuff, so i am not really sure, what you need.

----------

## livebrain

Failed to connect to SDP server on 08:00:1F:49:50:7B

when i run "gnome-obex-send" i get that error in the ternimal, and pops up a window saying that the remote device cannot receive objects

does anyone kows what i'm doing wrong ?

p.s i can receive files using "gnome-obex-server"

----------

## Deathwing00

Split from original: https://forums.gentoo.org/viewtopic-t-194183.html

Threads under Documentation, Tips & Tricks are not to ask for help.

----------

## Ciccio Bueo

no no no no....  [ITA] non funziona una mazza [/ITA]

 :Crying or Very sad:   :Crying or Very sad:   :Crying or Very sad: 

not work...

my windows client see my NAP Gentoo, but not start the connection!!!!!!!!!!!!!!!!   :Twisted Evil: 

when I try to connect client to NAP, windows ask the pin, but the bnep0 interface not will create...

my config:

grep -v "#" /etc/bluetooth/hcid.conf

```
  

options {

        autoinit yes;

        security auto;

        pairing multi;

        pin_helper /etc/bluetooth/pin-helper;

}

device {

        name "NAP Bluetooth %h";

        class 0x020104;

        iscan enable; pscan enable;

        lm master;

        lp rswitch,hold,sniff,park;

        auth enable;

        encrypt enable;

}

```

grep -v "#" /etc/bluetooth/hcid.conf

```

rfcomm0 {

        bind no;

        device 11:22:33:44:55:66;

        channel 1;

        comment "Example Bluetooth device";

}

```

grep -v "#" /etc/bluetooth/pin-helper

```

echo -n "PIN:"

cat /etc/bluetooth/pin

```

```
# cat /etc/bluetooth/pin

1234

```

# grep -v "#" /etc/conf.d/bluetooth

```

HCID_ENABLE=true

HCID_CONFIG="/etc/bluetooth/hcid.conf"

SDPD_ENABLE=true

HIDD_ENABLE=false

HIDD_OPTIONS=""

HID2HCI_ENABLE=false

RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"

DUND_ENABLE=false

DUND_OPTIONS="--listen --persist"

PAND_ENABLE=true

PAND_OPTIONS="--listen --role NAP "

```

cat /etc/bluetooth/pan/dev-up

```
# 

#!/bin/sh

        brctl addif pan0 $1     # $1 is the new if name, passed by 'pand'

        ifconfig $1 0.0.0.0

```

 # /etc/init.d/bluetooth restart

```

 * Shutting down Bluetooth ...

 *     Stopping pand ...                                                  [ ok ]

 *     Stopping sdpd ...                                                  [ ok ]

 *     Stopping hcid ...                                                  [ ok ]

 * Starting Bluetooth ...

 *     Starting hcid ...                                                  [ ok ]

 *     Starting sdpd ...                                                  [ ok ]

 *     Starting pand ...                                                  [ ok ]

```

 # hcitool scan

  (the windows client)

```
Scanning ...

        00:10:60:A6:A2:D4       ELISA
```

 hcitool inq

```

Inquiring ...

        00:10:60:A6:A2:D4       clock offset: 0x158d    class: 0x020104
```

my usb dongle: 

 # hcitool dev

```

Devices:

        hci0    00:10:60:A5:BD:11
```

# hciconfig -a

```

hci0:   Type: USB

        BD Address: 00:10:60:A5:BD:11 ACL MTU: 192:8 SCO MTU: 64:8

        UP RUNNING PSCAN ISCAN AUTH ENCRYPT

        RX bytes:705 acl:0 sco:0 events:26 errors:0

        TX bytes:603 acl:0 sco:0 commands:25 errors:0

        Features: 0xff 0xff 0x0f 0x00 0x00 0x00 0x00 0x00

        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3

        Link policy: RSWITCH HOLD SNIFF PARK

        Link mode: MASTER

        Name: 'NAP Bluetooth homeserver'

        Class: 0x020104

        Service Classes: Networking

        Device Class: Computer, Desktop workstation

        HCI Ver: 1.1 (0x1) HCI Rev: 0x20d LMP Ver: 1.1 (0x1) LMP Subver: 0x20d

        Manufacturer: Cambridge Silicon Radio (10)
```

and the log when I try to connect fron windows clients:

```
Sep  9 17:36:44 homeserver hcid[8752]: Bluetooth HCI daemon

Sep  9 17:36:44 homeserver sdpd[8754]: Bluetooth SDP daemon

Sep  9 17:36:44 homeserver pand[8756]: Bluetooth PAN daemon version 2.19

Sep  9 17:36:45 homeserver hcid[8752]: Starting security manager 0

Sep  9 17:36:51 homeserver hcid[8752]: link_key_request (sba=00:10:60:A5:BD:11, dba=00:10:60:A6:A2:D4)

Sep  9 17:36:59 homeserver hcid[8752]: link_key_request (sba=00:10:60:A5:BD:11, dba=00:10:60:A6:A2:D4)

Sep  9 17:36:59 homeserver hcid[8752]: pin_code_request (sba=00:10:60:A5:BD:11, dba=00:10:60:A6:A2:D4)

Sep  9 17:37:00 homeserver hcid[8752]: link_key_notify (sba=00:10:60:A5:BD:11, dba=00:10:60:A6:A2:D4)

```

but NOT start the connection and I can't see bnep interface...

----------

## the_mgt

Hi!

@Ciccio: Try to add "--master  --autozap --persist --ethernet bnep0" to your PAND_OPTIONS in /etc/conf./bluetooth. Also, you can try to comment out  auth enable; and encrypt enable; in your hcid.conf.

I will try to connect to my nap with windows later.

@livebrain: To which kind of device do you try to send? Mobile phone? Other computer?

Are you using the correct pin on both devices? I just used obex once, and it worked perfectly fine.

Could you give more information?

----------

## Ciccio Bueo

 *the_mgt wrote:*   

> Hi!
> 
> @Ciccio: Try to add "--master  --autozap --persist --ethernet bnep0" to your PAND_OPTIONS in /etc/conf./bluetooth. Also, you can try to comment out  auth enable; and encrypt enable; in your hcid.conf.
> 
> I will try to connect to my nap with windows later.
> ...

 

Hi!   :Very Happy: 

I have try to add 

```
--master  --autozap --persist --ethernet bnep0
```

 in /etc/conf.d/bluetooth and to mark whhit "#" "auth enable" and "encrypt enable", but this not solve the problem...

----------

## Ciccio Bueo

I have read a lot of doc... but no solution...

i use iptables... is it the problem?

```
 iptables --list

Chain INPUT (policy ACCEPT)

target     prot opt source               destination

ACCEPT     all  --  anywhere             anywhere

ACCEPT     all  --  anywhere             anywhere

REJECT     udp  --  anywhere             anywhere            udp dpt:bootps reject-with icmp-port-unreachable

REJECT     udp  --  anywhere             anywhere            udp dpt:domain reject-with icmp-port-unreachable

ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh

DROP       tcp  --  anywhere             anywhere            tcp dpts:0:1023

DROP       udp  --  anywhere             anywhere            udp dpts:0:1023

Chain FORWARD (policy DROP)

target     prot opt source               destination

DROP       all  --  anywhere             192.168.0.0/16

ACCEPT     all  --  192.168.0.0/16       anywhere

ACCEPT     all  --  anywhere             192.168.0.0/16

ACCEPT     all  --  anywhere             anywhere

ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)

target     prot opt source               destination

```

or the problem is udev?

I need a "mkdone bnep" ? or change udevrules?

NEWS: if I try 

```
hcitool cc 00:10:60:A6:A2:D4
```

the connectiont start, from windows I see the connections, but I can't go to internet o to samba share...

here: http://www.cs.ucla.edu/~cclljj/interest/notes/bluez/pand_bridge_nap.html

I find this script for iptables...

```
#!/bin/sh

#CRITICAL: Enable IP forwarding since it is disabled by default.

#

echo "1" > /proc/sys/net/ipv4/ip_forward

###

### Enable rogue packet filtering on all interfaces

###

for f in /proc/sys/net/ipv4/conf/*/rp_filter ; do

echo 1 >> $f

#echo $f

done

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

iptables -A FORWARD -i pan0 -j ACCEPT

iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
```

but I'm not sure is correct solutin for me.. 

but my router is confiured whit this guide: 

http://www.gentoo.org/doc/en/home-router-howto.xml

and my internet connections is ADSL.

any idea?

----------

## the_mgt

Hi!

I started windows yesterday, it sees that there is a Bluetooth device, i can exchange keys, but it does not see any service on my linuxs bt-server! There should be at least the NAP, but this problem occured half a year ago, too. I don't know which side is the cause, but my linux2linux connection works beautiful.

A friend of mine started a GN (something similar to NAP, see the manpage or search the internet) under Suse and was able to connect to it with his win2k. Try to set up a GN and see if it helps you.

Greetz

----------

## Ciccio Bueo

yes... yes.. solved!!!   :Very Happy: 

the problem are the "standard driver" in wndows xp sp2, if I install the propritary driver (sitecom), the net work.

this is the HOW-TO: (whit cups-samba conf, but this service not work very well...)

Link:

Doc official Bluez:

http://bluez.sourceforge.net/contrib/HOWTO-PAN

Ho-to bridge Bluez:

http://www.cs.ucla.edu/~cclljj/interest/notes/bluez/pand_bridge_nap.html

DocGentoo Cups/Samba/Antivirus:

http://www.gentoo.org/doc/en/quick-samba-howto.xml

Doc Gentoo Home Router:

http://www.gentoo.org/doc/en/home-router-howto.xml

Shorewall for 3 interface:

http://www.shorewall.net/three-interface.htm

1) kernel:

 Networking options:

in " Networking support"  metttiamo bluetooth come modulo:

```
 <M> Bluetooth subsystem support  ---> 
```

```
<M> 802.1d Ethernet Bridging                                         │ │

  │ │<M> 802.1Q VLAN Support  

  │ │<*> WAN router 
```

Poi:

```
--- Bluetooth subsystem support                       │ │

  │ │               <M>   L2CAP protocol support                          │ │

  │ │               <M>   SCO links support                               │ │

  │ │               <M>   RFCOMM protocol support                         │ │

  │ │               [*]     RFCOMM TTY support                            │ │

  │ │               <M>   BNEP protocol support                           │ │

  │ │               [*]     Multicast filter support                      │ │

  │ │               [*]     Protocol filter support                       │ │

  │ │               <M>   HIDP protocol support        
```

e sotto  Bluetooth device drivers  --->  

```
<M> HCI USB driver                                       │ │

  │ │            [*]   SCO (voice) support                                │ │

  │ │            <M> HCI UART driver                                      │ │

  │ │            [*]   UART (H4) protocol support                         │ │

  │ │            [*]   BCSP protocol support                              │ │

  │ │            [*]     Transmit CRC with every BCSP packet              │ │

  │ │            <M> HCI BCM203x USB driver                               │ │

  │ │            <M> HCI BPA10x USB driver                                │ │

  │ │            <M> HCI BlueFRITZ! USB driver                            │ │

  │ │            <M> HCI VHCI (Virtual HCI device) driver         
```

(forse ho messo anche cose che non servono)

tornando a Networking support, andiamo sotto  Wan interfaces  ---> 

```
 [*] Wan interfaces support                                    │ │

  │ │       < >   Comtrol Hostess SV-11 support                           │ │

  │ │       < >   COSA/SRP sync serial boards support                     │ │

  │ │       < >   Etinc PCISYNC serial board support                      │ │

  │ │       < >   LanMedia Corp. SSI/V.35, T1/E1, HSSI, T3 boards         │ │

  │ │       < >   Sealevel Systems 4021 support                           │ │

  │ │       < >   SyncLink HDLC/SYNCPPP support                           │ │

  │ │       < >   Generic HDLC layer                                      │ │

  │ │       < >   Frame Relay DLCI support                                │ │

  │ │       [*]   WAN router drivers              

```

for samba-cups look the official gnetoo guide.

emerge:

Samba (whit stadard guide USE)

Cups

Foomatic

bluez-utils

bluez-libs

bluez-hcidump (to test the bluetooth)

bridge-utils

iptables

shorewall

2) bluetooth:

```
# cat /etc/conf.d/bluetooth | grep -ve "#"

HCID_ENABLE=true

HCID_CONFIG="/etc/bluetooth/hcid.conf"

SDPD_ENABLE=true

HIDD_ENABLE=false

HIDD_OPTIONS=""

HID2HCI_ENABLE=false

RFCOMM_ENABLE=true

RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"

DUND_ENABLE=false

DUND_OPTIONS="--listen --persist"

PAND_ENABLE=true

PAND_OPTIONS="--listen --role NAP --master --autozap --persist"

```

```
# cat /etc/bluetooth/hcid.conf | grep -ve "#"

options {

        autoinit yes;

        security auto;

        pairing multi;

        pin_helper /etc/bluetooth/pin-helper;

}

device {

        name "NAP Bluetooth at %h (%d)";

        class 0x3e0100;

        iscan enable; pscan enable;

        lm accept;

        lp rswitch,hold,sniff,park;

}

```

```
# cat /etc/bluetooth/rfcomm.conf | grep -ve "#"

rfcomm0 {

        bind yes;

        device 00:10:60:A6:A2:XX; (not important for NAP)

        channel 1;

        comment "Example Bluetooth device";

}

```

```
# cat /etc/bluetooth/pin

1234

```

 your pin... the same for all computer in the network

```
 # cat /etc/bluetooth/pin-helper

#!/bin/sh

echo -n "PIN:"

cat /etc/bluetooth/pin

```

--> chmod 0755

mkdir /etc/bluetooth/pan and inside the script dev-up necessary to create the bnep interface:

```
# cat /etc/bluetooth/pan/dev-up

#!/bin/sh

        brctl addif pan0 $1     # $1 is the new if name, passed by 'pand'

        ifconfig $1 0.0.0.0

```

--> chmod 0755

```
rc-update add bluetooth default

/etc/init.d/bluetooth start
```

```
 # hciconfig -a

hci0:   Type: USB

        BD Address: 00:10:60:A5:BD:11 ACL MTU: 192:8 SCO MTU: 64:8

        UP RUNNING PSCAN ISCAN

        RX bytes:30729 acl:297 sco:0 events:103 errors:0

        TX bytes:1842 acl:56 sco:0 commands:26 errors:0

        Features: 0xff 0xff 0x0f 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: 'NAP Bluetooth at homeserver (0)'

        Class: 0x3e0100

        Service Classes: Networking, Rendering, Capturing

        Device Class: Computer, Uncategorized

        HCI Ver: 1.1 (0x1) HCI Rev: 0x20d LMP Ver: 1.1 (0x1) LMP Subver: 0x20d

        Manufacturer: Cambridge Silicon Radio (10)

```

```
# hcitool dev

Devices:

        hci0    00:10:60:A5:BD:11

```

 ( che è la periferica sul server)

```
 # hcitool scan

Scanning ...

        00:10:60:A3:31:F2       MATTEO

        00:10:60:A6:A2:D4       ELISA

```

the client Elisa is a notebook whit windows xp sp2,  for create new bnep interface automatically yuo need this:

in /etc/init.d/ make net.pan0 whit this script:

```
 File: /etc/init.d/net.pan0

#!/sbin/runscript

# Copyright (c) 2004-2005 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header:  uberlord Exp $

#NB: Config is in /etc/conf.d/pan0

 depend () {

        need net

 }

 start() {

        ebegin "Starting Network Access Point Bluetooth"

        start-stop-daemon --start --quiet --exec /etc/conf.d/pan0

        eend $?

 }

 stop () {

```

The script call other scrit whit the bridge configuration , in /etc/conf.d/ named pan0:

```
#!/bin/bash

#creo il bridge:

brctl addbr pan0

#configuro l'indirizzo ip del bridge:

ifconfig pan0 10.10.1.1 broadcast 10.10.1.255 netmask 255.255.255.0

#configurazioni del bridge:

brctl setfd pan0 0

brctl stp pan0 off

```

---> chmod 0755

```
 

# rc-update add net.pan0 default

# /etc/init.d/net.pan0 start

```

ATTENTION: bnep not support dhcp, in windows machine you need to configure a static ip for the bluetooth lan device:

 ip: 10.10.1.2

subnetmask: 255.255.255.0

gateway: 10.10.1.1 (pan0) 

for the dns now I use the dns of my ISP.

From windows now try to find the NAP Gentoo... if work, you can start the connection whit acces point.

```
# ifconfig -a

bnep0     Link encap:Ethernet  HWaddr 00:10:60:A5:BD:11

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:100 errors:0 dropped:0 overruns:0 frame:0

          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:11973 (11.6 Kb)  TX bytes:79 (79.0 b)

eth0      Link encap:Ethernet  HWaddr 00:10:5A:F4:9E:1A

          inet addr:10.10.0.1  Bcast:10.10.0.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:282 errors:0 dropped:0 overruns:0 frame:0

          TX packets:76 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:26729 (26.1 Kb)  TX bytes:6036 (5.8 Kb)

          Interrupt:11 Base address:0xd400

eth1      Link encap:Ethernet  HWaddr 00:04:76:DC:72:A2

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:2848 errors:0 dropped:0 overruns:0 frame:0

          TX packets:2261 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:2664258 (2.5 Mb)  TX bytes:299038 (292.0 Kb)

          Interrupt:5 Base address:0xd800

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:69 errors:0 dropped:0 overruns:0 frame:0

          TX packets:69 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:8793 (8.5 Kb)  TX bytes:8793 (8.5 Kb)

pan0      Link encap:Ethernet  HWaddr 00:10:60:A5:BD:11

          inet addr:10.10.1.1  Bcast:10.10.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:193 errors:0 dropped:0 overruns:0 frame:0

          TX packets:82 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:20336 (19.8 Kb)  TX bytes:11689 (11.4 Kb)

ppp0      Link encap:Point-to-Point Protocol

          inet addr:82.58.220.XXX  P-t-P:192.168.100.1  Mask:255.255.255.255

          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1

          RX packets:2609 errors:0 dropped:0 overruns:0 frame:0

          TX packets:2022 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:3

          RX bytes:2591433 (2.4 Mb)  TX bytes:240154 (234.5 Kb)

```

check bridge:

```
# brctl show

bridge name     bridge id               STP enabled     interfaces

pan0            8000.001060a5bd11       no              bnep0

```

check connection:

```
# pand --show

bnep0 00:10:60:A6:A2:D4 NAP

```

now the firewall, I use shorewall:

```
 # cat /etc/shorewall/zones | grep -ve "#"

net     Net             Internet

lan     Lan             Local Wired Networks

pan     Pan             Bluetooth Networks
```

```
# cat /etc/shorewall/interfaces | grep -ve "#"

net     ppp0            detect          dhcp,routefilter,norfc1918

lan     eth0            detect          dhcp

pan     pan0            detect

```

```
# cat /etc/shorewall/policy | grep -ve "#"

lan             net             ACCEPT

fw              net             ACCEPT

pan             net             ACCEPT

net             all             DROP            info

all             all             REJECT          info

```

```
 # cat /etc/shorewall/shorewall.conf | grep -ve "#"

STARTUP_ENABLED=Yes

LOGFILE=/var/log/messages

LOGFORMAT="Shorewall:%s:%s:"

LOGTAGONLY=No

LOGRATE=10/minute

LOGBURST=5

LOGALLNEW=

BLACKLIST_LOGLEVEL=

LOGNEWNOTSYN=info

MACLIST_LOG_LEVEL=info

TCP_FLAGS_LOG_LEVEL=info

RFC1918_LOG_LEVEL=info

SMURF_LOG_LEVEL=info

BOGON_LOG_LEVEL=info

LOG_MARTIANS=No

IPTABLES=

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin

SHOREWALL_SHELL=/bin/sh

SUBSYSLOCK=/var/lock/subsys/shorewall

STATEDIR=/var/lib/shorewall

MODULESDIR=

CONFIG_PATH=/etc/shorewall:/usr/share/shorewall

RESTOREFILE=

FW=fw

IP_FORWARDING=On

ADD_IP_ALIASES=Yes

ADD_SNAT_ALIASES=No

RETAIN_ALIASES=No

TC_ENABLED=No

CLEAR_TC=Yes

MARK_IN_FORWARD_CHAIN=No

CLAMPMSS=yes

ROUTE_FILTER=No

DETECT_DNAT_IPADDRS=No

MUTEX_TIMEOUT=60

NEWNOTSYN=Yes

ADMINISABSENTMINDED=Yes

BLACKLISTNEWONLY=Yes

DELAYBLACKLISTLOAD=No

MODULE_SUFFIX=

DISABLE_IPV6=Yes

BRIDGING=No

DYNAMIC_ZONES=No

PKTTYPE=Yes

DROPINVALID=No

RFC1918_STRICT=No

MACLIST_TTL=

SAVE_IPSETS=No

BLACKLIST_DISPOSITION=DROP

MACLIST_DISPOSITION=REJECT

TCP_FLAGS_DISPOSITION=DROP

```

its all, for other details try to look here: 

https://forums.gentoo.org/viewtopic-t-368375.html

(is the originary italian post)

I'm very happy!!!   :Very Happy: 

now I have some problem whit samba/cups... but is another story...

 :Very Happy: 

----------

## the_mgt

Looks good! Maybe you like to post it on gentoo-wiki.org, too?

Send me a pm about your samba problem, maybe we can solve it, i am running cups/samba here, too.

----------

