Skip to content

Commit 729fc40

Browse files
More content updates
1 parent 3c37e95 commit 729fc40

File tree

3 files changed

+48
-4
lines changed

3 files changed

+48
-4
lines changed

Content.org

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,28 @@ sudo sysctl --system
580580
#+end_src
581581

582582

583+
RETURN for port 22 and 51820 (SSH, and Wireguard)
584+
#+begin_src
585+
iptables -t nat -A PREROUTING -i ens3 -p udp --dport 51820 -j RETURN
586+
iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 22 -j RETURN
587+
#+end_src
588+
589+
Setup forward rest of ports inbound from VPS -> homelab,
590+
#+begin_src
591+
iptables -t nat -A PREROUTING -i ens3 -j DNAT --to-destination 10.0.0.2
592+
#+end_src
583593

594+
Allow ACCEPT exiting wg0 (homelab) to VPS (ens3):
595+
#+begin_src
596+
iptables -A FORWARD -i wg0 -o ens3 -s 10.0.0.2 -j ACCEPT
597+
#+end_src
598+
599+
MASQUERADE (convert IP)
600+
#+begin_src
601+
iptables -t nat -A POSTROUTING -j MASQUERADE
602+
#+end_src
584603

585-
Server
604+
VPS
586605
#+begin_src conf
587606
[Interface]
588607
Address = 10.0.0.1/24
@@ -794,7 +813,7 @@ push and pop.
794813
#+begin_src cpp
795814
template <typename T, std::size_t N>
796815
class RingBufferV2 {
797-
std::mutex mutex_;
816+
mutable std::mutex mutex_;
798817

799818
auto push(const T& value) noexcept -> bool {
800819
auto lock = std::lock_guard<std::mutex>{mutex_}; // Thread-safe

content/posts/optimizing-a-lock-free-ring-buffer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ push and pop.
9494
```cpp
9595
template <typename T, std::size_t N>
9696
class RingBufferV2 {
97-
std::mutex mutex_;
97+
mutable std::mutex mutex_;
9898
9999
auto push(const T& value) noexcept -> bool {
100100
auto lock = std::lock_guard<std::mutex>{mutex_}; // Thread-safe

content/posts/pending-tunnel.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,32 @@ echo 'net.ipv4.conf.ens3.route_localnet=1' | sudo tee -a /etc/sysctl.d/99-wiregu
4646
sudo sysctl --system
4747
```
4848

49-
Server
49+
RETURN for port 22 and 51820 (SSH, and Wireguard)
50+
51+
```nil
52+
iptables -t nat -A PREROUTING -i ens3 -p udp --dport 51820 -j RETURN
53+
iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 22 -j RETURN
54+
```
55+
56+
Setup forward rest of ports inbound from VPS -&gt; homelab,
57+
58+
```nil
59+
iptables -t nat -A PREROUTING -i ens3 -j DNAT --to-destination 10.0.0.2
60+
```
61+
62+
Allow ACCEPT exiting wg0 (homelab) to VPS (ens3):
63+
64+
```nil
65+
iptables -A FORWARD -i wg0 -o ens3 -s 10.0.0.2 -j ACCEPT
66+
```
67+
68+
MASQUERADE (convert IP)
69+
70+
```nil
71+
iptables -t nat -A POSTROUTING -j MASQUERADE
72+
```
73+
74+
VPS
5075

5176
```cfg
5277
[Interface]

0 commit comments

Comments
 (0)