[Share] Create Hotspot+Share Internet Connection To Android
#1
As many of you know, most of your android device (not only android) can't connect to ad hoc hotspots. If you using Windows no matter Windows7 / Windows 8 running in your machine,  there's a solution to setup infrastructure hotspot using software like mHotspot, connectify and many others. For Linux users also allows to create wifi hotspot to share an internet connection, but it will be ad hoc mode. So I write this tutorial how to set up infrastructure hotspot on Linux and share connection from Linux to Android device.

This's result of this tutorial which run in my Kali Linux :
Spoiler! :
[Image: sharing%2Bunixsquad.png]

And this is screenshot which I've took from my ASUS Zenfone 5.
Spoiler! :
[Image: result%2Bcreate%2Bhotspot%2Bon%2Blinux%2...ad%2B2.jpg]

You should make sure that your wifi adapter supports infrastructure hotspots. Let's start :-)

We need to install an additional tools : hostapd (hotspot server), dnsmasq (dns dhcp server). Open your terminal, type and run this command :
Spoiler! :




Code:
root@kurawa:~# apt-get install hostapd dnsmasq
If the service already start, stop it and prevent them from starting on system start up :
Spoiler! :

Code:
root@kurawa:~# service hostapd stop
root@kurawa:~# service dnsmasq stop
root@kurawa:~# update-rc.d hostapd disable
root@kurawa:~# update-rc.d dnsmasq disable

After all stoped, we need to configure somre files. Open dnmasq.conf with your favorites text editor : 
Spoiler! :

Code:
root@kurawa:~# gedit /etc/dnsmasq.conf

Add this config code :
Spoiler! :

Code:
# Bind to only one interface
bind-interfaces
# Choose interface for binding
interface=wlan0
# Specify range of IP addresses for DHCP leasses
dhcp-range=192.168.150.2,192.168.150.10

Next, we need to configure hostapd config.
Spoiler! :

Code:
root@kurawa:~# gedit /etc/hostapd.conf

add this code :
Spoiler! :

Code:
# Define interface
interface=wlan0
# Select driver
driver=nl80211
# Set access point name
ssid=Unix Squad Labs
# Set access point harware mode to 802.11g
hw_mode=g
# Set WIFI channel (can be easily changed)
channel=6
# Enable WPA2 only (1 for WPA, 2 for WPA2, 3 for WPA + WPA2)
wpa=2
wpa_passphrase=UnixSquad#123

That config will create hotspot named Unix Squad Labs with UnixSquad#123 as password. You can change ssid and password with anything you want. All done, now we just need to create bash file to launch hostpot that we setup before. Save anywhere and give name anything you want. And please dont forget save as .sh extension.
Spoiler! :

Code:
#!/bin/bash
# Start
# Configure IP address for WLAN
sudo ifconfig wlan0 192.168.150.1
# Start DHCP/DNS server
sudo service dnsmasq restart
# Enable routing
sudo sysctl net.ipv4.ip_forward=1
# Enable NAT
sudo iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
# Run access point daemon
sudo hostapd /etc/hostapd.conf
# Stop
# Disable NAT
sudo iptables -D POSTROUTING -t nat -o eth1 -j MASQUERADE
# Disable routing
sudo sysctl net.ipv4.ip_forward=0
# Disable DHCP/DNS server
sudo service dnsmasq stop
sudo service hostapd stop

Probably you need to change eth1 to ppp0 or eth0 or any other number which refers to your wired connection. This time to start and launch it.
Spoiler! :

Code:
root@kurawa:~# cd Desktop/LauchNyong/ && bash startwipi.sh

Enjoy :-)

So, that's all I can write how to set up infrastructure hotspot on Linux and share connection from Linux to Android device. 

Maaf bahasanya amburadul kaya tahu gejrot :v
Abisnya baru nulis diblog males buat nulis ulang. Hehehe.. Udah gitu aja semoga bermanfaat.

VISIT MY BLOG http://unixsquad.blogspot.com

#2
mantab,om..
Coba praktekin dulu.. Big Grin







#3
Wink 
sip om,
saya prakteki dulu ya om,
bahasane enek seng ngerti enek seng ora aku om,
nice share om,
The Experience is the Best Teacher

#4
(04-15-2015, 11:06 AM)Devonz Wrote: mantab,om..
Coba praktekin dulu.. Big Grin

Oke monggo om

#5
(04-15-2015, 12:52 PM)go_block Wrote: sip om,
saya prakteki dulu ya om,
bahasane enek seng ngerti enek seng ora aku om,
nice share om,

Big Grin
iya monggo om. thanks

#6
sukses dari koneksi dial-up terus di sharing ke wifi hotspot, makasih bang Wink
#include <stdio.h>
void main() {
print ("
Opensource bukan GRATIS tapi BEBAS
\n");
print("my office http://blog.alirahman.web.id\n);
}

#7
Smile 
Mantap bro, ini nih ane cari cari, tapi ngomong ngomong, kalau sumber internet laptop nya dari wireless juga, apa bisa diteruskan gitu bang? jadi kayak repeater gitu, atau ane harus makai 2 wlan bg? makasih ya mas bro bos atas informasinya Big Grin

#8
wah ane kaga faham TS pake bahasa ing pulak. padal kita orang indonesia Sad

#9
(05-14-2015, 10:15 PM)Andi Andi Wrote: wah ane kaga faham TS pake bahasa ing pulak. padal kita orang indonesia Sad

jangan jadikan bahasa sebagai hambatan buat mencari ilmu :-) dari pada aku harus nulis dari awal malah kelamaan. karena waktu itu memang baru post diblog langsung copas dimari.

visit WWW.LINUXSLAVES.COM

#10
# Bind to only one interface
bind-interfaces
# Choose interface for binding
interface=wlan0
# Specify range of IP addresses for DHCP leasses
dhcp-range=192.168.150.2,192.168.150.10
(dhcp-range=192.168.150.2,192.168.150.10 ) <<<<<<< itu di copas ato di ubah dolo ip nya ?
ane mw buat jaringan sndiri biar ikan tuh masuk Big Grin
pake modem bisa kah ?






Users browsing this thread: 1 Guest(s)