RaspAProuter/README.md

120 lines
2.8 KiB
Markdown
Raw Normal View History

2021-04-04 00:24:51 +01:00
# RaspAProuter
2021-04-04 00:31:16 +01:00
This was inspired since my mother-in-law is using [Calyx Institute](https://calyxinstitute.org/) for the internet and the new hotspot (LineZone2) they have supports USB tethering.
Calyx works where they live and my father-in-law isn't ready to afford [StarLink](https://www.starlink.com/) (thank you Elon BTW).
2021-04-04 00:30:03 +01:00
2021-04-06 11:29:32 -04:00
One Line command (use at your own discretion)
```curl https://git.leffler.media/Leffler.Media-LLC/RaspAProuter/raw/branch/master/install.sh | bash```
2021-04-06 11:31:49 -04:00
***
2021-04-04 00:24:51 +01:00
Removed un-needed items
```apt purge iptables```
***
Install required items
```apt install bridge-utils hostapd firewalld dnsmasq```
***
Add country code to enable wifi
```echo 'country=US' | tee -a /etc/wpa_supplicant/wpa_supplicant.conf```
***
Enable IP Forwarding
```sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf```
***
Find NICs
2021-04-04 00:25:52 +01:00
It's usually safe to assume that eth0 is the on-board NIC | wlan0 is the on-board wifi
```ip a``` to find the NICs
***
Now we create the bridge
2021-04-04 00:24:51 +01:00
```nano /etc/network/interfaces```
allow-hotplug eth1
auto eth1
iface eth1 inet dhcp
auto eth0
allow-hotplug eth0
iface eth0 inet manual
# automatically connect the wireless interface, but disable it for now
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
# create a bridge with both wired and wireless interfaces
auto br0
iface br0 inet static
address 192.168.5.1
netmask 255.255.255.0
bridge_ports eth0 wlan0
bridge_fd 0
bridge_stp off
4. It probably wouldn't hurt to reboot now. Hopefully all is working.
***
Now run ```rfkill list``` to make sure that you see the wifi is ```Soft blocked: no``` on the WLAN interface which will probably be 0
***
Add firewalld rules
firewall-cmd --zone=home --add-interface=br0
firewall-cmd --zone=public --add-interface=eth1
firewall-cmd --zone=public --add-masquerade
firewall-cmd --zone=home --add-service=dns
firewall-cmd --zone=home --add-service=dhcp
firewall-cmd --zone=home --add-service=ssh
firewall-cmd --zone=public --add-service=ssh
2021-04-06 11:16:10 -04:00
firewall-cmd --runtime-to-permanent
2021-04-04 00:24:51 +01:00
***
Configure DNS Masq
```sed -i 's/#interface=/interface=br0/g' /etc/dnsmasq.conf```
Find ```dhcp-range``` and make if what you'd like. I did the following
2021-04-06 11:16:10 -04:00
```sed -i 's/#dhcp-range=192.168.0.50,192.168.0.150,12h/dhcp-range=192.168.5.50,192.168.5.150,4h/g'```
2021-04-04 00:24:51 +01:00
***
Time to configure hostapd. File is in repo for example. ```nano /etc/hostapd/hostapd.conf```
Now we need to specify the config for the hostapd daemon
```echo 'DAEMON_CONF="/etc/hostapd/hostapd.conf"' >> etc/default/hostapd```
***
Now we can enable all services
```systemctl enable dnsmasq hostapd```
***
We can can reboot again and hopefully it's going to be working
```reboot```