Computer >> Hướng Dẫn Máy Tính >  >> Điện Thoại Thông Minh >> Linux

Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux

Đôi khi mang laptop đi nơi không WiFi mở. May có Nokia N95 và adapter Bluetooth. Tôi hướng dẫn tether N95 đến laptop qua Bluetooth: cách dòng lệnh nhanh và cách GUI đẹp. Ví dụ dùng Fedora 9 và Gnome.

Lưu ý: Hướng dẫn xuất bản 2008, phần mềm tham chiếu có thể đã thay đổi.

Cảnh báo: Chỉ làm nếu có gói dữ liệu tốt. Dùng 3G có thể tốn rất lớn!

  1. Đầu tiên ghép cặp (pair) N95 với laptop. Dễ hơn nghĩ. Chỉ cần cài gói gnome-bluetooth, khởi động ghép cặp từ điện thoại, nhập cùng passkey trên cả hai khi nhắc. Cũng cần gói ppp và wvdial. Nếu chưa có, chạy root terminal: yum install ppp wvdial (hoặc trình quản lý gói distro khác).
  2. Sau khi ghép cặp xong, mở terminal chạy hcitool scan tìm địa chỉ MAC Bluetooth điện thoại. Phần này áp dụng cho cả dòng lệnh và GUI.

    [user@radon ~]$ hcitool scan
    Scanning …
    00:22:66:9F:83:37 N95

  3. Dùng sdptool tìm kênh dịch vụ Dial-Up Networking.

    [user@radon ~]$ sdptool browse 00:22:66:9F:83:37
    Browsing 00:22:66:9F:83:37 …
    Service Name: Dial-Up Networking
    Service RecHandle: 0x1004a
    Service Class ID List:
    "Dialup Networking" (0x1103)
    Protocol Descriptor List:
    "L2CAP" (0x0100)
    "RFCOMM" (0x0003)
    Channel: 2
    Language Base Attr List:
    code_ISO639: 0x454e
    encoding: 0x6a
    base_offset: 0x100
    Profile Descriptor List:
    "Dialup Networking" (0x1103)
    Version: 0x0100

  4. Có vài màn hình output. Chỉ lấy phần liên quan. Dịch vụ Dial-Up Networking ở kênh 2.
  5. Dùng trình soạn thảo (root) sửa /etc/bluetooth/rfcomm.conf thành dạng sau, thay địa chỉ MAC và kênh điện thoại.
  6. #
    # RFCOMM configuration file.
    #

    rfcomm0 {
    bind yes;
    device 00:22:66:9F:83:37;
    channel 2;
    }

  7. Lưu rfcomm.conf thoát trình soạn thảo.
  8. Khởi động lại dịch vụ bluetooth (root):

    [root@radon ~]# service Bluetooth restart
    Stopping Bluetooth services: [ OK ]
    Starting Bluetooth services: [ OK ]

  9. Đã tạo cổng serial Bluetooth tại /dev/rfcomm0 bền vững qua reboot. Đây là cổng "modem" dùng cho cấu hình tiếp theo.

Chuyển sang cách dòng lệnh nhanh. Có thể bỏ qua sang GUI dưới.

Cách dòng lệnh
Cách GUI


Cách dòng lệnh

  1. Sửa /etc/wvdial.conf thành:
  2. Modem = /dev/rfcomm0
    Baud = 460800
    SetVolume = 0
    Dial Command = ATDT
    Init1 = ATZ
    Init3 = ATM0
    FlowControl = CRTSCTS

    [Dialer Bluetooth]
    Username = user
    Password = pass
    Phone = *99***1#
    Stupid Mode = 1
    Init1 = ATZ
    Inherits = Modem0

  3. Tôi dùng Rogers Wireless (Canada), cấu hình tối thiểu trên hoạt động. Username = user, Password = pass đúng vậy. Có thể cần sửa Username, Password, Phone. Liên hệ nhà cung cấp.
  4. Tạo script /etc/ppp/ip-up.local cho DNS tự động:
  5. #!/bin/bash
    #

    PATH=/sbin:/usr/sbin:/bin:/usr/bin
    export PATH
    echo "# created by pppd" > /etc/resolv.conf
    echo "nameserver ${DNS1}" >> /etc/resolv.conf
    echo "nameserver ${DNS2}" >> /etc/resolv.conf
    chmod go+r /etc/resolv.conf

    Nhớ chmod 755 /etc/ppp/ip-up.local

  6. Kết nối phải dùng root.

    [root@radon ~]# wvdial Bluetooth
    --> WvDial: Internet dialer version 1.60
    --> Cannot get information for serial port.
    --> Initializing modem.
    --> Sending: ATZ
    ATZ
    OK

    --> Sending: ATM0
    ATM0
    OK
    --> Modem initialized.
    --> Sending: ATDT*99***1#
    --> Waiting for carrier.
    ATDT*99***1#
    CONNECT
    ~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
    --> Carrier detected. Starting PPP immediately.
    --> Starting pppd at Sun Oct 19 16:48:56 2008
    --> Pid of pppd: 8028
    --> Using interface ppp0
    --> local IP address 172.28.53.106
    --> remote IP address 10.6.6.6
    --> primary DNS address 207.181.101.4
    --> secondary DNS address 207.181.101.5

  7. Đã bỏ dòng ký tự không in. wvdial chạy foreground để ngắt bằng Ctrl-C.
  8. Kiểm tra online: terminal khác chạy ifconfig.

    [root@radon ~]# ifconfig
    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:12767 errors:0 dropped:0 overruns:0 frame:0
    TX packets:12767 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:714652 (697.9 KiB) TX bytes:714652 (697.9 KiB)

    ppp0 Link encap:Point-to-Point Protocol
    inet addr:172.28.53.106 P-t-P:10.6.6.6 Mask:255.255.255.255
    UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
    RX packets:4 errors:0 dropped:0 overruns:0 frame:0
    TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:3
    RX bytes:64 (64.0 b) TX bytes:94 (94.0 b)

    [root@radon ~]# ping simplehelp.net
    PING simplehelp.net (74.52.95.42) 56(84) bytes of data.
    64 bytes from 2a.5f.344a.static.theplanet.com (74.52.95.42): icmp_seq=1 ttl=46 time=110 ms
    64 bytes from 2a.5f.344a.static.theplanet.com (74.52.95.42): icmp_seq=2 ttl=46 time=102 ms
    64 bytes from 2a.5f.344a.static.theplanet.com (74.52.95.42): icmp_seq=3 ttl=46 time=164 ms
    64 bytes from 2a.5f.344a.static.theplanet.com (74.52.95.42): icmp_seq=4 ttl=46 time=130 ms
    64 bytes from 2a.5f.344a.static.theplanet.com (74.52.95.42): icmp_seq=5 ttl=46 time=149 ms
    ^C
    --- simplehelp.net ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 4513ms
    rtt min/avg/max/mdev = 102.061/131.349/164.376/23.190 ms

  9. Khi xong, quay lại terminal wvdial nhấn Ctrl-C.

    ^CCaught signal 2: Attempting to exit gracefully...
    --> Terminating on signal 15
    --> Connect time 5.8 minutes.
    --> Disconnecting at Sun Oct 19 16:54:48 2008


Cách GUI

Nếu dòng lệnh u ám, đây là cách GUI Gnome:

  1. Nhấp System -> Administration -> Network
  2. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux

  3. Nhập mật khẩu root, OK.
  4. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux

  5. Xem danh sách thiết bị mạng. Nhấp tab Hardware.
  6. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux
    Nhấp để phóng to

    Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux

  7. Nhấp New, chọn Modem, OK.
  8. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux

  9. Đổi Modem Device thành /dev/rfcomm0. Nếu không có, gõ thủ công. OK.
  10. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux

  11. Nhấp tab Devices.
  12. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux
    Nhấp để phóng to

    Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux
    Nhấp để phóng to

  13. Nhấp New, chọn Modem connection, Forward.
  14. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux
    Nhấp để phóng to

  15. Nhập *99***1# Phone Number, user Login Name, pass Password. Đặt tên kết nối Bluetooth. Forward.
  16. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux
    Nhấp để phóng to

  17. Giữ mặc định. Forward.
  18. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux
    Nhấp để phóng to

  19. Hoàn tất. Apply.
  20. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux
    Nhấp để phóng to

  21. Đóng cửa sổ (X góc trên phải).
  22. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux
    Nhấp để phóng to

  23. Nhấp Yes lưu thay đổi.
  24. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux

  25. Nhấp OK. Không cần reboot.
  26. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux
    Nhấp để phóng to

  27. Dùng kết nối mới: System -> Administration -> Network Device Control.
  28. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux

  29. Chọn kết nối Bluetooth, nhấp Activate.
  30. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux
    Nhấp để phóng to

    Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux

  31. Kết nối Bluetooth chuyển Inactive -> Active.
  32. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux
    Nhấp để phóng to

  33. Mở Firefox truy cập https://www.simplehelp.net.
  34. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux
    Nhấp để phóng to

  35. Khi xong, quay lại Network Device Control, chọn Active Bluetooth, nhấp Deactivate.
  36. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux
    Nhấp để phóng to

    Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux

  37. Xác nhận Bluetooth Inactive, đóng Network Device Control.
  38. Chia sẻ kết nối Internet Nokia N95 đến laptop qua Bluetooth trên Linux
    Nhấp để phóng to

  39. Tại sao không dùng Network Manager? Hỗ trợ mobile broadband lúc đó non nửa, gần như không dùng được. Khi tốt hơn, tôi sẽ viết lại dựa trên nó.