Hostapd to share eth0 connetion
Hardware Requirements
iw list
Look at the section:
software interface modes:
* AP/VLAN
* monitor
Slackware Packages
- dnsmasq
- iptables
- wireless-tools
- iw
- hostapd
Install Hostapd: https://slackbuilds.org/repository/14.2/network/hostapd/
Create or Change the Scripts file as ROOT (#):
vi /home/thiago/makeHotspot.sh
#! /bin/sh
IPTABLES=/usr/sbin/iptables
EXTIF="eth0"
INTIF="wlan0"
ifconfig $INTIF up 192.168.0.1 netmask 255.255.255.0
dnsmasq
echo "1" > /proc/sys/net/ipv4/ip_forward
$IPTABLES -F nat
$IPTABLES -F FORWARD
$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
if [ "$1" != "" ]; then
echo
echo ">>>> Anyone <<<"
echo
/usr/sbin/hostapd /etc/hostapd/hostapd_any.conf
else
echo
echo ">>>> Private <<<"
echo
/usr/sbin/hostapd /etc/hostapd/hostapd.conf
fi
Save!
Change or add...
vi /etc/hostapd/hostapd.conf
interface=wlan0
ssid=HotSlck
wpa=3
wpa_psk_file=/etc/hostapd/hostapd.wpa_psk
wpa_key_mgmt=WPA-PSK WPA-PSK-SHA256 WPA-EAP
wpa_pairwise=TKIP
rsn_pairwise=CCMP
wpa_group_rekey=600
wpa_gmk_rekey=86400
wpa_ptk_rekey=600
Save!
In this file put all MAC and the "wifi" password
vi /etc/hostapd/hostapd.wpa_psk
2b:ad:a2:16:bc:32 slackware14.2
Save!
vi /etc/hostapd/hostapd_any.conf
interface=wlan0
ssid=HotSlck
wpa=3
wpa_psk_file=/etc/hostapd/hostapd_any.wpa_psk
wpa_key_mgmt=WPA-PSK WPA-PSK-SHA256 WPA-EAP
wpa_pairwise=TKIP
rsn_pairwise=CCMP
wpa_group_rekey=600
wpa_gmk_rekey=86400
wpa_ptk_rekey=600
Save!
In this file put the "wifi" password.
vi /etc/hostapd/hostapd_any.wpa_psk
00:00:00:00:00:00 slackware14.2
Save!
This file define the wlan ip range.
vi /etc/dnsmaq.conf
interface=wlan0
dhcp-range=192.168.0.10,192.168.0.200,12h
Save!
chmod +x /home/thiago/makeHotspot.sh
To run:
#./home/thiago/makeHotspot.sh
Font: Docs.Slackware, SlackBuilds.org
Hello prof. Thiago, algo has the scripts "Create_APP". Take a look
ReplyDeletehttps://github.com/oblique/create_ap