- Setting Up Hotspot On Kali Linux
- Table of contents
- Prerequisites
- Introduction
- Finding wireless drivers
- Installing the necessary tools
- Setting up configuration files
- Using the graphical user interface
- Conclusion
- create_ap
- create_ap Help
- create_ap Usage Example
- How to install create_ap
- create_ap Screenshots
- create_ap Tutorials
Setting Up Hotspot On Kali Linux
Unlike other operating systems such as Windows, Kali Linux is an open-source operating system. It is considered the best operating system in cyber security implementation by the white hat and black hat hackers.
Kali is a Debian-based Linux distribution used mainly in advanced penetration testing, also known as pen-testing. It is freely available and accessible to professionals and learners.
Kali Linux has a wide range of features and tools for penetration testing. Each distro of Linux has an intended purpose for implementation; Kali Linux majoring in security.
Table of contents
Prerequisites
- Be familiar with the Linux family of operating systems.
- Be familiar with Kali Linux basics and the way to use it. Refer to this article to get started with Kali Linux
Introduction
In general, it is a nice idea to disable services that you do not use. Kali makes it easy to do this since network services are disabled by default. As long as services remain disabled, they do not pose any security threat.
However, it would be best to be careful when you enable them because it has no firewall by default. So, if they listen on all network interfaces, they are effectively publicly available, making it vulnerable.
Kali Linux distro has mobile hotspot ability disabled. Creating a mobile hotspot can only be done by customizing the network configuration.
This article will look into the processes used to create a mobile hotspot on Kali Linux and other Linux distros such as Ubuntu.
Throughout this tutorial, we are going to be using Kali Linux to create our hotspot. You can use any other Linux distribution of your choice.
Finding wireless drivers
To access the available network drivers, type the following command in the terminal:
The command above works only for wireless drivers.
In the case of using a USB adapter, use the command shown below:
Installing the necessary tools
To create our hotspot, we need to install the required tools. The first and crucial tool is hostapd , which acts as the hotspot server.
To install hostapd , type in the following command:
The second tool we will use is dnsmasq. It is a lightweight, easily configurable, DNS forwarder designed to provide DNS services to small networks.
It can serve the names of local machines which are not in the global DNS. The DNS server supports both static and dynamic DHCP leases, multiple networks, and IP address ranges. The dnsmasq will act as the server to the DHCP.
To install dnsmasq , type in the following command:
Once done with the installations, we can move to the next step.
We will proceed to check the just-installed processes. If already started, stop those in progress, and deter them from starting during the system’s start-up. This is because it turns off the Wi-Fi and turns it into a Wi-Fi hotspot.
Below are the commands used for stopping and disabling updates of the services:
To stop services in progress, we use these two commands:
sudo service hostapd stop
sudo service dnsmasq stop
To disable services already installed, we use these two commands:
sudo update-rc.d hostapd disable
sudo update-rc.d dnsmasq disable
Setting up configuration files
Configuration is vital since it reduces operation tasks, optimizing IP addressing planning, and easily manages user mobility. After installing the services, we will need to configure the necessary files, i.e. hotspot.sh.
We will begin by typing the command below in our terminal:
sudo gedit /etc/dnsmasq.conf
After running the command, write the code below under hotspot.sh for configuration:
# Only bind it to one interface bind-interfaces # Select the interface to use for binding interface=wlan0 # Select a scope of IP addresses to be used in DHCP leasing dhcp-range=192.168.1.1,192.168.1.9
The preceding step in this stage involves performing hostapd configuration. To perform this configuration, type in the following command in the terminal:
To properly configure hostapd, add the following code to our configuration file:
# Set interface interface=wlan0 # Set driver to driver=nl80211 # Set your desired ssid(Wi-Fi name) ssid=Wi-FiConnection # Set the access point hardware mode to 802.11g hw_mode=g # Select WIFI channel channel=6 # Ensure to enable only WPA2 wpa_passphrase=Wi-Fi connection
In the code above, wlan0 is your Wi-Fi card. WLAN stands for Wireless Local Area Network. The number 0 is the number allocated to the card. This is because the number of cards starts from zero and goes up (0,1,2,3, etc…).
You can change your SSID name and password with your desired choice. The above configuration will create a hotspot called a Wi-Fi connection with a password.
Note: You can create the configuration file anywhere you want, naming it as hotspot.sh using an editor of your choice.
After completing the configuration, we will stop the running services by typing in the commands below:
sudo service dnsmasq stop
sudo service hostapd stop
Using the graphical user interface
In this part, we will be using the graphical user interface to do the configurations. Go to advanced network settings, click on the gear icon to open it up.
Your screen should look like this:
To proceed with our configuration, follow the steps below:
Step I: You click the “+” button in the window, and another window pops up. In this new window, we are going to do the configuration of your hotspot.
Step II: Under the network type, select “Wi-Fi”. Ensure your configuration resembles the second screenshot below:
Step III: To set a password, click on Wi-Fi security and select WPA & WPA2 Personal. Below the input box, key in an eight or more memorable digit password of your choice and click save.
Security is an essential feature; this encryption protection is designed for homes and small office networks and does not need an authentication server.
WPA-Personal, also known as WPA-PSK (pre-shared key), is available on all 3 WPA versions, i.e. WPA, WPA2, and WPA3.
You’ve done it! Close all the opened windows, enjoy your newly created hotspot, and share it amongst computers, mobile phones, etc.
Conclusion
In this article, you have gained insights for setting up a hotspot on Kali Linux. You are now equipped to set up and manage your personal hotspot on Kali Linux.
Enjoy sharing data via hotspot on Kali Linux!
Peer Review Contributions by: Willies Ogola
create_ap
This script creates a NATed or Bridged WiFi Access Point.
- Create an AP (Access Point) at any channel.
- Choose one of the following encryptions: WPA, WPA2, WPA/WPA2, Open (no encryption).
- Hide your SSID.
- Disable communication between clients (client isolation).
- IEEE 802.11n & 802.11ac support
- Internet sharing methods: NATed or Bridged or None (no Internet sharing).
- Choose the AP Gateway IP (only for ‘NATed’ and ‘None’ Internet sharing methods).
- You can create an AP with the same interface you are getting your Internet connection.
- You can pass your SSID and password through pipe or through arguments (see examples).
create_ap Help
-h, --help Show this help --version Print version number -c Channel number (default: 1) -w Use 1 for WPA, use 2 for WPA2, use 1+2 for both (default: 1+2) -n Disable Internet sharing (if you use this, don't pass the argument) -m Method for Internet sharing. Use: 'nat' for NAT (default) 'bridge' for bridging 'none' for no Internet sharing (equivalent to -n) --psk Use 64 hex digits pre-shared-key instead of passphrase --hidden Make the Access Point hidden (do not broadcast the SSID) --mac-filter Enable MAC address filtering --mac-filter-accept Location of MAC address filter list (defaults to /etc/hostapd/hostapd.accept) --redirect-to-localhost If -n is set, redirect every web request to localhost (useful for public information networks) --hostapd-debug With level between 1 and 2, passes arguments -d or -dd to hostapd for debugging. --isolate-clients Disable communication between clients --ieee80211n Enable IEEE 802.11n (HT) --ieee80211ac Enable IEEE 802.11ac (VHT) --ht_capab HT capabilities (default: [HT40+]) --vht_capab VHT capabilities --country Set two-letter country code for regularity (example: US) --freq-band Set frequency band. Valid inputs: 2.4, 5 (default: 2.4) --driver Choose your WiFi adapter driver (default: nl80211) --no-virt Do not create virtual interface --no-haveged Do not run 'haveged' automatically when needed --fix-unmanaged If NetworkManager shows your interface as unmanaged after you close create_ap, then use this option to switch your interface back to managed --mac Set MAC address --dhcp-dns Set DNS returned by DHCP --daemon Run create_ap in the background --stop Send stop command to an already running create_ap. For an you can put the PID of create_ap or the WiFi interface. You can get them with --list-running --list-running Show the create_ap processes that are already running --list-clients List the clients connected to create_ap instance associated with . For an you can put the PID of create_ap or the WiFi interface. If virtual WiFi interface was created, then use that one. You can get them with --list-running --mkconfig Store configs in conf_file --config Load configs from conf_file Non-Bridging Options: --no-dns Disable dnsmasq DNS server -g IPv4 Gateway for the Access Point (default: 192.168.12.1) -d DNS server will take into account /etc/hosts -e DNS server will take into account additional hosts file
- If you’re not using the —no-virt option, then you can create an AP with the same interface you are getting your Internet connection.
- You can pass your SSID and password through pipe or through arguments (see examples).
- On bridge method if the is not a bridge interface, then a bridge interface is created automatically.
create_ap Usage Example
Create AP named MyAccessPoint on the wireless interface wlan0, Internet sharing from the interface eth0:
sudo create_ap wlan0 eth0 MyAccessPoint
How to install create_ap
Installation on Kali Linux.
sudo apt-get install haveged hostapd git util-linux procps iproute2 iw dnsmasq iptables git clone https://github.com/oblique/create_ap cd create_ap sudo make install cd .. && rm -rf create_ap
Installation on BlackArch
sudo pacman -S create_ap haveged hostapd util-linux procps iproute2 iw dnsmasq iptables --needed
Installation on Linux (Debian, Mint, Ubuntu)
sudo apt-get install haveged hostapd git util-linux procps iproute2 iw dnsmasq iptables git clone https://github.com/oblique/create_ap cd create_ap sudo make install cd .. && rm -rf create_ap
Installation on Gentoo
emerge layman layman -f -a jorgicio emerge net-wireless/create_ap
create_ap Screenshots