mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-22 07:30:23 +00:00
Persist IP forwarding + iptables, update raspapd
This commit is contained in:
parent
a943942bdd
commit
26a28a0123
3 changed files with 8 additions and 16 deletions
|
@ -8,7 +8,7 @@ raspap_dir="/etc/raspap"
|
|||
raspap_user="www-data"
|
||||
raspap_sudoers="/etc/sudoers.d/090_raspap"
|
||||
raspap_dnsmasq="/etc/dnsmasq.d/090_raspap.conf"
|
||||
raspap_iptables="/etc/raspap.iptables.rules"
|
||||
raspap_sysctl="/etc/sysctl.d/90_raspap.conf"
|
||||
webroot_dir="/var/www/html"
|
||||
git_source_url="https://github.com/$repo" # $repo from install.raspap.com
|
||||
|
||||
|
@ -291,14 +291,15 @@ function enable_raspap_daemon() {
|
|||
function configure_networking() {
|
||||
install_log "Configuring networking"
|
||||
echo "Enabling IP forwarding"
|
||||
sudo sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf || install_error "Unable to set IP forwarding"
|
||||
sudo sysctl -p /etc/sysctl.conf || install_error "Unable to execute sysctl"
|
||||
echo "net.ipv4.ip_forward=1" | sudo tee $raspap_sysctl || install_error "Unable to set IP forwarding"
|
||||
sudo sysctl -p $raspap_sysctl || install_error "Unable to execute sysctl"
|
||||
sudo /etc/init.d/procps restart || install_error "Unable to execute procps"
|
||||
|
||||
echo "Creating IP tables rules"
|
||||
sudo iptables -t nat -A POSTROUTING -j MASQUERADE || install_error "Unable to execute iptables"
|
||||
sudo iptables -t nat -A POSTROUTING -s 192.168.50.0/24 ! -d 192.168.50.0/24 -j MASQUERADE || install_error "Unable to execute iptables"
|
||||
echo "Persisting IP tables rules"
|
||||
sudo iptables-save | sudo tee $raspap_iptables
|
||||
sudo iptables-save | sudo tee /etc/iptables/rules.v4
|
||||
|
||||
# Prompt to install RaspAP daemon
|
||||
echo -n "Enable RaspAP control service (Recommended)? [Y/n]: "
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
### BEGIN INIT INFO
|
||||
# Provides: /etc/raspap/hostapd/servicestart
|
||||
# Provides: raspapd
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
|
@ -11,8 +11,7 @@
|
|||
[Unit]
|
||||
Description=RaspAP Service Daemon
|
||||
DefaultDependencies=no
|
||||
After=systemd-sysctl.service
|
||||
Before=sysinit.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# up network services in a specific order and timing to avoid race conditions.
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
NAME=raspap
|
||||
NAME=raspapd
|
||||
DESC="Service control for RaspAP"
|
||||
CONFIGFILE="/etc/raspap/hostapd.ini"
|
||||
DAEMONPATH="/lib/systemd/system/raspap.service"
|
||||
|
@ -36,7 +36,6 @@ set -- "${positional[@]}"
|
|||
|
||||
echo "Stopping network services..."
|
||||
systemctl stop openvpn-client@client
|
||||
systemctl stop systemd-networkd
|
||||
systemctl stop hostapd.service
|
||||
systemctl stop dnsmasq.service
|
||||
systemctl stop dhcpcd.service
|
||||
|
@ -65,15 +64,8 @@ if [ -r "$CONFIGFILE" ]; then
|
|||
|
||||
echo "Removing uap0 interface..."
|
||||
iw dev uap0 del
|
||||
|
||||
echo "Enabling systemd-networkd"
|
||||
systemctl start systemd-networkd
|
||||
systemctl enable systemd-networkd
|
||||
fi
|
||||
else
|
||||
echo "Disabling systemd-networkd"
|
||||
systemctl disable systemd-networkd
|
||||
|
||||
echo "Removing br0 interface..."
|
||||
ip link set down br0
|
||||
ip link del dev br0
|
||||
|
|
Loading…
Reference in a new issue