Hostapd : The Linux Way to create Virtual Wifi Access Point. NOTE: Although this guide should work in most cases, it is not flawless and still requires few minor modifications to make the process bug- free. Please do point out corrections and changes.(After you are done with this post, please do checkout my Python Hostapd Client)I was recently looking into ways to use my laptop’s wifi adapter as a wireless access point to enable my phone (Nokia E6. Ad- hoc feature may be used to share internet through wifi, but it doesn’t work with many phones and my PSP. I found connectify and virtual router for Windows which served this purpose, unsatisfactorily. Other than the reasons like Virtual Router not detecting my 3g modem and Connectify (free version) not allowing me to set desired ssid for my virtual access point, the biggest issue with these two was the limited modes available for the access point. ![]() Both the programs offered only WPA2- PSK encryption for infrastructure mode and WEP and open encryption for ad- hoc modes. Many devices connect only through infrastructure mode and support for WPA2- PSK is absent in few devices (including the PSP). Also, since I am a Linux user, I needed something else. This is where hostapd kicks in. Arch Linux (or Arch / ˈ ɑːr tʃ /) is a Linux distribution for computers based on x86-64 architectures. Arch Linux is composed predominantly of free and open. Linux install TP-Link TL-WN725N Step by step how to usb driver install nano version 2 WiFi ubuntu driver install. This how to will work on Ubuntu TL-WN725N install. ![]() · 484 thoughts on “ Hostapd : The Linux Way to create Virtual Wifi Access Point ” Micha Ingo October 5, 2016 at 12:26 am. I have a small Problem.HOSTAPD“hostapd is a user space daemon for access point and authentication servers. In simple words, hostapd allows you to create software wifi access points allowing decent amount of configuration options. In rest of this post, I will show how to create a software access point in Linux using hostapd and share your internet to the devices through it. I have used my Lenovo Z5. Arch Linux and have also tested it under Ubuntu 1. But the method is also applicable for other Linux distros and supported hardware. If the method works/doesn’t work for a non- Atheros wifi card, please do comment. REQUIREMENTSSupported Wireless Card (ie. An internet connection you want to share. A linux distro. CHECKING WIFI CARD SUPPORTFirst of all, you will need to find if your wireless card is supported by hostapd. To check what kernel driver is in use for your wireless card, type the follwing in the terminallspci - k | grep - A 3 - i "network"Look for the section in the output which corresponds to your Wireless controller. In my case, it is. Network controller: Atheros Communications Inc. AR9. 28. 5 Wireless Network Adapter (PCI- Express) (rev 0. Subsystem: Lenovo Device 3. Kernel driver in use: ath. The Bold part is my kernel driver in use. It will vary depending on your wifi card and driver you are using. Now get the interface details of your wireless driver bymodinfo ath. In my case, the output wasdepends: ath. Kernel driver supports mac. Supported wireless cards/drivers. INSTALLING HOSTAPDInstall Hostapd from your distro’s repo. S hostapd. sudo apt- get update & & sudo apt- get install hostapd. Should be available in official repo of your distro. Or Download Hostapd here and compile it. CONFIGURING HOSTAPDThe /etc/hostapd/hostapd. Soft. AP. This is the minimal configuration setting which will let you test if hostapd is working. Create a file ~/hostapd- test. Use a wifi device to check if the access point is being detected. You won’t be able to connect to it at present. Once hostapd is working fine, its time to configure hostapd with more options. Here is a brief overview of some of its options. Mess. With. Vincent. Valentine. #sets the mode of wifi, depends upon the devices you will be using. It can be a,b,g,n. Setting to g ensures backward compatiblity. Sets authentication algorithm. Sets WPA and WPA2 authentication#####. Kee. PGuessin. G. WPA- PSK. #sets encryption used by WPA. TKIP. #sets encryption used by WPA2. CCMP. #################################. Sets WEP authentication#####. WEP is not recommended as it can be easily broken into. For No encryption, you don't need to set any options. So, here is my complete /etc/hostapd/hostapd. WPA authentication options. Mess. With. Vincent. Valentine. ignore_broadcast_ssid=0. Kee. PGuessin. G. WPA- PSK. wpa_pairwise=TKIP. CCMP. SETTING UP THE DHCP SERVERAlternative Method: I recommend using dnsmasq over dhcpd for this scenario mainly due to the ease in configuring it. I have continued this post from this point in a new separate post which uses dnsmasq instead of dhcpd. If you have any reason to choose dhcpd over dnsmasq or if dnsmasq isn’t working for you, then carry on. Now that hostapd is running fine, you need to setup a DHCP server to run along with hostapd in order to assign ip address to the devices connecting to the access point. Setting up a dhcp server is quite straightforward. Install dhcp server from your distro’s repo. S dhcp. sudo apt- get update & & sudo apt- get install isc- dhcp- server. Ubuntu) to. ddns- update- style none. Broadcast Address. Domain name servers, tells the clients which DNS servers to use. FINAL STEPSThe final steps involves enabling NAT to share internet in one network interface with the clients connected through hostapd. I have included all the steps to configure wlan interface, enable NAT, start DHCP server and hostapd in the BASH script below. Let the name of this file be init. Soft. AP. Copy the BASH file below to the file init. Soft. AP.(and make changes to file according to your system). Initial wifi interface configuration. Start DHCP, comment out / add relevant section##########. Thanks to Panji. #Doesn't try to run dhcpd when already running. POSTROUTING - -out- interface $2 - j MASQUERADE. FORWARD - -in- interface $1 - j ACCEPT. Thanks to lorenzo. Uncomment the line below if facing problems while sharing PPPo. E, see lorenzo's comment for more details. I FORWARD - p tcp - -tcp- flags SYN,RST SYN - j TCPMSS - -clamp- mss- to- pmtu. Script Changes (1. Added check for already running dhcpd process (Thanks to Panji), Added an optional line to fix issues related to PPPo. E connection sharing (See lorenzo’s comment)It might be more convenient to use hostapd - B /etc/hostapd/hostapd. Thanks to Enda for pointing out)Make this file executable, and run it. The syntax for executing it is./init. Soft. AP wifi_card_interfaceinterface_with_internet. Soft. AP. ./init. Soft. AP wlan. 0 eth. The “wifi_card_interface” will be wlan. For “interface_with_internet“, since I want to share internet from my ethernet network interface, I used eth. If I ever want to share internet from my 3g modem, I use ppp. These values need not be same for everyone)You may see available network interfaces by. Note: If dhcpd is failing to start and throwing errors like No subnet declaration for wlan. Mahesh and Charlie. Either use dnsmasq, or try adding the following to the /etc/default/isc- dhcp- server file. INTERFACES=”wlan. Raspberry Pi users might want to take a look at Denis Kökeny’s comment. Problems, Errors, Feedback or any alternatives? Feel free to reply.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |