Membuat Hotspot/Access Point Lewat Wifi Laptop di Ubuntu Menggunakan Modem

1. Install dulu tool yang kita gunakan, yaitu hostapd dan dhcp-server

sudo apt-get install dhcp3-server hostapd
2. Buat file hostapd.conf di home folder

cd ~
sudo gedit hostapd.conf
3. Masukkan script berikut di dalam hostapd.conf


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

Pada ssid dan wpa_passphrase, silahkan isi terserah yang kawan mau. Nantinya itu akan menjadi nama hotspot dan passwordnya.
Kemudian simpan dan tutup file.

4. Masuk ke file dhcpd.conf di /etc/dhcp

sudo gedit /etc/dhcp/dhcpd.conf
5. Tambahkan script berikut di baris paling bawah dhcpd.conf




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;
}

Penjelasan : DNS yang akan digunakan adalah dari Mbah Google :D. Sedangkan range IP host adalah 192.168.1.10 sampai dengan 192.168.1.254. Sedangkan router dalam hal ini adalah laptop kita, menggunakan IP 192.168.1.1.
Simpan dan tutup file.
6. Masuk ke file isc-dhcp-server di /etc/default

sudo gedit /etc/default/isc-dhcp-server

7. Di INTERFACES="" silahkan beri value wlan0


INTERFACES="wlan0"

Simpan dan tutup file
8. Masuk ke file sysctl.conf di /etc


sudo gedit /etc/sysctl.conf

9. Hilangkan tanda pagar pada #net.ipv4.ip_forward=0 , dan ubah 0 menjadi angka 1. Simpan dan tutup file.
10. Masuk ke file rc.local di folder yang sama (/etc)


sudo gedit /etc/rc.local

11. Tambahkan script berikut sebelum exit 0


/sbin/iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

Simpan dan tutup file.

12. Buat file hostapd.sh di home folder


cd ~
sudo gedit hostapd.sh

13. Masukkan script berikut :


#!/bin/sh -e
sudo hostapd -B hostapd.conf
sleep 1
sudo ifconfig wlan0 inet 192.168.1.1
sleep 1
sudo /etc/init.d/isc-dhcp-server start
exit

12. Selesai. Untuk menjalankannya, setelah kita men-connect-kan modem kita ke internet, silahkan jalankan script tersebut di home folder


sh hostapd.sh
Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

3 comments :

  1. saya sudah jalankan semua urutan, restart tapi gak jalan dengan pesan error Line 9: invalid WPA passphrase length 6 (expected 8..63)
    WPA-PSK enabled, but PSK or passphrase is not configured.
    2 errors found in configuration file 'hostapd.conf'
    SIOCSIFFLAGS: Operation not possible due to RF-kill
    Rather than invoking init scripts through /etc/init.d, use the service(8)
    utility, e.g. service isc-dhcp-server start

    Since the script you are attempting to invoke has been converted to an
    Upstart job, you may also use the start(8) utility, e.g. start isc-dhcp-server
    start: Job failed to start

    ReplyDelete
  2. sama aku juga gitu gan

    ReplyDelete
  3. kira2 kalo gini bener g y gan ?

    nl80211: Failed to set interface wlan0 into AP mode
    nl80211 driver initialization failed.
    ELOOP: remaining socket: sock=4 eloop_data=0x8a5c8f8 user_data=0x8a5ce98 handler=0x807c5e0
    ELOOP: remaining socket: sock=6 eloop_data=0x8a5eca0 user_data=(nil) handler=0x8086770
    Rather than invoking init scripts through /etc/init.d, use the service(8)
    utility, e.g. service isc-dhcp-server start

    Since the script you are attempting to invoke has been converted to an
    Upstart job, you may also use the start(8) utility, e.g. start isc-dhcp-server
    isc-dhcp-server start/running, process 4203

    ReplyDelete