-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake_ap_wifi
47 lines (35 loc) · 1.28 KB
/
make_ap_wifi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
#this is used to make the Pi have wifi connection, so you can connect to it
#you can change the files to put different names and passwords to it
#this will also make a copy of the original files, just in case.
#if you run it twice the real original files will be lost, so
#reallocate them before doing so
#run this as sudo
echo "installing the packages needed"
apt-get update
apt-get install hostapd isc-dhcp-server
mkdir -p originals
echo "starting dhcpd and configuring it"
dhcpd
cp /etc/dhcp/dhcpd.conf originals/dhcpd.conf
cp dhcpd.conf /etc/dhcp/dhcpd.conf
cp /etc/default/isc-dhcp-server originals/isc-dhcp-server
cp isc-dhcp-server /etc/default/isc-dhcp-server
echo "trying to stop wlan0, might be stopped already"
ifdown wlan0
echo "configuring interfaces"
cp /etc/network/interfaces originals/interfaces
cp interfaces /etc/network/interfaces
echo "static ip on wlan0"
ifconfig wlan0 192.168.42.1
echo "starting hostapd"
hostapd
echo "configuring hostapd.conf"
cp /etc/hostapd/hostapd.conf originals/hostapd.conf
cp hostapd.conf /etc/hostapd/hostapd.conf
echo "configuring hostapd"
cp /etc/default/hostapd originals/hostapd
cp hostapd /etc/default/hostapd
echo "configuring sysctl.conf"
cp /etc/sysctl.conf originals/sysctl.conf
cp sysctl.conf /etc/sysctl.conf