October 13, 2015

Creating A Wifi Hotspot

Wifi connections have become the fancied method to connect to the internet for their versatility and many applications on the road. You can create a wifi hotspot on most modern devices and use them for internet connection with your smartphone, iPhone, Samsung and various android gadgets. However, creating a hotspot can present different levels of difficulty. For instance, using open SUSE has often caused problems for many. Fortunately, it is not an overwhelming task and following a few basic procedures will help you create a hotspot which you can use with your laptop or mobile device. Here is how to create a wifi hotspot on openSUSE Linux for use with a mobile device such as iPhone, Samsung and android.

large image standard

What is needed?

In order to create a wifi hotspot on openSUSE which you can then share with your wifi-enabled device, you need to perform a couple of procedures to ensure you have all the requirements. Creating wifi hotspot on Linux machine requires the following at its basic;

  • Switch the wifi card to AP (master) mode – This is basically needed to make the AP secure and can only be achieved by running the hosapd with WPA2-PSK Auth or above.
  • Ensure your host is a NAT (Network address translation) -enabled router – this requires some form of coding. Simply use - iptables -t nat -A POSTROUTING -s INPUT_CIDR -o OUTPUT_INTERFACE -j SNAT --to YOUR_PUBLIC_IP and sysctl net.ipv4.ip_forward=1; - to make the host NAT-enabled.
  • You need a DHCP server and a DNS forwarder – You can always use dnsmasq which will do both.

Creating a hotspot in Linux based system may require a bash of scripts which will seem ambiguous to people with no scripting knowledge. However, they are simple codes that can be found online and added to given files and lines of codes then run for smooth internet connectivity. Hostapd is the small daemon that helps you create a hotspot on Linux. It creates a virtual NAT table between your device and the internet using tables from Linux.

Creating the hotspot

You will need dnsmasq which is often pre-installed (on most Linux distributions). You will also need hostapd for AP provisioning. You must first install hostapd before hotspotd which is done by running commands;
sudo apt-get install hostapd for Ubuntu based terminals and yum install hostapd for RHEL based distros.
It only takes 2-3 seconds to install hotspotd. After installing hostapd, the remaining step is to install hotspot app. Download hotspotd package from the wget command and uncompress the zip to extract the tar file;(tar xvf hotspotd-0.1.tar.gz cd hotspotd-0.1/)

The setup command is sudo python setup.py install which should allow you to install hotspotd safely. To use the hotspot, you will be required to set SSID values and password among other basic requirements. Start the hotspotd by running (sudo hotspotd start) and stop it using (sudo hotspotd stop).

Troubleshooting the network

In order to enjoy seamless internet connectivity and sharing with other wifi enabled devices, there are a few other things to be done. The first thing is to make sure that you have installed all dependencies paying keen attention to dnsmasq, hostapd and python 2.7. Hotspotd will create the virtual NAT by manipulating Linux iptables rules. This means any other program that manipulated these tables (iptables) will create problems with the network. If any software (such as fedora firewalld) that manipulates the table rules is installed, simply deactivate it or disable it completely. You must also ensure the wifi supports AP mode otherwise the connection will not be successful. Find the kernel driver module that is currently in use by giving the following command;

:lspci -k | grep -A 3 -i network(example module: ath9k)

Next, find your wifi capabilities using the following command;:modinfo ath9k | grep depend
The command simply replaces the ath9k on your kernel driver. If you see an output that includes "mac80211" after running the given command, is should be a good sign that shows your wifi card will now support AP mode.

Conclusion

Creating a wifi hotspot on SUSE is definitely more involving when compared to Windows systems. However, most of the commands needed are already provided in the installation packages that you will download and once everything is set up, the network will be effortlessly shared with any wifi-enabled device including your Samsung smartphones and iPhone. It may be necessary to find a video tutorial that illustrates all the steps.

Click Here!