If you are trying to share your internet connection between computers, you can easily to make ad-hoc connection on your laptop and share it to the others. But it's getting hard when you tried to share your laptop internet connection to another mobile devices like Android or Windows Mobile. Because not every devices can read ad-hoc access point across platform. Here it is I'll show you how to make it possible.
I have to inform you what I've been use to do this action:
1. Asus EeePC 1015 BX (netbook) with Atheros series WiFi
2. Android Tablet with Gingerbread version 2.3.4
3. Ubuntu 12.04 LTS Precise
4. USB Modem CDMA EVDO
First thing you need to install some supporting application. Open the Terminal console you can found it on Unity Menu or press Ctrl-Alt-T on keyboard. Then type this following command:
sudo apt-get install hostapd
sudo apt-get install dhcp3-server
or copy the command above and hit Ctrl-Alt-V to paste on Terminal
create hostapd.conf file with this command:
sudo gedit hostapd.conf
Then add this following text on hostapd.conf file:
interface=wlan0
driver=nl80211
ssid=replace_this_SSID_name
channel=1
hw_mode=g
auth_algs=1
wpa=3
wpa_passphrase=replace_this_password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
Save it.
Now edit dhcpd.conf file
sudo gedit /etc/dhcp3/dhcpd.conf
And add this following text to file:
option subnet-mask 255.255.255.0;
default-lease-time 600;
max-lease-time 7200;
option domain-name-servers 8.8.8.8, 8.8.4.4 ;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.254;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
}
(no need to worry if the file is empty, just add those text above)
Edit dhcp3-server file :
sudo gedit /etc/default/dhcp3-server
Find INTERFACES="" text and change it to INTERFACES="wlan0"
Now you have to forward your internet connection by editing this file
sudo gedit /etc/sysctl.conf
Remove the hash symbol on # net.ipv4.ip_forward=0
then change the value from 0 to 1
Then edit rc.local file :
sudo gedit /etc/rc.local
Add this text below :
/sbin/iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
ifconfig wlan0 inet 192.168.1.1 netmask 255.255.255.0
hostapd -d hostapd.conf &
/etc/init.d/dhcp3-server restart
Just before "exit 0" script.
If you want to share internet connection on LAN, just replace ppp0 with eth0.
At this step, you can reboot your computer.
Connect the computer to the internet with USB modem or LAN then run the hostapd application to share the connection from WiFi with this command from Terminal console:
sudo hostapd ./hostapd.conf
You computer is already to an Access Point. Next, you have to setup your mobile devices.
Turn on WiFi on your mobile and scan for available network. Choose your already made hot spot and fill the password. If your mobile device can't obtain IP address. So you need to input it manually.
You can put this address on your mobile:
IP address : 192.168.1.10 to 192.168.1.254
Netmask : 255.255.255.0
Gateway : 192.168.1.1
DNS 1 : 8.8.8.8
DNS 2 : 8.8.4.4
It shoud work now.
0 comments:
Post a Comment