Introduce complete refactoring.

This commit is contained in:
Sebastian Lenzlinger
2024-06-18 03:12:28 +02:00
parent b345474a89
commit 01954bd5a6
56 changed files with 754 additions and 206 deletions

36
archive/misc/initSwAP_nftables Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/bash
# DISCLAIMER! THIS CODE HAS BEEN TAKEN FROM:
# https://nims11.wordpress.com/2012/04/27/hostapd-the-linux-way-to-create-virtual-wifi-access-point/
# Usage: ./initSoftAP
########### Initial wifi interface configuration #############
ip link set $1 down
ip addr flush dev $1
ip link set $1 up
ip addr add 10.0.0.1/24 dev $1
# If you still use ifconfig for some reason, replace the above lines with the following
# ifconfig $1 up 10.0.0.1 netmask 255.255.255.0
sleep 2
###########
########### Start dnsmasq ##########
if [ -z "$(ps -e | grep dnsmasq)" ]
then
dnsmasq
fi
###########
########### Enable NAT ############
nft add table nat
nft -- add chain nat prerouting { type nat hook prerouting priority -100 \; }
nft add chain nat postrouting { type nat hook postrouting priority 100 \; }
nft add rule nat postrouting oifname wlp44s0 wlp masquerade
#Thanks to lorenzo
#Uncomment the line below if facing problems while sharing PPPoE, see lorenzo's comment for more details
#iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
sysctl -w net.ipv4.ip_forward=1
###########
########## Start hostapd ###########
hostapd $PWD/hostapd.conf ## TODO! either put config in normal place
#killall dnsmasq