Sharing an internet connection obtained by tethering a 3G phone to everyone within WLAN range - somewhat complicated.
posted to #linux 10.07.2010 (en)
Sharing an internet connection obtained by tethering a 3G phone to everyone within WLAN range - somewhat complicated.
Starting with the need to bridge the connections gained via bluetooth and wlan, the kernel needs iptables to masquerade and forward packets. Linpus default kernel doesn't have the iptables module and the proprietary drivers make compiling a new kernel difficult. So off to look at other distros..
http://www.howtoforge.com/internet-co...
I can connect to the network via bluetooth just fine in Linpus, after installing bluetooth drivers and the gnome-ppp dialer. With a helper script, even finding out and setting the right bluetooth communication channel in /etc/bluetooth/rfcomm.conf is easy.
http://arcadia.anime.fi/~n/aspireone/...
Made a bootable Fedora 10 USB stick with persistent storage. That means that not only can I run the computer from the stick, any changes I make or additional programs I install stay on the stick.
https://fedorahosted.org/liveusb-crea...
Could connect to the net in Fedora with wvdial, after fixing a bug that prevented DNS from working ( /etc/resolf.conf wasn't updated ):
http://beaveryoga.wordpress.com/2009/...
Fedora 10 didn't have a new enough kernel version (2.6.31 or better) for setting the Atheros WLAN chip into master mode with hostapd. Time to try the next distro.
http://soad1982.blogspot.com/2010/04/...
Made a bootable Ubuntu Lucid Lynx 10.04 USB stick with Unetbootin. It has a fresh enough kernel for hostapd, but no persistent storage. Using one directory on the laptop's ssd drive for quick setup scripts.
http://unetbootin.sourceforge.net/
By creating a few ppp files in Ubuntu, could connect to the net via bluetooth with pon (and disconnect with poff).
http://www.spiration.co.uk/post/1307/...
For the forwarding firewall, this seems like a promising candidate to quickly generate the proper settings:
http://easyfwgen.morizot.net/gen/
Also, a nice graph on iptables "moving parts":
http://www.billauer.co.il/ipmasq-html...
Learned a few things:
Bridging the connections is not an option when network is provided over a ppp connection, since it can't offer many ip addresses. Nat is the viable option then.
Fedora 13 has a new enough kernel and pre-compiled hostapd to use Atheros in master mode.
New networkmanagers in Fedora and Ubuntu are smart enough to do the forwarding / natting automatically via GUI tools, as long as the interfaces have been brought online.
Success!!
1. Boot laptop with Fedora 13 usb stick ( https://fedorahosted.org/liveusb-crea... )
2. Tether the phone's 3G connection. Cable is preferred, less hassle than bluetooth and you need to charge it anyway because of the 3G power drain. Connect cable, select wide area network from networkmanager
3. Create a new wireless network with Network manager. The rest is done automatically (dhcp server, nat forwarding).
4. Use other wlan-capable devices to connect to your new network
This will create an ad-hoc wlan that's routed to the existing ppp network connection.
Some relevant links and info:
http://swiss.ubuntuforums.org/showthr...
http://wiki.archlinux.org/index.php/S...
/etc/hostapd/hostapd.conf:
ctrl_interface=/var/run/hostapd
ctrl_interface_group=wheel
# Some usable default settings...
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
# Most modern wireless drivers in the kernel need driver=nl80211
driver=nl80211
# Customize these for your local configuration...
interface=wlan0
hw_mode=g
channel=2
ssid=FreePKWlan
Copyright Rohea Oy 2010 | Mobile version | Feedback | API | Terms of Service | Applications and tools