Laptop Hotspot (noch fehlerhaft)
enp0s29u1u3 is the laptop's internet source
wlp2s0b1 is the interface for the wireless network card
to see connected clients run iw dev wlp2s0b1 station dump | grep Station
SetupWiFi.sh
#!/bin/bash
apt-get install -y hostapd dnsmasq wireless-tools iw wvdial
sed -i 's#^DAEMON_CONF=.*#DAEMON_CONF=/etc/hostapd/hostapd.conf#' /etc/init.d/hostapd
cat < /etc/dnsmasq.conf
log-facility=/var/log/dnsmasq.log
#address=/#/10.0.0.1
#address=/google.com/10.0.0.1
interface=wlp2s0b1
dhcp-range=10.0.0.10,10.0.0.250,12h
dhcp-option=3,10.0.0.1
dhcp-option=6,10.0.0.1
#no-resolv
log-queries
EOF
service dnsmasq start
ifconfig wlp2s0b1 up
ifconfig wlp2s0b1 10.0.0.1/24
iptables -t nat -F
iptables -F
iptables -t nat -A POSTROUTING -o enp0s29u1u3 -j MASQUERADE
iptables -A FORWARD -i wlp2s0b1 -o enp0s29u1u3 -j ACCEPT
echo '1' > /proc/sys/net/ipv4/ip_forward
cat < /etc/hostapd/hostapd.conf
interface=wlp2s0b1
driver=nl80211
channel=1
ssid=Wifi
wpa=2
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
# Change the broadcasted/multicasted keys after this many seconds.
wpa_group_rekey=600
# Change the master key after this many seconds. Master key is used as a basis
wpa_gmk_rekey=86400
EOF
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd
service hostapd start
StartWiFi.sh
#!/bin/bash
service hostapd start
service dnsmasq start
nmcli device set ifname wlp2s0b1 managed no
systemctl restart network-manager
StopWiFi.sh
#!/bin/bash
service hostapd stop
service dnsmasq stop