Posted on 2011-01-12 18:00:00
Tags: FreeBSD, 3G, Networking, Free Internet, iPhone
Recently I was on a holiday where the provider of my iPhone had no signal, but where the provider of my 3G modem for the laptop did have a signal. At least my glass was half-full!
In the past I have tried to setup Bluetooth between my laptop and my iPhone, and that resulted in a night of hard work and no effort. This time I tried a different approach: Instead of using Bluetooth for communication, I transformed the FreeBSD laptop into a wireless access point.
The command to change the wireless card from a normal client to a wireless access point are:
[~] edwin@lappie>cat wlan-iphone #!/bin/sh ifconfig wlan0 destroy ifconfig wlan0 create \ wlandev ath0 \ wlanmode hostap \ bssid \ authmode open \ ssid "My iPhone WiFi" ifconfig wlan0 up ifconfig wlan0 inet 10.0.0.1 netmask 255.255.255.0 sleep 1 sysctl -a net.inet.ip.forwarding=1 service isc-dhcpd restart
Notes:
The 3G connection is setup via ppp(8) and to enable NAT on the outgoing packets, you need to enter the following command or add it to the right label in your ppp.conf:
ppp ON lappie> dial Ppp ON lappie> PPp ON lappie> PPp ON lappie> Warning: 0.0.0.0/0: Change route failed: errno: No such process PPP ON lappie> nat enable yes PPP ON lappie>
And to make sure that the connected clients get their IP address, you should run the ISC DHCP server with for example the following configuration:
option domain-name ""; option domain-name-servers 8.8.8.8; default-lease-time 150; max-lease-time 300; ddns-update-style none; authoritative; log-facility local7; subnet 10.0.0.0 netmask 255.255.255.0 { range 10.0.0.10 10.0.0.99; option routers 10.0.0.1; }
Notes:
Everything is working now, your glass is full again! :-)
| Share on Facebook | Share on TwitterFrom: | G�bor K�vesd�n |
URL: | |
Posted on: | 2011-01-13 15:28:38 |
Comment | This is a good description but it raises a question: why do you need connection on your iPhone if you have connection on your laptop? I.e. what is that you can do with your iPhone but not with your laptop? Just for curiosity... |
Reply | The laptop is running FreeBSD only and it is mine. The iPhone is shared across the family, who play Smurfs, Word with Friends, waste time on Facebook and Twitter, have the online subscriptions to newspapers on it etc. |