반응형
Bluetooth dongle은 class I, class II, class III 로 분류가 된다. Class I은 100 meter까지 send/receive 가 가능한 장치가 되고, class II는 10 meter까지, class III는 1 meter까지 가능하다. 대부분 laptop과 PDA에는 class II 장치 들이 들어가 있다.

1. Bluetooth 관련 package 설치
 pacman -S bluz-libs bluez-utils iptables ppp (BlueZ Bluetooth 설치)
 -- BlueZ는 http://www.bluez.org/ 에서 볼수 있다. 이 경우 pacman이라는 Arch linux용 package manager가 된다.
 /etc/bluetooth/pin 파일을 수정하고 숫자를 넣는다. (기본적으로 BlueZ로 되어 있으나 어떤 장치들은 숫자 PIN으로만 동작 할수도 있다.)
 /etc/bluetooth/rfcomm.conf 파일을 수정하고..(다음은 예제이다.)

rfcomm0 {
        # Automatically bind the device at startup
        bind yes;     # original: bind yes

        # Bluetooth address of the device
        # device 11:22:33:44:55:66
        # comment out the devices' MAC addresses

        # RFCOMM channel for the connection
        channel 3; # was channel 1

        # Description of the connection
        comment "Bluetooth Access Point";
}

 /etc/bluetooth/hcid.conf 를 수정한다.( 옵션이지만 유용하다.)

 name "%d h%" ---> name "BlueZ"

그리고 /etc/ppp/options 를 수정하는데, "auth"를 "noauth"로 수정하고 (약 25-30라인쯤) 15-20라인쯤에 DNS 정보를 추가한다. (다음은 예시이다.)

ms-dns 216.148.227.62
ms-dns 204.127.202.2
(잘 모르겠으면 /etc/resolv.conf의 IP address를 복사하면 됨)

2. The Access Point service
다음은 실제 서비스를 시작할때 필요하다.

/etc/rc.d/bluetooth start
/etc/rc.d/bluetooth stop

(bluetooth를 시작하고 정지 해야 된다..아마 다른 initializing factor가 존재하기 때문인듯)
그리고 다음의 script를 수행한다.

modprobe rfcomm
modprobe hci_usb

mknod /dev/rfcomm0 c 216 0
mknod /dev/rfcomm1 c 216 1
mknod /dev/rfcomm2 c 216 2
mknod /dev/rfcomm3 c 216 3

hciconfig hci0 up
hcid
sdptool add SP
sdpd
rfcomm bind all
# first IP address is the one of the server,
# second the one of the client; change accordingly, depending on your network
dund --listen --msdun --channel 3 10.0.0.102:10.0.0.111
echo '1' > /proc/sys/net/ipv4/ip_forward
# use a different eth0 name if your server's incoming
#internet connection is coming from a different device
#(e.g. might be sit0 or ppp1, depending how your Arch Linux is connected to the outside world).
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i ppp0 -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

하나의 btlan.sh라는 script로 만들어서 실행 권한을 주고
chmod +x btlan.sh

이걸  /usr/sbin/ 에 놓음
이걸 실행 시키면 된다~

3. 클라이언트에서 접속
bluetooth services를 시작하고 (/etc/rc.d/bluetooth start 또는 /etc/rc.d/init.d/bluetooth start) 다음과 같은 작업을 한다
hcitool scan
# the above will give you something like:
#       00:11:22:33:44:55       BlueZ

modprobe bnep

# use the number found above
pand -c 00:11:22:33:44:55

# this is the IP address of your Linux client, change accordingly
ifconfig bnep0 10.0.0.111 netmask 255.255.255.0

# this is the address of your Arch Access Point server, change accordingly
route add default gw 10.0.0.102

ifconfig bnep0 up


[출처는 http://www.osnews.com/story.php/9836/Make-your-Arch-Linux-a-Bluetooth-Access-Point/page1/ 이고 몇몇 내용은 추가하였습니다]
반응형
Posted by alias
,