pastebin - collaborative debugging tool
pi.kpaste.net RSS

Difference between
modified post 8e46b by Anonymous on Sun 4th Nov 2018 23:55
original post f47d7713 by Anonymous on Tue 3rd Apr 2018 23:43
Download diff
Show old version | new version | both versions

    
1-
#!/bin/bash
1+
echo raspian 9 debian 9
2+
echo notes are taken from
3+
echo http://www.raspberryconnect.com/network/item/333-raspberry-pi-hotspot-access-point-dhcpcd-method
3-
mkdir -p /home/pi/restore_etc
5+
sudo apt-get update
6+
sudo apt-get upgrade
7+
sudo apt-get install joe -y
8+
sudo apt-get install hostapd -y
9+
sudo apt-get install dnsmasq -y
5-
cp /etc/dhcp/dhcpd.conf /home/pi/restore_etc
11+
dpkg -s dnsmasq
6-
cp /etc/default/isc-dhcp-server /home/pi/restore_etc
12+
echo if version < 2.77
7-
cp /etc/network/interfaces /home/pi/restore_etc
13+
echo sudo apt-get purge dns-root-data -y
8-
cp /etc/init.d/hostapd /home/pi/restore_etc
9-
cp /etc/default/hostapd /home/pi/restore_etc/etc.default.hostapd
10-
cp /etc/sysctl.conf /home/pi/restore_etc
15+
cat >>/etc/hostapd/hostapd.conf <<EOF
13-
sudo apt-get update
16+
interface=wlan0
14-
sudo apt-get install hostapd isc-dhcp-server -y
17+
driver=nl80211
15-
sudo sed -i '/domain-name-servers ns1.example.org/s/^/#/g' /etc/dhcp/dhcpd.conf
18+
ssid=RPiHotSpot
16-
sudo sed -i '/domain-name \"example.org\";/s/^/#/g' /etc/dhcp/dhcpd.conf
19+
hw_mode=g
17-
sudo sed -i '/authoritative;/s/^#//g' /etc/dhcp/dhcpd.conf
20+
channel=6
18-
cat >>/etc/dhcp/dhcpd.conf <<EOF
21+
wmm_enabled=0
19-
subnet 192.168.99.0 netmask 255.255.255.0 {
22+
macaddr_acl=0
20-
    range 192.168.99.100 192.168.99.150;
23+
auth_algs=1
21-
    option broadcast-address 192.168.99.255;
24+
ignore_broadcast_ssid=0
22-
    option routers 192.168.99.1;
25+
wpa=2
23-
    default-lease-time 600;
26+
wpa_passphrase=raspberry
24-
    max-lease-time 7200;
27+
wpa_key_mgmt=WPA-PSK
25-
    option domain-name "local";
28+
wpa_pairwise=TKIP
26-
    option domain-name-servers 8.8.8.8, 8.8.4.4;
29+
rsn_pairwise=CCMP
27-
}
2830
EOF
30-
sed -i '/INTERFACES=\"\"/c\INTERFACES=\"wlan0\"' /etc/default/isc-dhcp-server
32+
cat /etc/default/hostapd
33+
echo "-----"
34+
#DAEMON_OPTS=""
35+
cat >> /etc/default/hostapd <<EOF
36+
DAEMON_CONF="/etc/hostapd/hostapd.conf"
37+
EOF
38+
echo "-----"
39+
cat /etc/default/hostapd
32-
sudo sed -i '/iface wlan0 inet manual/s/^/#/g' /etc/network/interfaces
33-
sudo sed -i '/wpa_supplicant.conf/s/^/#/g' /etc/network/interfaces
34-
cat >>/etc/network/interfaces <<EOF
35-
iface wlan0 inet static
36-
  address 192.168.99.1
37-
  netmask 255.255.255.0
38-
  post-up iw dev $IFACE set power_save off
39-
EOF
41-
cat >>/etc/hostapd/hostapd.conf <<EOF
43+
cat >> /etc/dnsmasq.conf <<EOF
45+
#RPiHotspot config - No Intenet
4246
interface=wlan0
43-
ssid=WiPi
47+
domain-needed
44-
hw_mode=g
48+
bogus-priv
45-
channel=6
49+
dhcp-range=192.168.99.150,192.168.99.200,255.255.255.0,12h
46-
macaddr_acl=0
47-
auth_algs=1
48-
ignore_broadcast_ssid=0
49-
wpa=2
50-
wpa_passphrase=raspberry
51-
wpa_key_mgmt=WPA-PSK
52-
wpa_pairwise=TKIP
53-
rsn_pairwise=CCMP
5450
EOF
56-
echo "net.ipv4.ip_forward=1" >>/etc/sysctl.conf
58-
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
53+
cat >>/etc/dhcpcd.conf <<EOF
60-
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
55+
nohook wpa_supplicant
61-
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
56+
interface wlan0
62-
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
57+
static ip_address=192.168.99.1/24
63-
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
58+
static routers=192.168.50.1
59+
EOF
65-
echo "up iptables-restore < /etc/iptables.ipv4.nat" >>/etc/network/interfaces
67-
sed -i '/DAEMON_CONF=/c\DAEMON_CONF=/etc/hostapd/hostapd.conf' /etc/init.d/hostapd
62+
cat >> /etc/sysctl.conf <<EOF
68-
sed -i '/#DAEMON_CONF=\"\"/c\DAEMON_CONF=\"/etc/hostapd/hostapd.conf\"' /etc/default/hostapd
70-
sudo update-rc.d hostapd enable
64+
net.ipv4.ip_forward=1
71-
sudo update-rc.d isc-dhcp-server enable
65+
EOF
68+
echo USB automount
69+
sudo apt-get install usbmount -y
70+
sed -i 's/MountFlags=slave/MountFlags=shared/g' /lib/systemd/system/systemd-udevd.service
72+
echo fish://pi@192.168.99.1:/home/pi/

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}





All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at