Skip to content

Commit ff1116f

Browse files
committed
support AP+STA mode, and hostapd in general, by adapting MkLHX/AP_STA_RPI_SAME_WIFI_CHIP#12
1 parent c231bfa commit ff1116f

File tree

8 files changed

+333
-203
lines changed

8 files changed

+333
-203
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ A SaaH-HaaS[-Spoke] topology may be useful when you can't forward the WireGuard
3232
Move everything in `examples/` out to the parent directory. The files to edit are:
3333

3434
- `dhcp/*dhcp*`: DHCP config, if you want to use the node as a DHCP server but don't want to use Pi-hole for it
35-
- `netplan/{closed,open}.yml`: network config when gateway is reachable or not, respectively
35+
- `netplan/{closed,open}.yml`: network config when internet is reachable or not, respectively
3636
- `env.sh`: environment variables for the scripts
3737
- `compose.yml`: environment variables for the services and bare WireGuard
3838
- `hooks/{pre,post}-{up,down}.sh`: scripts that run from the project directory before and after everything is started or stopped
39+
- `hostapd/*.conf`: hostapd configs for your non-netplan APs, for more control and AP+STA mode support
3940

4041
Keep in mind that:
4142

@@ -55,7 +56,7 @@ Keep in mind that:
5556
Set a node up in two or three steps:
5657

5758
1. Move this directory to the target in any way you like. If you install the `deb` package provided in [Releases](https://github.com/ipitio/closure/releases), the directory will be `/opt/closure`.
58-
2. Modify the files above and, if you didn't install the package, spin everything up by running `sudo bash kickstart.sh` from the directory. Otherwise, just reboot.
59+
2. Modify the files above and, if you didn't install the package, spin everything up either by running `sudo bash kickstart.sh` from the directory or by moving `rc.local` to `/etc` and making it executable. Otherwise, just reboot.
5960
3. On a Hub or HaaS, add a Spoke or SaaH peer. To finish adding the SaaH peer to a HaaS, run `add.sh` (as described below) for it, after Step 3, with `-a` to correctly set the peer's AllowedIPs. Then add an `SERVER_ALLOWEDIPS_PEER_[SaaH]=` environment variable -- using the peer's name sans the brackets -- for the wireguard service with the difference of `0.0.0.0/1,128.0.0.0/1,::/1,8000::/1` minus the peer's IP and run `sudo bash restart.sh`. This [AllowedIPs Calculator](https://www.procustodibus.com/blog/2021/03/wireguard-allowedips-calculator) is pretty nifty.
6061

6162
Set a Hub or HaaS up first, so you can generate the necessary peer configuration for a Spoke or SaaH, then drop it in the Spoke's or SaaH's `wireguard/config/wg_confs` directory after its Step 1.

debian/control

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Homepage: https://github.com/ipitio/closure
44
Standards-Version: 3.9.2
55

66
Package: closure
7-
Version: 1.3
7+
Version: 1.4
88
Maintainer: ipitio <21136719+ipitio@users.noreply.github.com>
9-
Depends: curl, docker-ce, docker-ce-cli, containerd.io, docker-buildx-plugin, docker-compose-plugin, macchanger, network-manager, isc-dhcp-server, iw, net-tools, qrencode, wireguard, wireless-tools, wmctrl, wget
9+
Depends: containerd.io, curl, docker-ce, docker-ce-cli, docker-buildx-plugin, docker-compose-plugin, hostapd, isc-dhcp-server, iw, macchanger, network-manager, net-tools, qrencode, rfkill, wireguard, wireless-tools, wmctrl, wget
1010
Recommends: build-essential, byobu, dkms, iperf3, nmap, tmux, traceroute
1111
Copyright: debian/copyright
1212
Readme: debian/README.Debian

examples/env.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,17 @@ CLS_DOMAIN="internal"
3535
# Expected network speed as described here: https://man7.org/linux/man-pages/man8/tc-cake.8.html
3636
CLS_BANDWIDTH=""
3737

38+
# Load "serial", "ether", etc. module, leave empty for host mode
39+
CLS_OTG_g_=""
40+
3841
# If using a wireless interface to connect to the gateway, set its name
3942
CLS_WIFACE=""
4043

41-
# Load "serial", "ether", etc. module
42-
CLS_OTG_g_=""
44+
# Create hotspot(s) using hostapd, instead of including in netplan, eg. for the STA+AP mode example below
45+
CLS_AP_HOSTAPD=false
46+
47+
# "/" separated list of interfaces to use for the hostapd AP
48+
CLS_AP_WIFACES="ap@$CLS_WIFACE"
49+
50+
# "/" separated list of names of the respective configs in `hostapd/` for the above interfaces
51+
CLS_AP_CONFIGS="ap@"

examples/hostapd/ap@.conf

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
ctrl_interface=/var/run/hostapd
2+
ctrl_interface_group=0
3+
driver=nl80211
4+
5+
# Commented options depend on your hardware, the rest probably work on newer hardware
6+
7+
# Automatically set at runtime
8+
interface=
9+
10+
# IEEE 802.11
11+
ssid=star
12+
country_code=PA
13+
ieee80211d=1
14+
ieee80211h=1
15+
hw_mode=g
16+
channel=11
17+
wmm_enabled=1
18+
macaddr_acl=0
19+
auth_algs=1
20+
ap_max_inactivity=691200
21+
basic_rates=180 240 360 480 540
22+
rts_threshold=534
23+
fragm_threshold=784
24+
preamble=1
25+
#wds_sta=1
26+
27+
# RADIUS
28+
nas_identifier=router.cls
29+
radius_server_ipv6=0
30+
31+
# IEEE 802.11n
32+
ieee80211n=1
33+
#ht_capab=
34+
35+
# IEEE 802.11i
36+
wpa=2
37+
wpa_passphrase=C10sure_
38+
wpa_key_mgmt=WPA-PSK
39+
wpa_pairwise=CCMP
40+
extended_key_id=1
41+
ieee80211w=1
42+
beacon_prot=1
43+
#ocv=2
44+
okc=1
45+
dhcp_rapid_commit_proxy=1
46+
47+
# IEEE 802.11r
48+
mobility_domain=1337
49+
reassociation_deadline=20000
50+
ft_psk_generate_local=1
51+
r0kh=ff:ff:ff:ff:ff:ff * 00112233445566778899aabbccddeeff
52+
53+
# IEEE 802.11v
54+
bss_transition=1
55+
#proxy_arp=1
56+
57+
# IEEE 802.11k
58+
rrm_neighbor_report=1
59+
rrm_beacon_report=1
60+
61+
# MBO
62+
#mbo=1
63+
#mbo_cell_data_conn_pref=1
64+
65+
# Airtime
66+
#airtime_mode=2
67+
#airtime_bss_weight=1

0 commit comments

Comments
 (0)