├── README.md ├── config-files ├── hostapd ├── hostapd-adafruit.conf ├── hostapd.conf ├── interfaces ├── interfaces-template ├── iptables-chromecast ├── iptables.ipv4.nat ├── sysctl.conf ├── udhcpd ├── udhcpd.service ├── udhcpd_google.conf ├── udhcpd_opendns.conf ├── udhcpd_template.conf └── udhcpd_unblockus.conf ├── contrib ├── pifi-keypair └── pifi-update ├── hostapd-adafruit └── install /README.md: -------------------------------------------------------------------------------- 1 | RPI-Wireless-Hotspot 2 | ==================== 3 | 4 | Configures your Raspberry Pi with an attatched WiFi dongle or a Raspberry Pi3 with built in WiFi as a hotspot, 5 | broadcasting your ethernet connection to other devices. Could be useful in hotel rooms, college dorms 6 | or if you just don't feel like buying a router! 7 | 8 | 9 | Features: 10 | --------- 11 | * Hotspot automatically starts on boot without extra configuration. 12 | 13 | * Configured WiFi network uses WPA encryption. 14 | 15 | * The default SSID is "RaspberryPiFi" and the WPA key is "0123456789A," which can be changed during installation. 16 | 17 | * Pi's local network functions continue to operate normally after setup. 18 | 19 | * Easy setup of custom or preconfigured DNS server, including unblock-us for bypassing Netflix geoblocks. 20 | 21 | * Router enumeration for WiFi network. 22 | 23 | * Enables Chromecast compatibility with unblock-us by intercepting Google's DNS requests on the Pi. 24 | 25 | 26 | Requirements: 27 | ------------- 28 | 29 | 1. A Raspberry Pi model B or Pi3 running raspbian 30 | 31 | 2. A Raspbian compatible Wifi adapter. This script assumes that your adapter uses the nl80211 drivers in hostapd (the majority of new products should support this). Others can be made to work, but require a custom compilation of hostapd (guides are out there). 32 | 33 | 3. An active ethernet connection 34 | 35 | 36 | Installation: 37 | ------------- 38 | 39 | * In the terminal, run: 40 | `git clone https://github.com/harryallerston/RPI-Wireless-Hotspot.git` 41 | 42 | * Navigate to folder, and execute: `sudo ./install` 43 | 44 | * Confirm that you are happy for changes to be made 45 | 46 | * Choose a preconfigured DNSalternative DNS or configure a custom DNS 47 | 48 | * If you require chromecast support with unblock-us select the appropriate option 49 | 50 | * This should automatically set everything up and leave you ready to go 51 | 52 | 53 | Notes and configuration 54 | ----------------------- 55 | 56 | * To change default WiFi channel, edit /etc/hostapd/hostapd.conf accordingly. 57 | 58 | * This setup has been tested on a fresh install of raspbian. 59 | 60 | * It is advised that this be set up on a fresh install. 61 | 62 | * If set up on an existing install then any current config files will be backed up with the extension ".old" in the relevant folders prior to installation. (this allows returning to original network settings if required) 63 | 64 | -------------------------------------------------------------------------------- /config-files/hostapd: -------------------------------------------------------------------------------- 1 | # This file was installed with the RPI-Wireless-Hotspot script 2 | # For more info see https://github.com/unixabg/RPI-Wireless-Hotspot 3 | # ------------------------------------------------------------------------ 4 | # Defaults for hostapd initscript 5 | # 6 | # See /usr/share/doc/hostapd/README.Debian for information about alternative 7 | # methods of managing hostapd. 8 | # 9 | # Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration 10 | # file and hostapd will be started during system boot. An example configuration 11 | # file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz 12 | # 13 | DAEMON_CONF="/etc/hostapd/hostapd.conf" 14 | 15 | # Additional daemon options to be appended to hostapd command:- 16 | # -d show more debug messages (-dd for even more) 17 | # -K include key data in debug messages 18 | # -t include timestamps in some debug messages 19 | # 20 | # Note that -B (daemon mode) and -P (pidfile) options are automatically 21 | # configured by the init.d script and must not be added to DAEMON_OPTS. 22 | # 23 | #DAEMON_OPTS="" 24 | -------------------------------------------------------------------------------- /config-files/hostapd-adafruit.conf: -------------------------------------------------------------------------------- 1 | # This file was installed with the RPI-Wireless-Hotspot script 2 | # For more info see https://github.com/unixabg/RPI-Wireless-Hotspot 3 | # ------------------------------------------------------------------------ 4 | interface=wlan0 5 | driver=rtl871xdrv 6 | ssid=RaspberryPiFi 7 | hw_mode=g 8 | channel=8 9 | macaddr_acl=0 10 | auth_algs=1 11 | ignore_broadcast_ssid=0 12 | wpa=2 13 | wpa_passphrase=0123456789A 14 | wpa_key_mgmt=WPA-PSK 15 | wpa_pairwise=TKIP 16 | rsn_pairwise=CCMP 17 | -------------------------------------------------------------------------------- /config-files/hostapd.conf: -------------------------------------------------------------------------------- 1 | # This file was installed with the RPI-Wireless-Hotspot script 2 | # For more info see https://github.com/unixabg/RPI-Wireless-Hotspot 3 | # ------------------------------------------------------------------------ 4 | interface=wlan0 5 | driver=nl80211 #for TP-LINK TL-WN7200 6 | ssid=RaspberryPiFi 7 | hw_mode=g 8 | channel=8 9 | macaddr_acl=0 10 | auth_algs=1 11 | ignore_broadcast_ssid=0 12 | wpa=2 13 | wpa_passphrase=0123456789A 14 | wpa_key_mgmt=WPA-PSK 15 | wpa_pairwise=TKIP 16 | rsn_pairwise=CCMP 17 | -------------------------------------------------------------------------------- /config-files/interfaces: -------------------------------------------------------------------------------- 1 | # This file was installed with the RPI-Wireless-Hotspot script 2 | # For more info see https://github.com/unixabg/RPI-Wireless-Hotspot 3 | # ------------------------------------------------------------------------ 4 | auto lo 5 | 6 | iface lo inet loopback 7 | iface eth0 inet dhcp 8 | 9 | auto eth0 10 | 11 | auto wlan0 12 | 13 | iface wlan0 inet static 14 | address 192.168.42.1 15 | netmask 255.255.255.0 16 | wireless-power off 17 | 18 | up iptables-restore < /etc/iptables.ipv4.nat 19 | -------------------------------------------------------------------------------- /config-files/interfaces-template: -------------------------------------------------------------------------------- 1 | # This file was installed with the RPI-Wireless-Hotspot script 2 | # For more info see https://github.com/unixabg/RPI-Wireless-Hotspot 3 | # ------------------------------------------------------------------------ 4 | auto lo 5 | 6 | iface lo inet loopback 7 | iface eth0 inet dhcp 8 | 9 | auto eth0 10 | 11 | auto wlan0 12 | 13 | iface wlan0 inet static 14 | address 192.168.ROUTER.1 15 | netmask 255.255.255.0 16 | 17 | up iptables-restore < /etc/iptables.ipv4.nat 18 | -------------------------------------------------------------------------------- /config-files/iptables-chromecast: -------------------------------------------------------------------------------- 1 | # Generated by iptables-save v1.4.14 on Sat Dec 28 18:31:59 2013 2 | *nat 3 | :PREROUTING ACCEPT [347:35055] 4 | :INPUT ACCEPT [43:5686] 5 | :OUTPUT ACCEPT [28:2128] 6 | :POSTROUTING ACCEPT [0:0] 7 | -A PREROUTING -d 8.8.8.8/32 -j DNAT --to-destination 208.122.23.22 8 | -A PREROUTING -d 8.8.4.4/32 -j DNAT --to-destination 208.122.23.23 9 | -A POSTROUTING -o eth0 -j MASQUERADE 10 | COMMIT 11 | # Completed on Sat Dec 28 18:31:59 2013 12 | # Generated by iptables-save v1.4.14 on Sat Dec 28 18:31:59 2013 13 | *filter 14 | :INPUT ACCEPT [2324:194125] 15 | :FORWARD ACCEPT [0:0] 16 | :OUTPUT ACCEPT [1567:171572] 17 | -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT 18 | -A FORWARD -i wlan0 -o eth0 -j ACCEPT 19 | COMMIT 20 | # Completed on Sat Dec 28 18:31:59 2013 21 | -------------------------------------------------------------------------------- /config-files/iptables.ipv4.nat: -------------------------------------------------------------------------------- 1 | # This file was installed with the RPI-Wireless-Hotspot script 2 | # For more info see https://github.com/unixabg/RPI-Wireless-Hotspot 3 | # ------------------------------------------------------------------------ 4 | # Generated by iptables-save v1.4.14 on Sun Feb 24 22:48:51 2013 5 | *filter 6 | :INPUT ACCEPT [329:440868] 7 | :FORWARD ACCEPT [0:0] 8 | :OUTPUT ACCEPT [183:9684] 9 | -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT 10 | -A FORWARD -i wlan0 -o eth0 -j ACCEPT 11 | COMMIT 12 | # Completed on Sun Feb 24 22:48:51 2013 13 | # Generated by iptables-save v1.4.14 on Sun Feb 24 22:48:51 2013 14 | *nat 15 | :PREROUTING ACCEPT [8:2270] 16 | :INPUT ACCEPT [8:2270] 17 | :OUTPUT ACCEPT [6:456] 18 | :POSTROUTING ACCEPT [0:0] 19 | -A POSTROUTING -o eth0 -j MASQUERADE 20 | COMMIT 21 | # Completed on Sun Feb 24 22:48:51 2013 22 | -------------------------------------------------------------------------------- /config-files/sysctl.conf: -------------------------------------------------------------------------------- 1 | # This file was installed with the RPI-Wireless-Hotspot script 2 | # For more info see https://github.com/unixabg/RPI-Wireless-Hotspot 3 | # ------------------------------------------------------------------------ 4 | # 5 | # /etc/sysctl.conf - Configuration file for setting system variables 6 | # See /etc/sysctl.d/ for additonal system variables 7 | # See sysctl.conf (5) for information. 8 | # 9 | 10 | #kernel.domainname = example.com 11 | 12 | # Uncomment the following to stop low-level messages on console 13 | kernel.printk = 3 4 1 3 14 | 15 | ##############################################################3 16 | # Functions previously found in netbase 17 | # 18 | 19 | # Uncomment the next two lines to enable Spoof protection (reverse-path filter) 20 | # Turn on Source Address Verification in all interfaces to 21 | # prevent some spoofing attacks 22 | #net.ipv4.conf.default.rp_filter=1 23 | #net.ipv4.conf.all.rp_filter=1 24 | 25 | # Uncomment the next line to enable TCP/IP SYN cookies 26 | # See http://lwn.net/Articles/277146/ 27 | # Note: This may impact IPv6 TCP sessions too 28 | #net.ipv4.tcp_syncookies=1 29 | 30 | # Uncomment the next line to enable packet forwarding for IPv4 31 | #net.ipv4.ip_forward=1 32 | 33 | # Uncomment the next line to enable packet forwarding for IPv6 34 | # Enabling this option disables Stateless Address Autoconfiguration 35 | # based on Router Advertisements for this host 36 | #net.ipv6.conf.all.forwarding=1 37 | 38 | 39 | ################################################################### 40 | # Additional settings - these settings can improve the network 41 | # security of the host and prevent against some network attacks 42 | # including spoofing attacks and man in the middle attacks through 43 | # redirection. Some network environments, however, require that these 44 | # settings are disabled so review and enable them as needed. 45 | # 46 | # Do not accept ICMP redirects (prevent MITM attacks) 47 | #net.ipv4.conf.all.accept_redirects = 0 48 | #net.ipv6.conf.all.accept_redirects = 0 49 | # _or_ 50 | # Accept ICMP redirects only for gateways listed in our default 51 | # gateway list (enabled by default) 52 | # net.ipv4.conf.all.secure_redirects = 1 53 | # 54 | # Do not send ICMP redirects (we are not a router) 55 | #net.ipv4.conf.all.send_redirects = 0 56 | # 57 | # Do not accept IP source route packets (we are not a router) 58 | #net.ipv4.conf.all.accept_source_route = 0 59 | #net.ipv6.conf.all.accept_source_route = 0 60 | # 61 | # Log Martian Packets 62 | #net.ipv4.conf.all.log_martians = 1 63 | # 64 | 65 | # rpi tweaks 66 | vm.swappiness=1 67 | vm.min_free_kbytes = 8192 68 | 69 | net.ipv4.ip_forward=1 70 | -------------------------------------------------------------------------------- /config-files/udhcpd: -------------------------------------------------------------------------------- 1 | # This file was installed with the RPI-Wireless-Hotspot script 2 | # For more info see https://github.com/unixabg/RPI-Wireless-Hotspot 3 | # ------------------------------------------------------------------------ 4 | # Comment the following line to enable 5 | #DHCPD_ENABLED="no" 6 | 7 | DHCPD_OPTS="-S" 8 | -------------------------------------------------------------------------------- /config-files/udhcpd.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=DHCP server 3 | Wants=network-online.target 4 | After=network-online.target 5 | 6 | [Service] 7 | ExecStart=/usr/sbin/udhcpd -f -S /etc/udhcpd.conf 8 | 9 | [Install] 10 | WantedBy=multi-user.target 11 | 12 | -------------------------------------------------------------------------------- /config-files/udhcpd_google.conf: -------------------------------------------------------------------------------- 1 | # This file was installed with the RPI-Wireless-Hotspot script 2 | # For more info see https://github.com/unixabg/RPI-Wireless-Hotspot 3 | # ------------------------------------------------------------------------ 4 | start 192.168.42.2 5 | end 192.168.42.20 6 | interface wlan0 7 | remaining yes 8 | opt dns 8.8.8.8 8.8.4.4 9 | opt subnet 255.255.255.0 10 | opt router 192.168.42.1 11 | opt lease 864000 12 | -------------------------------------------------------------------------------- /config-files/udhcpd_opendns.conf: -------------------------------------------------------------------------------- 1 | # This file was installed with the RPI-Wireless-Hotspot script 2 | # For more info see https://github.com/unixabg/RPI-Wireless-Hotspot 3 | # ------------------------------------------------------------------------ 4 | start 192.168.42.2 5 | end 192.168.42.20 6 | interface wlan0 7 | remaining yes 8 | opt dns 208.67.222.222 208.67.220.220 9 | opt subnet 255.255.255.0 10 | opt router 192.168.42.1 11 | opt lease 864000 12 | -------------------------------------------------------------------------------- /config-files/udhcpd_template.conf: -------------------------------------------------------------------------------- 1 | # This file was installed with the RPI-Wireless-Hotspot script 2 | # For more info see https://github.com/unixabg/RPI-Wireless-Hotspot 3 | # ------------------------------------------------------------------------ 4 | start 192.168.ROUTER.2 5 | end 192.168.ROUTER.100 6 | interface wlan0 7 | remaining yes 8 | opt dns DNS 9 | opt subnet 255.255.255.0 10 | opt router 192.168.ROUTER.1 11 | opt lease 864000 12 | -------------------------------------------------------------------------------- /config-files/udhcpd_unblockus.conf: -------------------------------------------------------------------------------- 1 | # This file was installed with the RPI-Wireless-Hotspot script 2 | # For more info see https://github.com/unixabg/RPI-Wireless-Hotspot 3 | # ------------------------------------------------------------------------ 4 | start 192.168.42.2 5 | end 192.168.42.20 6 | interface wlan0 7 | remaining yes 8 | opt dns 208.122.23.22 208.122.23.23 9 | opt subnet 255.255.255.0 10 | opt router 192.168.42.1 11 | opt lease 864000 12 | -------------------------------------------------------------------------------- /contrib/pifi-keypair: -------------------------------------------------------------------------------- 1 | ssh pi@YourIP 'mkdir .ssh' 2 | scp ~/.ssh/id_rsa.pub pi@YourIP:~/.ssh/authorized_keys 3 | scp ./pifi.sshd_config pi@YourIP:~/sshd_config 4 | scp iptables.pifi pi@YourIP:~/iptables.ipv4.nat 5 | ssh pi@YourIP 'sudo cp /home/pi/iptables.ipv4.nat /etc/iptables.ipv4.nat;sudo cp sshd_config /etc/ssh/sshd_config; sudo reboot' 6 | -------------------------------------------------------------------------------- /contrib/pifi-update: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ################################################################################## 3 | # The pifi-update script is designed to inject iptables rules for mac filtering. 4 | ################################################################################## 5 | # 6 | # Set some variables to avoid mistakes 7 | IPTABLESHEADER="~/iptables.header" 8 | IPTABLESFILE="~/iptables.pifi" 9 | IPTABLESFOOTER="~/iptables.footer" 10 | 11 | # Dump the headder to the new truncated file 12 | cat ${IPTABLESHEADER} > ${IPTABLESFILE} 13 | 14 | # Dump the mac addresses to the new file 15 | grep yourGrepPatterm /etc/dhcp/dhcpd.conf | awk -F{ '{print $2}' | awk '{print "-A INPUT -i wlan0 -m mac --mac-source "tolower(substr($3,1,length($3)-1))" -j ACCEPT"}' >> ${IPTABLESFILE} 16 | 17 | # Dump the footer to complete the new file 18 | cat ${IPTABLESFOOTER} >> ${IPTABLESFILE} 19 | 20 | # Now push the completed iptables file out and reload the rules. 21 | for i in PiFiIP1 PiFiIP2 PiFiIPn 22 | do 23 | scp ${IPTABLESFILE} pi@${i}:~/iptables.ipv4.nat 24 | ssh pi@${i} 'sudo cp /home/pi/iptables.ipv4.nat /etc/iptables.ipv4.nat; sudo reboot' 25 | done 26 | exit 0 27 | -------------------------------------------------------------------------------- /hostapd-adafruit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harryallerston/RPI-Wireless-Hotspot/37871cef71868021ad0f48610fe7079451c61bc2/hostapd-adafruit -------------------------------------------------------------------------------- /install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Raspberry Pi Wireless Hotspot Installation Script 3 | 4 | clear 5 | 6 | echo "=======================================================" 7 | echo "======== Setting up Raspberry Pi WiFi hotspot =========" 8 | echo "=======================================================" 9 | 10 | read -r -p "This script will make changes to your system which may break some applications and may require you to reimage your SD card. Are you sure that you wish to continue? [y/N] " confirm 11 | 12 | if ! [[ $confirm =~ ^([yY][eE][sS]|[yY])$ ]] 13 | then 14 | exit 1 15 | fi 16 | 17 | clear 18 | echo "Updating package lists" 19 | 20 | apt-get -y -qq update 21 | 22 | echo "Installing dependencies" 23 | 24 | apt-get -y -qq install hostapd udhcpd 25 | 26 | 27 | #################################################################### 28 | # check for and back up existing config files 29 | #################################################################### 30 | echo "Backing up existing config files" 31 | 32 | readonly CONFIG_FILES=(/etc/udhcpd.conf 33 | /etc/default/udhcpd 34 | /etc/network/interfaces 35 | /etc/hostapd/hostapd.conf 36 | /etc/default/hostapd 37 | /etc/sysctl.conf 38 | /etc/iptables.ipv4.nat) 39 | 40 | for c in ${CONFIG_FILES[*]}; 41 | do 42 | if [ -f ${c} ] 43 | then 44 | cp -i ${c} ${c}.old 45 | fi 46 | done 47 | 48 | echo "Config Files backed up" 49 | 50 | #################################################################### 51 | # copy configs to relevant directories 52 | #################################################################### 53 | 54 | echo "Configuring DHCP" 55 | read -r -p "Do you want to use preconfigured DNS servers? [y/N] " altdnsresponse 56 | 57 | if [[ $altdnsresponse =~ ^([yY][eE][sS]|[yY])$ ]] 58 | then 59 | read -r -p "Do you wish to use Unblock-Us DNS servers? [y/N] " unblockusdnsresponse 60 | if [[ $unblockusdnsresponse =~ ^([yY][eE][sS]|[yY])$ ]] 61 | then 62 | cp ./config-files/udhcpd_unblockus.conf /etc/udhcpd.conf 63 | else 64 | read -r -p "Do you wish to use OpenDNS DNS servers? [y/N] " opendnsresponse 65 | if [[ $opendnsresponse =~ ^([yY][eE][sS]|[yY])$ ]] 66 | then 67 | cp ./config-files/udhcpd_opendns.conf /etc/udhcpd.conf 68 | else 69 | echo "No other DNS servers available to choose from. Reverting to Google DNS." 70 | cp ./config-files/udhcpd_google.conf /etc/udhcpd.conf 71 | fi 72 | fi 73 | else 74 | read -r -p "Please enter a custom dns server address of the form xxx.xxx.xxx.xxx : " _DNS 75 | read -r -p "Please enter a custom router number from 0-254 : " _ROUTER 76 | sed -e "s/ROUTER/${_ROUTER}/g" -e "s/DNS/${_DNS}/" ./config-files/udhcpd_template.conf > /etc/udhcpd.conf 77 | sed -e "s/ROUTER/${_ROUTER}/g" -e "s/DNS/${_DNS}/" ./config-files/udhcpd_template.conf > /etc/udhcpd.conf 78 | fi 79 | # Copy in the config file to enable udhcpd 80 | cp ./config-files/udhcpd /etc/default 81 | # Copy in the systemd udhcpd.service file 82 | cp ./config-files/udhcpd.service /lib/systemd/system/ 83 | # Tell systemd to enable the udhcpd.service 84 | systemctl enable udhcpd.service 85 | 86 | echo "Configuring interfaces" 87 | if [ -n "${_ROUTER}" ]; then 88 | sed -e "s/ROUTER/${_ROUTER}/g" ./config-files/interfaces-template > /etc/network/interfaces 89 | else 90 | cp ./config-files/interfaces /etc/network 91 | fi 92 | 93 | echo "Configuring hostapd" 94 | readonly DEFAULTPWD="0123456789A" 95 | readonly DEFAULTSSID="RaspberryPiFi" 96 | readonly DEFAULTCHANNEL=8 97 | 98 | read -r -p "Do you want to use the wifi defaults of password=${DEFAULTPWD}, ssid=${DEFAULTSSID}, and channel=${DEFAULTCHANNEL}? [y/N] " althostapdresponse 99 | 100 | if [[ $althostapdresponse =~ ^([yY][eE][sS]|[yY])$ ]] 101 | then 102 | cp ./config-files/hostapd.conf /etc/hostapd 103 | else 104 | _PASSWORD1="0" 105 | _PASSWORD2="1" 106 | read -r -s -p "Please enter a new password at least 8 characters long (length is not checked): " _PASSWORD1 107 | echo 108 | read -r -s -p "Please enter the new password again: " _PASSWORD2 109 | echo 110 | while [ ${_PASSWORD1} != ${_PASSWORD2} ] 111 | do 112 | echo "Password mismatch please try again." 113 | read -r -s -p "Please enter a new password at least 8 characters long (length is not checked): " _PASSWORD1 114 | echo 115 | read -r -s -p "Please enter the new password again: " _PASSWORD2 116 | echo 117 | done 118 | read -r -p "Please enter a new ssid: " _SSID 119 | # Sentry for the channel selection 120 | _SENTRY="0" 121 | while [ ${_SENTRY} != "1" ] 122 | do 123 | read -r -p "Please enter a new channel from 1 to 11: " _CHANNEL 124 | if [ ${_CHANNEL} == ${_CHANNEL//[^0-9]/} ] && [ ${_CHANNEL} -lt 12 ] && [ ${_CHANNEL} -gt 0 ] 125 | then 126 | echo "You selected channel $_CHANNEL." 127 | _SENTRY="1" 128 | else 129 | echo "Invalid entry received of ${_CHANNEL} ." 130 | fi 131 | done 132 | CONTENTS=$(<./config-files/hostapd.conf) 133 | CONTENTS=${CONTENTS//wpa_passphrase=${DEFAULTPWD}/wpa_passphrase=${_PASSWORD1}} 134 | CONTENTS=${CONTENTS//ssid=${DEFAULTSSID}/ssid=${_SSID}} 135 | CONTENTS=${CONTENTS//channel=${DEFAULTCHANNEL}/channel=${_CHANNEL}} 136 | echo "${CONTENTS}" > /etc/hostapd/hostapd.conf 137 | fi 138 | cp ./config-files/hostapd /etc/default 139 | 140 | 141 | ############################################################# 142 | # option for adafruit wifi adapter or any rtl871x adapter 143 | ############################################################# 144 | 145 | read -r -p "Are you using an rtl871x chipset (such as one purchased via adafruit? (if in doubt, select no) [y/N] " adafruit 146 | 147 | if [[ $adafruit =~ ^([yY][eE][sS]|[yY])$ ]] 148 | then 149 | mv /usr/sbin/hostapd /usr/sbin/hostapd.ORIG 150 | echo "Adafruit hostapd binary copied" 151 | cp ./hostapd-adafruit /usr/sbin/hostapd 152 | cp ./config-files/hostapd-adafruit.conf /etc/hostapd/hostapd.conf 153 | chmod 755 /usr/sbin/hostapd 154 | fi 155 | 156 | 157 | echo "Configuring NAT" 158 | cp ./config-files/sysctl.conf /etc 159 | 160 | echo "Configuring iptables" 161 | read -r -p "Do you require chromecast support for unblock-us? [y/N] " chromecastresponse 162 | if [[ $chromecastresponse =~ ^([yY][eE][sS]|[yY])$ ]] 163 | then 164 | cp ./config-files/iptables-chromecast /etc/iptables.ipv4.nat 165 | else 166 | cp ./config-files/iptables.ipv4.nat /etc 167 | fi 168 | 169 | touch /var/lib/misc/udhcpd.leases 170 | 171 | echo "Initialising access point" 172 | service hostapd start 173 | update-rc.d hostapd enable 174 | 175 | echo "Initialising DHCP server" 176 | service udhcpd start 177 | update-rc.d udhcpd enable 178 | 179 | 180 | echo "================================================================" 181 | echo "=================== Configuration complete! ====================" 182 | echo "================================================================" 183 | 184 | echo "+++++++++++++++++ REBOOTING in 10 SECONDS ++++++++++++++++++++" 185 | echo "++++++++++++++++++++++ CTL-C to cancel ++++++++++++++++++++++++" 186 | 187 | sleep 10 188 | reboot 189 | 190 | exit 0 191 | 192 | --------------------------------------------------------------------------------