Wifi Host AP with Slackware Linux

Requirements

check for compatible drivers as defined at http://w1.fi/hostapd/

lsmod | grep mac80211

what Wi-Fi standards is the device able to talk? (we are gonna use G anyhow, not sure other standards are supported)

lshw -c network | egrep 'product|802.11'

Install

Slackware

slackpkg search hostapd dhcp

Debian/Ubuntu

apt install hostapd isc-dhcp-server

Setup

cp -pi /usr/share/doc/hostapd/examples/hostapd.conf /etc/hostapd/hostapd.conf.dist
grep -vE '^[[:space:]]*#|^[[:space:]]*$' /etc/hostapd/hostapd.conf.dist > /etc/hostapd/hostapd.conf.dist.clean
grep -vE '^[[:space:]]*#|^[[:space:]]*$' /etc/hostapd/hostapd.conf.dist > /etc/hostapd/hostapd.conf
vi /etc/hostapd/hostapd.conf

...
ssid=as7lab
hw_mode=g
channel=11
...

wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
wpa_passphrase=12345678

#driver=nl80211

Ready to go

tail -n0 -F /var/log/*

Slackware

/etc/rc.d/rc.hostapd stop
/etc/rc.d/rc.hostapd start

Debian/Ubuntu

systemctl unmask hostapd
systemctl start hostapd
systemctl status hostapd

you can now set up the network for that purpose.

NAT

Set up an IP for that AP service

ifconfig wlan0 10.22.22.254/24 up

or at startup on Debian or Ubuntu w/o netplan

vi /etc/network/interfaces

auto wlan0
    iface wlan0 inet static
    address 10.22.22.254/24
    dns-search as7lab.lan
    dns-nameservers x.x.x.x x.x.x.x
    #dns-nameservers 208.67.222.222 208.67.220.220

enable forwarding and proceed

sysctl -w net.ipv4.ip_forward=1

with iptables

iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

with nftables

table ip nat {
        chain postrouting {
                type nat hook postrouting priority srcnat;
                ip saddr 10.22.22.0/24 oif ppp0 masquerade
        }
}

DHCP

# slackware
mv -i /etc/dhcpd.conf /etc/dhcpd.conf.dist
vi /etc/dhcpd.conf

# debian/ubuntu
mv -i /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.dist
vi /etc/dhcp/dhcpd.conf

#option domain-name "as7lab.lan";
option domain-search "as7lab.lan";
option domain-name-servers x.x.x.x, x.x.x.x;
#option domain-name-servers 208.67.222.222, 208.67.220.220;

default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;

subnet 10.22.22.0 netmask 255.255.255.0 {
        range 10.22.22.100 10.22.22.199;
        option subnet-mask 255.255.255.0;
        option routers 10.22.22.254;
}

Slackware

pkill dhcpd
dhcpd -q wlan0

Debian/Ubuntu

vi /etc/default/isc-dhcp-server

INTERFACESv4="wlan0"
INTERFACESv6=""

systemctl restart isc-dhcp-server
systemctl stop isc-dhcp-server6
systemctl disable isc-dhcp-server6

HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | NU | HTML5
Copyright © 2022 Pierre-Philipp Braun