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:
sudo ipmasq
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:
/usr/sbin/ipmasq
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!
8 comments:
Thanks for your howto, saved me a lot of trouble with Jaunty NBR. Having played around a bit more I found that if you add the iptables package rather than ipmasq the network sharing feature works as it should without any further configuration (it seems like iptables was stripped out of the NBR version, dnsmasq-base should be installed by default with Jaunty). Hope this helps!
This article was very helpful and worked perfectly when I needed to share my Internet connection... But now I have a problem:
This totally screws up my local network so I can't access servers and printers on the LAN. How do I fix that?
Hi Grant, did you perform step 10? It should get ipmasq to config iptables correctly for your LAN connection too, provided that the ipmasq script is in the correct location.
GunBlade3,
Did you ever get working with WPA on jaunty..though works well with unencrypted.
been trying everything under the sun..
cannot connect 2 Jaunty 2.6.28.14 running m/cs ..
1. The n/w created is hidden.
2. Keeps asking p/w again and again.
ANY tips greatly appreciated
Sandhu
Hi Sandhu,
I'm afraid I haven't been able to get the settings to work reliably with WPA before either. I used that to setup temporary networks when outdoors, but never used it on a permanent basis.
you are the BEST! Thanks to you I can use an ad hoc connection for my iPod touch. Thank you very much
You're welcome :)
Hmm... for some reason it doesn't work anymore. I followed the instructions then connected using the Connect to the Hidden Network option. It tries then fails
Post a Comment