Editing Bluetooth PAN

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 78: Line 78:
/etc/udev/bluenet.sh press R and paste that code:
/etc/udev/bluenet.sh press R and paste that code:
  #!/bin/sh
  #!/bin/sh
-
if [ $ACTION = "add" ]; then  
+
if [ $ACTION = "add" ]; then  
-
# by 9000 @ talk.maemo.org
+
# by 9000 @ talk.maemo.org
-
# Prompt you to select the Internet connection. You may choose gprs or wifi
+
# Prompt you to select the Internet connection. You may choose gprs or wifi
-
run-standalone.sh dbus-send --system --type=method_call --dest=com.nokia.icd_ui /com/nokia/icd_ui com.nokia.icd_u
+
run-standalone.sh dbus-send --system --type=method_call --dest=com.nokia.icd_ui /com/nokia/icd_ui com.nokia.icd_u
-
# Selecting and establishing connection takes time
+
# Selecting and establishing connection takes time
-
sleep 2
+
sleep 2
-
# Verbose mode. You can remove it when you're using widget to activate this script
+
# Verbose mode. You can remove it when you're using widget to activate this script
-
set -x
+
-
IP_ADDR="192.168.3.1"
+
-
NETMASK="255.255.255.0"
+
-
DHCP_RANGE="192.168.3.60,192.168.3.70"
+
-
RUNFILE="/var/run/btpan_tethering.pid"
+
-
DNSMASQ="/usr/sbin/dnsmasq"
+
-
# Load modules
+
-
modprobe ipt_MASQUERADE
+
-
# flush old rules
+
-
iptables -F
+
-
iptables -t nat -F
+
-
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
+
-
# forward IPs
+
-
echo 1 > /proc/sys/net/ipv4/ip_forward
+
-
# Setup bnep0
+
-
ifconfig bnep0 down
+
-
ifconfig bnep0 up
+
-
ifconfig bnep0 $IP_ADDR netmask $NETMASK up
+
-
# Setup DNS and DHCP
+
-
start-stop-daemon -S -p $RUNFILE -m -b -x $DNSMASQ -- -k -I lo -z -a $IP_ADDR -F $DHCP_RANGE -b
+
-
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:'Bluetooth PAN Activated'
+
-
fi
+
-
press esc, then :w to save file and :q to quit
+
set -x
-
set ''/etc/udev/bluenet.sh'' as executible:
+
IP_ADDR="192.168.3.1"
 +
NETMASK="255.255.255.0"
 +
DHCP_RANGE="192.168.3.60,192.168.3.70"
 +
RUNFILE="/var/run/btpan_tethering.pid"
 +
DNSMASQ="/usr/sbin/dnsmasq"
 +
 
 +
# Load modules
 +
modprobe ipt_MASQUERADE
 +
 
 +
# flush old rules
 +
iptables -F
 +
iptables -t nat -F
 +
 
 +
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
 +
 
 +
# forward IPs
 +
echo 1 > /proc/sys/net/ipv4/ip_forward
 +
 
 +
# Setup bnep0
 +
ifconfig bnep0 down
 +
ifconfig bnep0 up
 +
ifconfig bnep0 $IP_ADDR netmask $NETMASK up
 +
 
 +
# Setup DNS and DHCP
 +
start-stop-daemon -S -p $RUNFILE -m -b -x $DNSMASQ -- -k -I lo -z -a $IP_ADDR -F $DHCP_RANGE -b
 +
 
 +
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:'Bluetooth PAN Activated'
 +
fi
 +
 
 +
Press :w to save file and :q to quit
 +
 
 +
then set ''/etc/udev/bluenet.sh'' as executible:
  chmod +x /etc/udev/bluenet.sh
  chmod +x /etc/udev/bluenet.sh
-
cd /etc/udev/rules.d/  
+
then cd /etc/udev/rules.d/  
command vi 98-bnep0.rules and press R
command vi 98-bnep0.rules and press R
-
/etc/udev/rules.d/98-bnep0.rules copy that txt and paste it, esc and Save it with command :w quit vi editor :q :
+
/etc/udev/rules.d/98-bnep0.rules copy that txt and paste it Save :W quit vi editor :q :
  ACTION=="add", SUBSYSTEM=="net",  KERNEL=="bnep0", RUN+="/etc/udev/bluenet.sh"
  ACTION=="add", SUBSYSTEM=="net",  KERNEL=="bnep0", RUN+="/etc/udev/bluenet.sh"

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)