Today,I would like to share.
How To Create An Access point on ubuntu using hostapd and dnsmasq!
It is kind of connection sharing from ur tetherd connection to ap mode.
At this very first of this tutorial, you need to tether with your mobile with internet access.
That is all.
But make sure your wireless card support AP mode.
To check whether it support or not.
How To Create An Access point on ubuntu using hostapd and dnsmasq!
It is kind of connection sharing from ur tetherd connection to ap mode.
At this very first of this tutorial, you need to tether with your mobile with internet access.
That is all.
But make sure your wireless card support AP mode.
To check whether it support or not.
1) sudo apt-get install update
2) Install the hostapd and dnsmasq by following commands,
sudo apt-get install hostapd dnsmasq
3) The third is to create SSID,To do this you have to create config file in /etc/hostapd/ directory.
sudo nano /etc/hostapd/hostapd.conf
And add this line and save it.
interface=wlan0
ssid=mm-kst
hw_mode=g
wpa=2
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK WPA-EAP WPA-PSK-SHA256 WPA-EAP-SHA256
4) And the next step is to configure the wireless card only to run in ap mode,
sudo nano /etc/network/interfaces
And add those lines and save it,
auto wlan0
iface wlan0 inet static
hostapd /etc/hostapd/hostapd.conf
address 192.168.100.1
netmask 255.255.255.0
5) To distribute dhcp, you do need to configure dnsmasq
Then, sudo nano /etc/dnsmasq.conf
Find: #interface=lo,
And change: interface=lo,wlan0
Find: #no-dhcp-interface=lo
Change it: no-dhcp-interface=lo
Find: #dhcp-range=
Change it: dhcp-range=192.168.100.20,192.168.100.30,255.255.255.0,12h
Finally save it
6) The last is to configure to access internet from terthered network to ap mode
sudo nano /etc/sysctl.conf
find: #net.ipv4.ip_forward=1
Change it: net.ipv4.ip_forward=1
7) We need to activate NAT in the built-in firewall of Linux to make sure the traffic going out uses the external address as its source address and thus can be routed back.
sudo nano /etc/rc.local
And add this line to this file,
iptables -t nat -A POSTROUTING -s 192.168.100.20/24 ! -d 192.168.100.20/24 -j MASQUERADE
And save it.
You might need to run rfkill to enable the hardware using a command like
rfkill unblock 0
Finally, restart the laptop.
And Check it whether it works or not.
iw wlan0 info
And if you see your type is in ap mode.You created your access point successfully.
If u dun, You should try more.
LOL
Thanks
Whatever i am sure it is fun.
2) Install the hostapd and dnsmasq by following commands,
sudo apt-get install hostapd dnsmasq
3) The third is to create SSID,To do this you have to create config file in /etc/hostapd/ directory.
sudo nano /etc/hostapd/hostapd.conf
And add this line and save it.
interface=wlan0
ssid=mm-kst
hw_mode=g
wpa=2
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK WPA-EAP WPA-PSK-SHA256 WPA-EAP-SHA256
4) And the next step is to configure the wireless card only to run in ap mode,
sudo nano /etc/network/interfaces
And add those lines and save it,
auto wlan0
iface wlan0 inet static
hostapd /etc/hostapd/hostapd.conf
address 192.168.100.1
netmask 255.255.255.0
5) To distribute dhcp, you do need to configure dnsmasq
Then, sudo nano /etc/dnsmasq.conf
Find: #interface=lo,
And change: interface=lo,wlan0
Find: #no-dhcp-interface=lo
Change it: no-dhcp-interface=lo
Find: #dhcp-range=
Change it: dhcp-range=192.168.100.20,192.168.100.30,255.255.255.0,12h
Finally save it
6) The last is to configure to access internet from terthered network to ap mode
sudo nano /etc/sysctl.conf
find: #net.ipv4.ip_forward=1
Change it: net.ipv4.ip_forward=1
7) We need to activate NAT in the built-in firewall of Linux to make sure the traffic going out uses the external address as its source address and thus can be routed back.
sudo nano /etc/rc.local
And add this line to this file,
iptables -t nat -A POSTROUTING -s 192.168.100.20/24 ! -d 192.168.100.20/24 -j MASQUERADE
And save it.
You might need to run rfkill to enable the hardware using a command like
rfkill unblock 0
Finally, restart the laptop.
And Check it whether it works or not.
iw wlan0 info
And if you see your type is in ap mode.You created your access point successfully.
If u dun, You should try more.
LOL
Thanks
Whatever i am sure it is fun.