MavEtJu's Distorted View of the World

FreeBSD laptop as a Wireless Access Point for an iPhone

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

ifconfig wlan0 destroy
ifconfig wlan0 create \
	wlandev ath0 \
	wlanmode hostap \
	bssid \
	authmode open \
	ssid "My iPhone WiFi"

ifconfig wlan0 up
ifconfig wlan0 inet netmask
sleep 1

sysctl -a net.inet.ip.forwarding=1

service isc-dhcpd restart


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: 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;

default-lease-time 150;
max-lease-time 300;

ddns-update-style none;


log-facility local7;

subnet netmask {
        option routers;


Everything is working now, your glass is full again! :-)

| Share on Facebook | Share on Twitter
From: Gábor Kövesdán
Posted on: 2011-01-13 15:28:38
CommentThis 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...
ReplyThe 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.

Leave a comment
Back to the main page