Ubuntu 12.04 – setting up my Wifi Hotspot**
*Gathering information:*

Opening a terminal and typing the following command :

#lspci

Showed me that I have a :

 Network controller: Atheros Communications Inc. AR9285 Wireless Network
Adapter (PCI-Express)

#lsmod

Shows that it uses the ath9k drivers (this information may help you to
google for setup information specific to your machine.)

Also

#iwconfig

will give you the name of your wireless adapter name for example:

“wlan0 “or “wlan1” (*note that the “0″ and “1″ are numbers not letters*)
*Installing Programs*

I then installed 2 programs via apt. In a terminal enter the following
command:

#sudo apt-get install dhcp3-server

#sudo apt-get install hostapd
Editing Configuration Files

In a terminal:

#sudo gedit

This will bring up the editor with root privileges so that you can edit
system files. (*WARNING* – editing system files can damage your system.
Please do not edit system files unless you have made a backup of them first)

Open / Create the following files editing:

1. /etc/hostapd/hostapd.conf

interface=wlan0
driver=nl80211
ssid=my_hotspot
channel=1
hw_mode=g
auth_algs=1
wpa=3
wpa_passphrase=1234567890
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP

*Please note*: the “ssid” in this case “my_hotspot” is the name of the
network that will show up on the device or laptop that will connect to the
hotspot. The passphrase is a password – you can change this to any other 10
digit number. The device / laptop that wants to connect will have to enter
this password.

*Save the file.*

2. /etc/default/isc-dhcp-server

Edit the line that says

INTERFACES=”"

To

INTERFACES=”wlan0″

Or change the “wlan0″ to “wlan1″ or whatever the wireless adapter name you
have (see above section on gathering information.)

3. /etc/dhcp/dhcpd.conf

Make sure the follow lines are* Commented out* ( put a hash “#”  sign at
the beginning of the line ) the following lines:

# option definitions common to all supported networks…
#option domain-name “example.org”;
#option domain-name-servers ns1.example.org, ns2.example.org;

#default-lease-time 600;
#max-lease-time 7200;

Add the following lines to the file (copy and paste)

subnet 10.10.0.0 netmask 255.255.255.0 {
        range 10.10.0.2 10.10.0.16;
        option domain-name-servers 8.8.4.4, 208.67.222.222;
        option routers 10.10.0.1;
}

(Note: the only other line in this whole config file that is uncommented is
:

ddns-update-style none;)

4. /etc/default/hostapd

Add the following lines to the bottom of the file. Make sure similar lines
are commented.

RUN_DAEMON=”yes”
DAEMON_CONF=”/etc/hostapd/hostapd.conf”
DAEMON_OPTS=”-dd”

*(Note: This file makes sure hostapd program starts on bootup with your
edited configuration files loaded)*

5. /etc/network/interfaces

This is how my interfaces file looks:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static
 address 10.10.0.1
 netmask 255.255.255.0

(Note: Again you must change every “wlan0″ to the name of your adapter.
This file may have more entries for other network adapters. Just make sure
you edit the section of the wireless adapter you want to use. This file
will automatically configure the wireless network adapter’s network address
at bootup time.)

At this stage you can reboot. And hopefully any device / laptop should
connect to your wifi hotspots network via the network manager applet. On
these devices search for the network “my_hotspot” and type in the password.

At this stage however you cannot access the Internet. Which brings us to
another important step:
Internet connection Sharing.

You will need to ask yourself the following information. How do I connect
to the internet on my ubuntu computer / laptop? In my case I use a usb 3G
modem. You need to know the name of the network adapter that you connect to
the internet on. > This must be different from the network adapter you
configured above. (ie wlan0)

Connect to the internet, and in a terminal type:

#ifconfig

On my netbook, one of the entries is for adapter “ppp0″ this is the network
adapter for my usb modem and the connection to the internet. The following
steps use “ppp0″ however you can swap it for your adapter name:

To share the internet connection we have to do a thing called “ip
masquerading”.

First we have to allow ip forwarding:

#sudo gedit

edit /etc/sysctl.conf

Make sure the following line is uncommented and reads

net.ipv4.ip_forward=1

Save and close gedit. (reboot)

After reboot: Connect to the Internet and In a terminal type:

# sudo iptables -t nat -A POSTROUTING -s 10.10.0.0/16 -o ppp0 -j MASQUERADE

(Note the “ppp0″ adapter name in the above line. The 10.10.0.0 is the ip
address of your network that you configured in steps 3 and 5 above. Your
wifi hotspot will thus share the internet with up to 15 machines that are
given the ip addresses 10.10.0.2 to 10.10.0.16)

All devices and laptops should now be able to browse the internet and
download email. If this works we have to make this permanent:

#sudo gedit

edit /etc/rc.local

add this line just before “exit 0″

iptables -t nat -A POSTROUTING -s 10.10.0.0/16 -o ppp0 -j MASQUERADE

Reboot / Connect to the internet and Enjoy your wifi hotspot.
*Acknowledgements*

When configuring and setting up used and adapted the following  Howto’s and
forums:

http://exain.wordpress.com/2011/03/31/making-a-wifi-hotspot-access-point-using-linux-wifi-lan-cardusb-adapter/

http://ubuntuforums.org/showthread.php?p=11890695#post11890695

http://ubuntuforums.org/showthread.php?p=11890408#post11890408

source:
http://thenewbieblog.wordpress.com/2012/05/01/wifi-hotspot-setup-on-ubuntu/

On Wed, Jul 11, 2012 at 11:48 AM, Rabin shrestha <[email protected]>wrote:

> i wanted to share internet using same wireless driver which is use to
> connect the net... i have searched the google but result only came up with
> to share auto eth0 (lan) .plz help me out.
>
> --
> FOSS Nepal mailing list: [email protected]
> http://groups.google.com/group/foss-nepal
> To unsubscribe, e-mail: [email protected]
>
> Mailing List Guidelines:
> http://wiki.fossnepal.org/index.php?title=Mailing_List_Guidelines
> Community website: http://www.fossnepal.org/
>



-- 
Regards

><((((º>`·.¸¸.·´¯`·.¸.·´¯`·...¸><((((º>¸.

·´¯`·.¸. , . .·´¯`·.. ><((((º>`·.¸¸.·´¯`·.¸.·´¯`·...¸><((((º>
Mr. Sagar Kshetri (ASK?)
Url: www.sagarkshetri.com.np

-- 
FOSS Nepal mailing list: [email protected]
http://groups.google.com/group/foss-nepal
To unsubscribe, e-mail: [email protected]

Mailing List Guidelines: 
http://wiki.fossnepal.org/index.php?title=Mailing_List_Guidelines
Community website: http://www.fossnepal.org/

Reply via email to