Dela med sig av bredbandet till mobilen via bluetooth.

Användarvisningsbild
Badmongoman
Inlägg: 21
Blev medlem: 08 apr 2007, 15:57
OS: Ubuntu
Utgåva: 18.04 Bionic Beaver LTS

Dela med sig av bredbandet till mobilen via bluetooth.

Inlägg av Badmongoman »

Jag vill använda min SE m600i för att surfa på datorn bredband det ska fungera med xp enligt. http://thinkabdul.com/2006/10/21/blueto ... 90i-m600i/
Men jag har inte lyckats lista ut hur man får det att fungera med Ubuntu.

Nån smart som kan hjälpa mig?
Jag vill ju bara vara ifred.
Användarvisningsbild
Badmongoman
Inlägg: 21
Blev medlem: 08 apr 2007, 15:57
OS: Ubuntu
Utgåva: 18.04 Bionic Beaver LTS

SV: Dela med sig av bredbandet till mobilen via bluetooth.

Inlägg av Badmongoman »

Fick denna från en lirare på ett annat forum. Den hjälpte mig avsevärt.

HOW TO: Share Internet Connection via Bluetooth in Ubuntu (7.10)
================================================================

So like every desperate M600i phone owner, you want the internet but can't come up with the cash for the data over 3G cause the operators are so bloody greedy. This guide explains how I setup my bluetooth internet at home, so hopefully it will help others as well.

Read section 1 if you want some background detail otherwise just skip to section 2 and 3 if you want the commands.

1. Concept
===========

One thing that I didnt find well explained in other was the concept of how this all works. Even if you don't know much about IP addresses or Bluetooth stacks, it helps to visualise how the data is transfered.

======== ======== =========
= = = = = =
= =  = =    = =
= M600i = --|  BT  |--- =  PC = ---|Modem|--- = Inet =
= =  |Dongle| = = = =
= = = = = =
========= ========= =========

Data travel direction is irrelvant, but for the purpose of the exercise lets take data going to the phone. For a normal PC to internet setup data coming from the internet goes through your modem to your PC. For this application the data still comes from the internet, to the modem then we want to "forward" it to the bluetooth connection to the phone. Forwarding is the key to getting this working. Once a connection has been requested, the dev-up script setups bnep0 connection, the sets it to forward all data. I won't go into anymore detail, just not worth it.

When the connection is finished the interface bnep0 is cleaned up by the linux interface daemon.

My configuration is as follows. Remember this is MY setup, if your IP addresses are different just substitute them in throughout this guide:

Modem IP Internal IP 192.168.0.1

PC (eth0): Static IP 192.168.0.201
Netmask 255.255.255.0
Gateway 192.168.0.1
DNS 192.168.0.1

PC (bnep0): Static IP 192.168.1.1
Netmask 255.255.255.0
Gateway Not defined
DNS Not defined

M600i: Static IP 192.168.1.2
Netmask 255.255.255.0
Gateway 192.168.1.1
DNS 192.168.0.1 (NOT A TYPO)

2. M600i Setup
==============

Create the Bluetooth Internet Connection Group

Control Panel -> Connections -> Internet Accounts -> More -> New Account -> Group Account
Call it BT Inet or something useful.

Create the Bluetooth Internet Connection

Control Panel -> Connections -> Internet Accounts -> More -> New Account -> Bluetooth Internet (PAN)

Set Account Name to something useful, i.e. BT Internet

Set IP as follows

More -> TCPIP -> IP config
Change Automatically to IPv4
Set IP Address to 192.168.1.2
Set Gateway to 192.168.1.1
Set Netmask to 255.255.255.0
Save

More -> TCPIP -> IP DNS Address
Chagen Automatically to IPv4
Set Primary DNS address to 192.168.0.1
(Optional) Set Secondary DNS address to your ISP DNS Server.

Add computer to device
Devices tab -> Add Device -> Select your computer address.
You may need to pair if this is the first time.

Save.  If it asks to add to a group say yes and add to group created at the beggining.

Done.

3. PC Setup
===========

Install the following programs with the following commands:

apt-get install bluetooth

apt get install bluez-utils

Edit /etc/bluetooth/hcid.conf:

sudo gedit /etc/bluetooth/hcid.conf

Change lm accept;
to lm accept, master;

Save and close.

Edit /etc/default/bluetooth

sudo gedit /etc/default/bluetooth

Change PAND_ENABLED=0
to PAND_ENABLED=1

Change PAND_OPTIONS=""
to PAND_OPTIONS="--listen --role=NAP --devup /etc/bluetooth/pan/dev-up"

Save and close.

Make dev-up script

sudo mkdir /etc/bluetooth/pan

sudo touch /etc/bluetooth/pan/dev-up

sudo chmod +x /etc/bluetooth/pan/dev-up

sudo gedit /etc/bluetooth/pan/dev-up

Add #!/bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward
ifup bnep0

Save and close.

Setup bnep0 IP address

sudo gedit /etc/network/interfaces

Add iface bnep0 inet static
          address 192.168.1.1
          netmask 255.255.255.0
 
post-up iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
post-up iptables -A FORWARD -i bnep0 -o eth0 -j ACCEPT
post-up iptables -A FORWARD -o bnep0 -i eth0 -j ACCEPT
post-up iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

Save and close.

Restart bluetooth

sudo /etc/init.d/bluetooth restart

If all works well, now open the web browser on the M600i and select BT Inet as the internet group. Watch the bnep0 config by:
watch -n 1 "ifconfig"

If bnep0 comes up and then after approx 2 secs obtains the 192.168.1.1 IP address you are in business. Any problems after that are usually IP forwarding or DNS related.


4. Special Thanks
=================
- Zdenek Bouresh from http://www.howtoforge.com/bluetooth_pand_debian_etch

This guide is pretty much on the money except I didn't want to run my computer as a DHCP server.

- Michael Schmidt from http://bluez.sourceforge.net/contrib/HOWTO-PAN

This guide is an excellent reference. The bible on Linux Bluetooth PAN.
Jag vill ju bara vara ifred.
Skriv svar

Återgå till "Använda X/K/Ubuntu - inaktuell"