Fedora 20 – wifi hotspot almost work but something wrong

dhcpfedorawifi

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?

Best 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
Related Question