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

In our campus we have a leased line connection from a service provider, which has an external IP W.X.Y.Z. This connection is distributed from the server several sub-networks / subnets as follows:

  1. Faculty: 172.33....../
  2. Administration: 172.34......./
  3. Students: 172.35...../

A student has a laptop with a fixed IP address / where the IP address is on the ethernet port. The gateways for internet access are and Further the student has a wireless port which is inaccessible in the hostel area. The OS of the student is Ubuntu 12.10.

The student in the possession of an android phone on which he wishes to install specific software and therefore wishes to activate the internet therein. The student has already attempted the Wireless hotspot solution which works for 12.04 but has not been successful.

Various instructions on the internet have helped the student to do the following

Installation of dhcp server and hostapd:

sudo apt-get install isc-dhcp-server
sudo apt-get install hostapd

File: /etc/network/interfaces

auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet static

File: /etc/dhcp/dhcpd.conf

subnet netmask { 
option routers; 
option domain-name-servers; 
default-lease-time 6000; 
max-lease-time 72000; 

File: /etc/hostapd/hostapd.conf

wpa_pairwise=TKIP CCMP

File: /etc/default/hostapd


File: /etc/default/isc-dhcp-server


File: /etc/rc.local

iptables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE
exit 0

After all the configuration, the computer is restarted. The student can see that the hotspot named “my_hotspot” is available. The hotspot also awards an address to the android phone. The student will now be able to browse the internet.

share|improve this question
up vote 2 down vote accepted

This is wrong - iptables -t nat -A POSTROUTING -s -o wlan0 -j MASQUERADE

It should not be wlan0. It should be the interface has the internet connection. It should be

iptables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE

See How to setup a wi-fi hotspot (access point mode)? for more details.

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.