Avoid untrusted Wi-Fi APs. Creating a Wi-Fi Access Point in Ubuntu.

3G is too slow for what you need to do with your smartphone?
You don't trust the Wi-Fi access points of your location?
However, you have a trusted Linux Ubuntu box with a somehow trusted Ethernet (cable-based) connection to the Internet (and a Wi-Fi card)?

Then this is the summary of the steps you need to follow to be able to use the Linux Ubuntu box as wireless Access Point.

The command lines to implement it are the following:

1. Installing hostapd:
# apt-get install hostapd
# nano /etc/hostapd/hostapd-minimal.conf
Dan Bishop's provides an example of hostapd config file. 

2. Installing bridge-utils:
# apt-get install bridge-utils
Dan Bishop's provides an example of config file.
Edit your /etc/network/interfaces config file according to Dan Bishop's reference. It will probably look similar to this:

auto lo
iface lo inet loopback
auto br0
iface br0 inet static
        address yourlanaddress
        netmask yourlannetmask
        network yourlannetwork.0
        broadcast yourbroadcast.255
        gateway yourlangateway
        bridge-ports eth0 wlan0

3. Disable the NetworkManager app by editing the config file and changing managed=true to =false

#gedit /etc/NetworkManager/NetworkManager.conf

4. Stop the NetworkManager service
#service network-manager stop

5. Re-start networking (although it is an outdated way):
# /etc/init.d/networking restart

6. Enabling Internet from the bridging box:
# ip route add default via ipaddressofyourcablerouter
# dhclient br0
More info on this on the Ubuntu documentation.

If you would like to configure the way the dhclient works, make the corresponding changes in the /etc/dhcp/dhcient.conf config file.

7. Start hostapd (-dd is the verbose switch):
# hostapd -dd /etc/hostapd-minimal.conf

Finally, if you need to revert back to the previous state:

Option 1 (clear-cut one):
Retrieve the old /etc/network/interfaces config file and uninstall hostapd and bridge-utils.
#apt-get install purge hostapd
#apt-get install purge bridge-utils

Use purge if you would like to delete also the config files. Otherwise simply use apt-get remove.

These are the 2 references used to write this post:
 - Dan Bishop's using hostapd to add wireless access point capabilities in Ubuntu
covers hostapd.
- Ubuntu documentation on NetworkConnectionBridge covers the installation of bridge-utils and how to enable Internet on the bridging box.

This last reference from Ubuntu manpages on bridge-utils provides background information on bridge-utils.

Option 2 (keeping hostapd and bridge-utils):
Retrieve the old /etc/network/interfaces config file or comment out the lines related to the bridge (normally br0) and add (or uncomment) the loopback section (actually, the only one required in that file as you are going to resume using NetworkManager).
auto lo
iface lo inet loopback

The first two lines above are required so that NetworkManager starts at boot time (as mentioned here).

And edit back the NetworkManager app by editing the config file and changing managed=true (it was = false for hostapd and briedge-utils to work)
#gedit /etc/NetworkManager/NetworkManager.conf

Finally, restart the network and the NetworkManager service (to avoid a reboot this time)

#/etc/init.d/networking restart
#service network-manager restart

... and double-check that /etc/rc.local is OK for this scenario in terms of services started or not started
(in this case, the little app bum, boot-up manager, could come in handy)

By the way, if you get the message "unable to resolve host: your host name", make sure that your host name appears in the files /etc/hostname and also in /etc/hosts.

Finally, if you would like to check that both machines, your computer and your mobile, are now part of the same lan, a very easy way to do it is:
#nmap -sP ip.address.of.your.lan.0/24

Happy browsing!

Surfing the sky!