Mark's Field Notes

Life in a DIY RV in Australia. Mechatronics for both comfort and entertainment.

Tuesday, February 24, 2026

Pi Router / Server Setup


The setup will likely need amendment (it was done with assist from chatGPT before I realized how flakey it was... Also I havent setup SAMBA yet  

 

# 1. Make the Pi a router (kernel forwarding)

sudo sysctl -w net.ipv4.ip_forward=1

# 2. Clear any existing nftables state (safe on a Pi)
sudo nft flush ruleset

# 3. NAT table: masquerade traffic going out to the phone
sudo nft add table ip nat
sudo nft add chain ip nat postrouting { type nat hook postrouting priority 100 \; }
sudo nft add rule ip nat postrouting oif "usb0" masquerade

# 4. Filter table: allow forwarding between LAN and phone
sudo nft add table ip filter
sudo nft add chain ip filter forward { type filter hook forward priority 0 \; }

sudo nft add rule ip filter forward iif "eth0" oif "usb0" accept
sudo nft add rule ip filter forward iif "usb0" oif "eth0" ct state established,related accept

 

===============================

Raspberry Pi USB-Tether Router
(Android phone → Pi → LAN)
PERSISTENT CONFIG

===============================

ASSUMPTIONS
-----------
- Android phone provides internet via USB tethering
- On the Pi:
usb0 = upstream (phone)
eth0 = downstream (LAN / TP-Link / NUC)
- Temporary routing + NAT has already been tested and works

--------------------------------
1. ENABLE IP FORWARDING (PERMANENT)
--------------------------------

echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/99-ipforward.conf
sudo sysctl --system

--------------------------------
2. ENSURE NFTABLES IS INSTALLED & ENABLED
--------------------------------

sudo apt update
sudo apt install -y nftables
sudo systemctl enable --now nftables

--------------------------------
3. WRITE PERSISTENT NFTABLES RULESET
--------------------------------

sudo tee /etc/nftables.conf >/dev/null <<'EOF'
#!/usr/sbin/nft -f
flush ruleset

# NAT table: masquerade traffic going out to the phone
table ip nat {
chain postrouting {
type nat hook postrouting priority 100;
oifname "usb0" masquerade
}
}

# Filter table: allow forwarding between LAN and phone
table ip filter {
chain forward {
type filter hook forward priority 0;
iifname "eth0" oifname "usb0" accept
iifname "usb0" oifname "eth0" ct state established,related accept
}
}
EOF

--------------------------------
4. LOAD RULES NOW (WITHOUT REBOOT)
--------------------------------

sudo nft -f /etc/nftables.conf
sudo systemctl restart nftables

--------------------------------
5. VERIFICATION (OPTIONAL BUT SANE)
--------------------------------

# On the Pi:
sysctl net.ipv4.ip_forward
nft list ruleset

# From a downstream machine (e.g. NUC):
# ping 192.168.1.1
# ping 1.1.1.1

--------------------------------
END
-------------------------------- 
Posted by Mark Bolton at 11:52 PM No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: Computers

Pi / DAC source for Valve Amp

Need: spacers

Pi / DAC Combo

Silicon Chip "Currawong Amp

 



Posted by Mark Bolton at 10:50 PM No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: Electronics

This aint Kansas, Dorothy

 Standing waiting for a man to show

 

 Wide-eyed, one eye fixed on the door

This waiting is killing me
It's wearing me down
Day in, day out
My feet are burning holes in the ground
Darkness warmer than a bedroom floor
 

Want someone to hold me close forever more
I'm a sleeping dog, but you can't tell
  

When I'm on the prowl, you better run like hell
You know it makes sense, don't even think about it
 
Result of a bird strike - the bird was stationary.
Result of a bird strike - the bird was stationary.
 
Life and death are things you just do when you're bored
 
The flight was the last one the pilot did before he retired and sold the business.
 The flight was the last one the pilot did before he retired.
 
Say fear is a man's best friend
Say fear is a man's best friend
Say fear is a man's best friend
You add it up, it brings you down
You add it up, it brings you down
Home is living like a man on the run
 
 
Trails leading nowhere, where to, my son?
 
 
We're already dead, but not yet in the ground
Come on, shake my helping hand
 
 
I'll show you around
You know it makes sense, don't even think about it
 
 
Life and death are things you just do when you're bored
Say fear is a man's best friend
 
Stunning views of Perth City ..
Stunning views of Perth City .. 
 
Say fear is a man's best friend
Say fear is a man's best friend


Say fear is a man's best friend
Say fear is a man's best friend
You add it up, it brings you down
 
Even prettier at night.
 Even prettier at night.
 
  You add it up, it brings you down
 
 
Say fear is a man's best friend
Say fear is a man's best friend
Say fear is a man's best friend
Say fear is a man's best friend
Say fear is a man's best friend
Say fear is a man's best friend
Say fear is a man's best friend
Say fear is a man's best friend
Say fear is a man's best friend
 
           With apologies to John Cale 

Posted by Mark Bolton at 5:49 PM No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: Accommodation
Newer Posts Older Posts Home
Subscribe to: Comments (Atom)

About Me

My photo
Mark Bolton
Sixty some thing bloke. Have had a bit to do with Electronics and Earth Sciences.
View my complete profile

Blog Archive

  • ▼  2026 (3)
    • ▼  February (3)
      • Pi Router / Server Setup
      • Pi / DAC source for Valve Amp
      • This aint Kansas, Dorothy
  • ►  2025 (23)
    • ►  December (9)
    • ►  October (6)
    • ►  July (2)
    • ►  March (3)
    • ►  January (3)
  • ►  2024 (5)
    • ►  September (1)
    • ►  August (1)
    • ►  May (3)
  • ►  2023 (13)
    • ►  December (2)
    • ►  November (2)
    • ►  August (1)
    • ►  July (1)
    • ►  June (1)
    • ►  March (6)
  • ►  2022 (2)
    • ►  December (1)
    • ►  February (1)
  • ►  2021 (12)
    • ►  December (1)
    • ►  October (3)
    • ►  August (3)
    • ►  July (1)
    • ►  February (2)
    • ►  January (2)
  • ►  2020 (41)
    • ►  December (2)
    • ►  November (5)
    • ►  October (2)
    • ►  September (3)
    • ►  August (12)
    • ►  June (4)
    • ►  May (7)
    • ►  April (3)
    • ►  March (1)
    • ►  February (2)
  • ►  2019 (13)
    • ►  December (5)
    • ►  October (1)
    • ►  September (4)
    • ►  August (1)
    • ►  February (2)
  • ►  2018 (13)
    • ►  November (1)
    • ►  October (3)
    • ►  September (3)
    • ►  July (1)
    • ►  June (1)
    • ►  May (2)
    • ►  March (1)
    • ►  February (1)
  • ►  2017 (5)
    • ►  December (1)
    • ►  November (1)
    • ►  August (2)
    • ►  May (1)
  • ►  2016 (37)
    • ►  November (1)
    • ►  October (1)
    • ►  July (3)
    • ►  June (21)
    • ►  May (3)
    • ►  March (3)
    • ►  February (5)
  • ►  2015 (9)
    • ►  November (6)
    • ►  October (1)
    • ►  August (1)
    • ►  April (1)
  • ►  2014 (12)
    • ►  November (1)
    • ►  September (2)
    • ►  August (4)
    • ►  July (1)
    • ►  February (1)
    • ►  January (3)
  • ►  2013 (11)
    • ►  December (5)
    • ►  July (1)
    • ►  June (1)
    • ►  April (2)
    • ►  February (1)
    • ►  January (1)
  • ►  2012 (7)
    • ►  December (1)
    • ►  November (1)
    • ►  July (1)
    • ►  June (2)
    • ►  May (1)
    • ►  January (1)
  • ►  2011 (9)
    • ►  December (1)
    • ►  November (3)
    • ►  October (1)
    • ►  September (3)
    • ►  January (1)
  • ►  2010 (8)
    • ►  November (6)
    • ►  October (2)
Simple theme. Powered by Blogger.