X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=bin%2FstartHostapd.sh;fp=bin%2FstartHostapd.sh;h=510ba47e72c6ec2f685057a353c308a01b4c0373;hb=85cef43f457f743edbf30fa50a877a1a9e697eed;hp=0000000000000000000000000000000000000000;hpb=6515e998b7be0db4b699d119ceaad4bfa11d405e;p=dotfiles.git diff --git a/bin/startHostapd.sh b/bin/startHostapd.sh new file mode 100755 index 0000000..510ba47 --- /dev/null +++ b/bin/startHostapd.sh @@ -0,0 +1,20 @@ +#!/bin/bash -xe + +# This tool is to enable Hotspot mode on Raspberry Pi +# Refer https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md#internet-sharing + +# disable WiFi connection +wpa_cli -i wlan0 disable_network 0 || true + +# Stop dhcp cliennt, will start it with static IP and no wpa_supplicant +systemctl stop dhcpcd || true +killall dhcpcd || true + +# start Hostapd mode +systemctl start hostapd + +# start dhcp client with static IP +dhcpcd --static ip_address=192.168.4.1/24 --nohook wpa_supplicant wlan0 + +# start dnsmasq, dns server with IP reanges +dnsmasq --interface=wlan0 --dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h