Keep in mind to use this you will have to compromise sing the ethernet port for network access while running this if you choose to run the DHCP server on Intel Galileo or Pi instead of a laptop.
- Prerequisites: An ethernet controller and bluetooth module (The Pi 3 has both built-in)
- On Any Debian Based System To Run The Bluetooth-Etheret Bridging (aka an Intel Galileo or Pi)
sudo apt-get install bluetooth dbus bluez bluez-utils bridge-utils python-bluez python-dbus
- For whatver device you want running the DHCP server (could be the Pi or a computer)
sudo apt-get install isc-dhcp-server bind9
- Now, you will need Webmin on whatever device is running the DHCP server, so that it may take care of ip-table rules for you.
- Be sure to download the Debian package
- http://www.webmin.com/
- Once downloaded run:
sudo dpkg -i "whatever the name of the deb file downloaded was + its extension"
#in the directory that the deb file was downloaded in
#for instance, cd ~/Downloads if your Downloads folder is Downloads before running this command
Run this command
ifconfig
If you see something other than eth0 in the list like enp something, do the steps in the box below and afterwards the steps below the box. Otherwise, just do the steps below the box.
Note down the Hardware address for the enp something device. It should be the string with colons to the right of Hwaddr
Now run
sudo nano /etc/udev/rules.d/70-persistent-net.rulesSUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="<the hardware address you noted down from ifconfig>", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"Hit Control-X and then save the file by following nano's instructions. Probably just have to hit enter.
sudo reboot
Type this command in Terminal
sudo nano /etc/network/interfaces
Copy this into the file and delete everything else.
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 10.10.10.1
netmask 255.255.255.0
Hit Control-X and then save the file by following nano's instructions. Probably just have to hit enter.
Type this command in Terminal
sudo service networking restart
Type in the terminal
sudo nano /etc/dhcp/dhcpd.conf
Now delete everything in the file and insert this
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
option subnet-mask 255.255.255.0;
option broadcast-address 10.10.10.255;
option routers 10.10.10.1;
option domain-name-servers 10.10.10.1;
option domain-name "ubuntu.firewall";
subnet 10.10.10.0 netmask 255.255.255.0 {
range 10.10.10.2 10.10.10.200;
}
Hit Control-X and then save the file by following nano's instructions. Probably just have to hit enter.
Now run in the Terminal
sudo service isc-dhcp-server restart
sudo nano /etc/sysctl.conf
Uncomment the line (delete the #) for net.ipv4.ip_forward=1
Hit Control-X and then save the file by following nano's instructions. Probably just have to hit enter.
Now login to webmin. Either use your web browser to go to localhost:10000 if you are on a laptop and go to "whatever hostname".local:10000 if you are accessing a device remotely on a local network.
Use your computer username and password to login
Now follow these steps to enable NAT as the picture illustrates
To save iptable settings, follow this image
Now run in Terminal
sudo service networking restart
On the bluetooth bridging device (probably an Intel Galileo or Pi), run this command
ifconfig
If you see something other than eth0 in the list like enp something, do the steps in the box below and afterwards the steps below the box. Otherwise, just do the steps below the box.
Note down the Hardware address for the enp something device. It should be the string with colons to the right of Hwaddr
Now run
sudo nano /etc/udev/rules.d/70-persistent-net.rulesSUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="<the hardware address you noted down from ifconfig>", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"Hit Control-X and then save the file by following nano's instructions. Probably just have to hit enter.
sudo reboot
Now run
sudo nano /etc/network/interfaces
Add the following to the end of the file
auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_fd 5
bridge_stp yes
Hit Control-X and then save the file by following nano's instructions. Probably just have to hit enter.
Type this command in Terminal
sudo service networking restart
Now run
ifconfig
And make sure you see a device named br0 among the things printed
Now run,
brctl show
And make sure br0 is listed there
Now type the following command and follow the instructions to enable ip_forwarding
sudo nano /etc/sysctl.conf
Uncomment the line (delete the #) for net.ipv4.ip_forward=1
Hit Control-X and then save the file by following nano's instructions. Probably just have to hit enter.
Now run the bluetooth client on the bridging device.
bluetoothctl
Now, run
scan on
For each device seen, copy the hardware address that pops up associated to the device you want to pair
pair <hardware address copied>
Now after it has said paired successful
trust <hardware address copied>
Once done pairing devices, type
exit
Now cd into the directory that has the test-nap script that came with this repo.
Now run the command below if using the script for the first time
sudo chmod 755 test-nap
And now you can run
./test-nap br0
Congratulations! You can now bridge ethernet through bluetooth! :)
0.0.1
Copyright Babu
Uses Bluez, DBus, Webmin, and DHCP Server
For Bluetooth Ethernet Bridge: http://www.hkepc.com/forum/viewthread.php?tid=1710030
For DHCP Server: https://rbgeek.wordpress.com/2012/05/14/ubuntu-as-a-firewallgateway-router/