Note that this does not consider sharing internet with the devices yet.
Prerequisites
Packages Required- hostapd
- dnsmasq
- iw
First off, make sure you know which interface/card you are using. This can
be done using a combination of ip link
and lspci -v
.
I'll be using wlp4s0
throughout.
Now make sure you're interface supports AP mode. This can be seen using
iw list
. Under "Supported interface modes:", "AP" should be
listed.
Setting up hostapd
Here is a configuration which sets up WPA2 - you'll need to edit the password, ssid, interface, and possibly country code.
# /usr/share/doc/hostapd/hostapd.conf # http://wireless.kernel.org/en/users/Documentation/hostapd ctrl_interface=/var/run/hostapd ctrl_interface_group=wheel # Some usable default settings... macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 # WPA2 with preshared key (passphrase). wpa=2 wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP # TODO wpa_passphrase= # Most modern wireless drivers in the kernel need driver=nl80211 driver=nl80211 # Customize these for your local configuration... interface=wlp4s0 hw_mode=g channel=1 country_code=US ssid=TODO
Setting up dnsmasq
In `/etc/dnsmasq.conf`, add the line
interface=wlp4s0and
dhcp-range=10.0.0.2,10.0.0.5,12hAdjust the second entry in the range if you plan on hosting more than three devices.
Putting it all together
- Mark your interface as the router:
ip addr add 10.0.0.1/24 dev wlp4s0
. - Start dnsmasq:
systemctl start dnsmasq
- Start hostapd:
systemctl start hostapd
Gotchas
On Fedora, selinux can cause some pain.
As per https://bugzilla.redhat.com/show_bug.cgi?id=1891152,
do the following if you encounter AVC denials for comm="hostapd"
in journalctl -xe
.
- ausearch -c 'hostapd' --raw | audit2allow -M my-hostapd
- semanage -i my-hostapd.pp