Skip to content

Instantly share code, notes, and snippets.

@venkateshshukla
Last active January 25, 2021 12:35
Show Gist options
  • Save venkateshshukla/9744327 to your computer and use it in GitHub Desktop.
Save venkateshshukla/9744327 to your computer and use it in GitHub Desktop.
Make a access point hotspot in Fedora
#!/bin/bash
#Initial wifi interface configuration
ifconfig wlp8s0 up 10.20.30.1 netmask 255.255.255.0
sleep 2
###########Start dnsmasq, modify if required##########
if [ -z "$(ps -e | grep dnsmasq)" ] then
dnsmasq
fi
###########
#Enable NAT
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat --append POSTROUTING --out-interface tun0 -j MASQUERADE
iptables --append FORWARD --in-interface wlp8s0 -j ACCEPT
#iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
sysctl -w net.ipv4.ip_forward=1
#start hostapd
echo Starting hotspot.
hostapd /etc/hostapd/hostapd-minimal.conf 1> /dev/null
killall dnsmasq
echo Hotspot Closed
#disables dnsmasq reading any other files like /etc/resolv.conf for nameservers
no-resolv
# Interface to bind to
interface=wlp8s0
# Specify starting_range,end_range,lease_time
dhcp-range=10.20.30.3,10.20.30.5,12h
# dns addresses to send to the clients
server=8.8.8.8
conf-dir=/etc/dnsmasq.d
#change wlan0 to your wireless device
interface=wlp8s0
driver=nl80211
ssid=VenkateshFedora
channel=3
hw_mode=g
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=FedoraAwesome
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment