WHAT
This commit is contained in:
6
code/misc/dnsmasq.conf
Normal file
6
code/misc/dnsmasq.conf
Normal file
@@ -0,0 +1,6 @@
|
||||
interface=wlp0s20f0u1
|
||||
dhcp-range=192.168.1.2,192.168.1.250,12h
|
||||
# Gateway
|
||||
dhcp-option=3,192.168.1.1
|
||||
# Dns server addr
|
||||
dhcp-option=6,192.168.1.1
|
||||
6
code/misc/enable-forwarding.sh
Executable file
6
code/misc/enable-forwarding.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!
|
||||
# Run as root
|
||||
#
|
||||
|
||||
sysctl -w net.ipv4.conf.all.forwarding=1
|
||||
sysctl -w net.ipv6.conf.all.forwading=1
|
||||
8
code/misc/hostapd.conf
Normal file
8
code/misc/hostapd.conf
Normal file
@@ -0,0 +1,8 @@
|
||||
interface=wlp0s20f0u1
|
||||
driver=nl80211
|
||||
ssid=t3u
|
||||
hw_mode=g
|
||||
channel=11
|
||||
macaddr_acl=0
|
||||
auth_algs=1
|
||||
ignore_broadcast_ssid=0
|
||||
12
code/misc/hostapd.conf.bak
Normal file
12
code/misc/hostapd.conf.bak
Normal file
@@ -0,0 +1,12 @@
|
||||
interface=wlp0s20f0u1
|
||||
driver=nl80211
|
||||
ssid=t3u
|
||||
hw_mode=g
|
||||
channel=11
|
||||
macaddr_acl=0
|
||||
auth_algs=1
|
||||
ignore_broadcast_ssid=0
|
||||
wpa=2
|
||||
wpa_passphrase=11help22help33
|
||||
wpa_key_mgmt=WPA-PSK
|
||||
rsn_pairwise=CCMP
|
||||
35
code/misc/initSwAP
Executable file
35
code/misc/initSwAP
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/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 ############
|
||||
iptables -t nat -A POSTROUTING -o $2 -j MASQUERADE
|
||||
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
||||
iptables -A FORWARD -i $1 -o $2 -j ACCEPT
|
||||
|
||||
#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
|
||||
36
code/misc/initSwAP_nftables
Executable file
36
code/misc/initSwAP_nftables
Executable 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
|
||||
22
code/misc/make_ap.sh
Executable file
22
code/misc/make_ap.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#! /bin/env bash
|
||||
|
||||
TYPE="wifi"
|
||||
IFNAME="wlp0s20f0u1"
|
||||
CONNAME="T3UminiConn"
|
||||
SSID="T3Umini"
|
||||
BAND="bg"
|
||||
CHAN=1
|
||||
KMGMT="wpa-psk"
|
||||
PSK=11223344
|
||||
|
||||
nmcli con add type wifi ifname wlp0s20f0u1 mode ap con-name WIFI_AP_TEST ssid MY_AP_TEST &&
|
||||
nmcli con modify WIFI_AP_TEST 802-11-wireless.band bg &&
|
||||
nmcli con modify WIFI_AP_TEST 802-11-wireless.channel 1 &&
|
||||
nmcli con modify WIFI_AP_TEST 802-11-wireless-security.key-mgmt wpa-psk &&
|
||||
nmcli con modify WIFI_AP_TEST 802-11-wireless-security.pairwise ccmp &&
|
||||
nmcli con modify WIFI_AP_TEST 802-11-wireless-security.psk 11223344 &&
|
||||
nmcli con modify WIFI_AP_TEST ipv4.method shared && nmcli con up WIFI_AP_TEST
|
||||
|
||||
' nmcli con modify WIFI_AP_TEST 802-11-wireless-security.proto rsn &&
|
||||
nmcli con modify WIFI_AP_TEST 802-11-wireless-security.group ccmp && NOT USED FOR APPLE`
|
||||
|
||||
Reference in New Issue
Block a user