Using build in Linux Wireless we only can share Wireless to PC/Laptop but this will not work for Mobile Phone (iPad, Android, iPhone, and Windows Phone), in Windows there’re mhotspot that can doing this with 2 click and we’re ready as Wifi Hotspot. There’re no Linux version of mhotspot, as alternative with we have hostapd.

Instalation

Download hostapd from their website located on http://hostap.epitest.fi/hostapd/ if you prefer and the latest version of hostapd. But here I’ll only cover instalation directly from Fedora repository.
Open terminal, log in as root and execute command below

yum install hostapd iptables -y

To add automatic IP for each client, we will using DHCP

yum install dhcp -y

Configuration

hostapd

hostapd file configuration located at /etc/hostapd/hostapd.conf, we’ll change this value as below, remove all line on hostapd.conf on put code below to hostapd.conf

interface=wlan0
driver=nl80211
ssid=sentabispot
hw_mode=g
channel=11
wpa=1
wpa_passphrase=yoursecurepassword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_ptk_rekey=600

change ssid AP and wpa_passphrase to your own password and Access Point (AP) name, value above just for example.

DHCP

Edit /etc/dhcp/dhcpd.conf and change value to

#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#   see dhcpd.conf(5) man page
#
subnet 10.10.0.0 netmask 255.255.255.0 {
        range 10.10.0.25 10.10.0.50;
        option domain-name-servers 8.8.4.4, 208.67.222.222;
        option routers 10.10.0.1;
}

after finishing step above, now execute command below from terminal

ifconfig wlan0 10.10.0.1 netmask 255.255.255.0 up
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o p5p1 -j MASQUERADE
systemctl restart dhcpd.service
hostapd -dd /etc/hostapd/hostapd.conf

please execute command above step by step or Access Point won’t work. We can put command above as bash script

#!/usr/bin/bash
# hotspot.sh
ifconfig wlan0 10.10.0.1 netmask 255.255.255.0 up
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o p5p1 -j MASQUERADE
systemctl restart dhcpd.service
hostapd -dd /etc/hostapd/hostapd.conf

make script executable

chmod +x hotspot.sh

then run script

./hotspot.sh

hostapd on fedora

Tagged on:     

10 thoughts on “Sharing Wireless Using Hostapd on Fedora 17

  • September 17, 2012 at 00:54
    Permalink

    Thanks so much, works like a charme!
    Sometimes Fedora might be tricky :-)
    But, it only works by typing commands, not with the script… weird!
    Anyway ^^

    Reply
  • January 11, 2013 at 11:41
    Permalink

    Hi. I’m trying to setup the Hostapd on Fedora 16 and it returns error after the last command “# hostapd -dd /etc/hostapd/hostapd.conf”.
    The error is:
    nl80211: Register Action command failed: ret=-114 (Operation already in progress)
    nl80211: Register Action match – hexdump(len=1): 06
    nl80211: Failed to register Action frame processing – ignore for now
    nl80211: Add own interface ifindex 3
    nl80211: Failed to set interface 3 to mode 3: -95 (Operation not supported)
    nl80211: Failed to set interface 3 to mode 3: -95 (Operation not supported)
    nl80211: Interface mode change to 3 from 0 failed
    nl80211: Failed to set interface wlan0 into AP mode
    nl80211 driver initialization failed.
    ELOOP: remaining socket: sock=4 eloop_data=0x1e490d0 user_data=0x1e497f0 handler=0x42c9b0
    ELOOP: remaining socket: sock=6 eloop_data=0x1e4bdd0 user_data=(nil) handler=0×435810

    I don’t get what is wrong. Could it be that my Intel wireless card isn’t supported?
    Could you please help me?

    Reply
    • January 25, 2013 at 14:49
      Permalink

      do you run these command with root privileges ?

      Reply
  • March 17, 2013 at 20:27
    Permalink

    Man… You don’t even know how much I’ve been serching for this information. Thank you very much!

    Reply
  • March 18, 2013 at 00:45
    Permalink

    It’s ok, but how can I bridge this hotspot to lan card to provide internet through it?

    Reply
    • March 19, 2013 at 14:02
      Permalink

      from LAN card to your network ? or from lan to wireless network?

      Reply
      • March 20, 2013 at 00:39
        Permalink

        Yep. I have the same problem. Other laptop has connected to newly created WiFi spot, but cannot acces the Internet.

        Reply
  • May 27, 2013 at 21:38
    Permalink

    I get an error while running the last command.

    [root@MrDHat]/home/mrdhat# hostapd -dd /etc/hostapd/hostapd.conf
    Configuration file: /etc/hostapd/hostapd.conf
    nl80211: Register Action command failed: ret=-114 (Operation already in progress)
    nl80211: Register Action match – hexdump(len=1): 06
    nl80211: Failed to register Action frame processing – ignore for now
    nl80211: Add own interface ifindex 3
    nl80211: Failed to set interface 3 to mode 3: -95 (Operation not supported)
    nl80211: Failed to set interface 3 to mode 3: -95 (Operation not supported)
    nl80211: Interface mode change to 3 from 0 failed
    nl80211: Failed to set interface wlan0 into AP mode
    nl80211 driver initialization failed.
    ELOOP: remaining socket: sock=4 eloop_data=0x102b0d0 user_data=0x102b7f0 handler=0x42c460
    ELOOP: remaining socket: sock=6 eloop_data=0x102de80 user_data=(nil) handler=0×435800

    Reply
  • May 28, 2013 at 10:40
    Permalink

    please make sure your wireless not connect to WIFI AP

    Reply
  • November 10, 2013 at 18:00
    Permalink

    Hi,
    Thanks for the tutorial. I’m on Fedora 18 and using dhcpd 4.2.5 . I had to insert a “sleep 1″ line after “systemctl restart dhcpd.service” in order to make the client device connect to the hotspot.

    Thank you!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>