Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a Sony Vaio notebook with WiFi, and need to setup a hotspot (an ad-hoc one) under Fedora 20.

I successfully did it under Debian and SuSE, but under Fedora I am struggling to understand the basis of the system or something.

I found two ways to configure a hotspot:

  1. dhcp + hostapd
  2. dnsmasq + hostapd

Dnsmasq-way doesn't work for me - something errors and Android cannot see my new network.

dhcp-way almost works - Android connects to the network, I have new IP, but something is wrong with dns resolve or masquerading, I don't know what. Android shows me a white WiFi icon and can't connect to the internet after a request timeout expires (to play.google for example).

My wifi interface is wlp7s0

My internet connection is p5p1

Below I show my config and dhcp-way scripts.

# cat /etc/dhcp/dhcpd.conf
subnet 192.168.0.0 netmask 255.255.255.0 {
        range 192.168.0.2 192.168.0.30;
        option subnet-mask 255.255.255.0;
        option domain-name-servers 8.8.4.4, 8.8.8.8;
        option routers 192.168.0.1;
}


# cat /etc/hostapd/hostapd.conf
ctrl_interface=/var/run/hostapd
ctrl_interface_group=wheel
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
# WPA & WPA2 support with a pre-shared key
wpa=3
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
# WPA passphrase
wpa_passphrase=MYCOOLPASS
driver=nl80211
interface=wlp7s0
hw_mode=g
channel=11
ssid=NETNAME

Script to start hotspot (in manual mode):

systemctl stop NetworkManager.service
service dhcpd stop
service hostapd stop

sleep 1

ifconfig wlp7s0 192.168.0.1 netmask 255.255.255.0 up
sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o p5p1 -j MASQUERADE

sleep 1

service dhcpd start
service hostapd start

Any advice on how to get this to work?

share|improve this question

4 Answers 4

First, I try to remember - what is difference in security of Fedora..

One of this is "firewalld".

sudo firewall-cmd --list-all-zones

show me on external interface "masquerade: no" after all my commands, include:

sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o p5p1 -j MASQUERADE

So I try to disable firewall before run my script again:

systemctl stop firewalld.service

And wu-a-lya! Hotspot is work!! :)))

May be I try to setup masquerading firewalld instead iptables.. See on..

share|improve this answer

And nooooww... Final version of my script:

systemctl stop NetworkManager.service
service dhcpd stop
service hostapd stop

sleep 1

ifconfig wlp7s0 192.168.0.1 netmask 255.255.255.0 up

# REPLACED BY NEW FIREWALL COMMAND BELOW
# sysctl net.ipv4.ip_forward=1
# iptables -t nat -A POSTROUTING -o p5p1 -j MASQUERADE

firewall-cmd --add-masquerade  # <-- Yes! It is this! :)

sleep 1

service dhcpd start
service hostapd start

As I speak early, source of my problem was single string instead old two:

firewall-cmd --add-masquerade
share|improve this answer

The NetworkManager can be used to set up a hot spot.
Additional to setup hostapd (with driver=none) and dhcpd, you need to setup a wireless connection with an IP from DHCP range (that will be also the gateway), mode: "access point" (and with the matched settings from hostapd.conf - wireless type and band)
the starting sequence:

sysctl net.ipv4.ip_forward=1  
nmcli connection up hotspot  
sleep 3  

systemctl start dhcpd.service  
systemctl start hostapd.service  
iptables -t nat -A POSTROUTING -o em1 -j MASQUERADE  

the stop sequence:  
nmcli connection down hotspot  
sleep 3  

sysctl net.ipv4.ip_forward=0  
systemctl stop dhcpd.service  
systemctl stop hostapd.service  
iptables -t nat -F  
share|improve this answer

One important step is you have to remove the WLAN device from NetworkManager to let the hostap manage its.

More details at here: https://bugzilla.redhat.com/show_bug.cgi?id=985041#c8

share|improve this answer
    
What is a "hostap"? –  Anthon Jul 26 at 6:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.