Problem was, after reading many Ubuntu forums and HOWTOs, trying out Firestarter many times (and I'm currently too lazy to learn to configure iptables myself manually), I was almost ready to give up, until I read up on ipmasq out of curiousity... You would need to use the terminal, so if you have an allergy to the terminal it'd be good to learn and overcome that first :)
If this was helpful to you, or if you have any questions, do leave a comment!
This HOWTO was done on the following:
- Ubuntu Jaunty 9.0.4 UNR (Ubuntu Netbook Release)
- Huawei E180 HSPA USB Modem
- Acer Aspire One A150
Here's what you do:
1) Install dnsmasq and ipmasq
Run the following command in terminal:
sudo apt-get install dnsmasq ipmasq -y
2) Disable dnsmasq from autostarting
In your terminal, type:
sudo gedit /etc/default/dnsmasq
Look for the line that states "ENABLED=1" and change it to "ENABLED=0"
3) Kill off dnsmasq daemon
We don't want dnsmasq to be running as a daemon here, since NetworkManager tries to start it for shared connections.
sudo killall dnsmasq
4) Enable wireless
You should know how to do this if it's not already on...
5) Configure wireless
- Left click network manager applet in the top panel.
- Select "Create new wireless network".
- Type in the network name and change your security settings as needed.
6) Check wireless config
- Right click network manager applet.
- Select "Edit Connections...".
- Go to the "Wireless" tab.
- Select your ad-hoc network and click on "Edit".
- Go to "IPv4 Settings" tab
- The method should be "Shared to other computers"
7) Configure ipmasq
In terminal, type:
sudo dpkg-reconfigure ipmasq
- Should PPP connections recompute the firewall? Yes
- Just press Ok
- When should ipmasq be started? After network interfaces are brought up
8) Connect internet facing modem connection if not already done so
For me I just select my service provider and Ubuntu "dials up" to connect
9) Run ipmasq to configure iptables
iptables configs does the actual routing, ipmasq helps configure iptables PAINLESSLY :)
From terminal, type:
10) Get ipmasq to run whenever a network interface goes up or down
iptables configurations are not persistent, so I use ipmasq to autoconfig for me everytime a network interface goes up. Note that you can also use other methods to persist iptables. NetworkManager fires off scripts in /etc/network/if-up.d whenever an interface goes up, so let's tell it to run ipmasq too.
In terminal, type these commands:
cd /etc/network/if-up.dCopy and paste the following into the editor, save and exit.
sudo gedit config-iptables
#! /bin/shThen in terminal again, make the script executable:
sudo chmod +x config-iptablesYou will want ipmasq to autoconfig again when a network interface goes down, so run the following in terminal:
sudo cp config-iptables /etc/network/if-post-down.d
11) Connect client, start surfing :)
You're done! Now just get another wifi client to join in the ad-hoc network, and after it gets an IP automatically we should be good to go!