Affix - End User Manual: Affix (v. 3.0.0) - Open Source Bluetooth Protocol Stack for Linux | ||
---|---|---|
Prev | Chapter 4. Personal Area Network | Next |
Bridge is an networking equipment that delivers IP packets from an network to another. To connect your PAN and LAN via bridge follow the instructions below.
Edit Affix configuration file (/etc/affix/affix.conf). Check that PAN role "nap" is chosen. Comment other roles out. Check that "bridge" is selected as pan scheme (it is uncommented).
Restart PAN:
btpan stop btpan init nap
You need to restart PAN only this time. Next time you reboot your computer PAN is initialized automatically as NAP.
Edit /etc/network/interfaces file. First, let's set up the bridge configuration. Here you have two options. If your network connection is set up using DHCP add the following lines to the file. Replace eth0 with your network interface name.
Example 4-1. Bridge setup via DHCP
auto br0 iface br0 inet dhcp pre-up ifconfig eth0 down pre-up brctl addbr br0 pre-up brctl addif br0 eth0 pre-up ifconfig eth0 up post-down ifconfig eth0 down post-down brctl delif br0 eth0
In case you have static IP address add following lines to /etc/network/interfaces. Remember to replace tags below with your network information. Also if your network interface card uses some other interface than eth0 replace it too.
Example 4-2. Bridge setup statically
auto br0 iface br0 inet static address <your_ip_address> netmask <your_net_mask> network <your_network> broadcast <your_network_broadcast_address> gateway <your_default_gateway> pre-up ifconfig eth0 down pre-up brctl addbr br0 pre-up brctl addif br0 eth0 pre-up ifconfig eth0 up post-down ifconfig eth0 down post-down brctl delif br0 eth0
Eth0 is now included in your bridge configuration. We need to add an another interface there too. This will be your Bluetooth device's interface. It is probably pan0. Add the following lines to /etc/network/interfaces
It is recommended to install ifplugd (on Debian). It will automatically bring your Bluetooth interface up when you plug the Bluetooth dongle or PCMCIA card into your computer. After installing ifplugd edit /etc/default/ifplugd file. Add there line:
INTERFACES="pan0"
When you are setting your system up you need to bring bridge up manually . Give command:
ifup br0
Next time your computer is rebooted bridge is set up automatically. If you did not install ifplugd utility you have to bring up also Bluetooth device interface pan0 manually. Give command:
ifup pan0
Note! You do not need to enable IP forwarding or add rules to iptables when using bridge configuration. Next time when you will reboot the computer the bridge is set up automatically. You can now proceed setting the client computers (PANUs) up.