Build a personal Bluetooth LAN in Linux

Source: Internet
Author: User
Set up a Personal Bluetooth LAN in Linux-Linux Enterprise Application-Linux server application information. The following is a detailed description. Using bluetooth to build a personal Wireless LAN is convenient, practical, and flexible.
First, install bluez-libs, bluez-utils, And the bnep module in the kernel.
1: Start Bluetooth hciconfig hci0 up piscan
2: modprobe bnep
* The preceding steps must be performed on both the host and client.

3: Run pand -- listen -- role NAP -- master on the host.
Run pand -- connect 00: 11: 67: 46: 4E: 4E -- role NAPU on the client.
4: When pand-l is used, you can see
Bnep0 00: 11: 67: 46: 4E: 4E PANU
The connection is successful.
5: Set ifconfig bnep0 10.10.106.1 on the host
Set ifconfig bnep0 10.10.106.2 on the client

Now, you can ping 10.10.106.2 to 10.10.106.1.

To share Internet access, you need to use iptable on the host.
Add a route to the client
Route add-net default gw 10.10.106.1

The following is my iptable script.
#! /Bin/bash
IPTABLES = '/usr/sbin/iptables'
# Set interface values
EXTIF = 'ppp0'
INTIF1 = 'bnep0'
# Enable ip forwarding in the kernel
/Bin/echo 1>/proc/sys/net/ipv4/ip_forward
# Flush rules and delete chains
$ IPTABLES-F
$ IPTABLES-X
# Enable masquerading to allow LAN internet access
$ IPTABLES-t nat-a postrouting-o $ EXTIF-j MASQUERADE
# Forward LAN traffic from $ INTIF1 to Internet interface $ EXTIF
$ IPTABLES-a forward-I $ INTIF1-o $ EXTIF-m state -- state NEW, ESTABLISHED-j ACCEPT
# Echo-e "-Allowing access to the SSH server"
$ IPTABLES-a input -- protocol tcp -- dport 22-j ACCEPT
# Echo-e "-Allowing access to the HTTP server"
$ IPTABLES-a input -- protocol tcp -- dport 80-j ACCEPT

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.