Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an internet connection through a cable modem. The IP address on the cable modem is not static and is perhaps obtained through a DHCP mode.

I wish to share this internet connection through the Wifi port available on my computer. Interestingly, the ad-hoc network setting does not work for my case on Ubuntu.

Therefore, I have set up my /etc/network/interfaces as follows:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static

I am not clear with the process of routing, as I do not know the DHCP address until it is assigned i.e. only after I connect I will know the IP address of the system, and that IP address would be the one which the DHCP clients of my computer would use to route their internet connectivity.

Any clues on this?

share|improve this question

Try ap-hotspot, which is a convenient wrapper around hostapd.

share|improve this answer

I assume you are connecting to internet through your eth0 and wish to share the connection to other computers via your wireless card (wlan0).

The reason what you have tried is failing is because your ubuntu only shares the connection as is, and your cable modem provider likely provides only one external IP address, which is given to your ubuntu computer. The other computers connecting to your newly created WiFi network are not getting IP addresses, and thus are not able to get connected.

Thus you have to install & enable a DHCP server on your ubuntu machine.

sudo apt-get install dnsmasq

and then configure it sudo nano /etc/dnsmasq.conf by adding the following lines in the "interface" section:


After this, your clients should get a IP address when connecting to the newly created WiFi network, and then the connection should be forwarded to the internet.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.