This article walks you through how to use your Raspberry Pi (RPi) as a home router.
The central problem being solved is:
How to use a RPi’s wireless interface as a Wi‑Fi access point that is connected to the Internet via the RPi’s Ethernet port.
The solution relies heavily on NetworkManager’s shared connection mode.
Assumptions
Your RPi:
- Is running Raspberry Pi OS based on Debian Bookworm (or later)
- Has a working Internet connection via its Ethernet port
- Manages network connections using NetworkManager
Steps
1. Verify that eth0 is correctly configured
Run:
sudo nmcli device
Confirm that device eth0 is in the connected state.
2. Create a Wi‑Fi access point on the RPi’s wireless interface
# Create Wi‑Fi connection
# Of course you need to replace `wlan0`
# with your interface name
sudo nmcli connection add type wifi \
ifname wlan0 \
con-name ap0 \
ssid "<ACCESS-POINT-NAME>" \
autoconnect yes
# Set access point mode
sudo nmcli connection modify ap0 \
802-11-wireless.mode ap
# Use 2.4 GHz band
sudo nmcli connection modify ap0 \
802-11-wireless.band bg
# Set WPA2/WPA3 pre‑shared key
sudo nmcli connection modify ap0 \
wifi-sec.key-mgmt wpa-psk \
wifi-sec.psk "<PASSWORD-GOES-HERE>"
3. Enable NetworkManager’s “shared” mode
NetworkManager’s shared mode:
- Starts a DHCP server on the interface
- Enables IP forwarding
- Enables IP masquerading (NAT)
# Enable shared mode
sudo nmcli connection modify ap0 \
ipv4.method shared
# Specify IPv4 subnet
sudo nmcli connection modify ap0 \
ipv4.addresses 172.18.0.1/24
# Disable IPv6 (optional)
sudo nmcli connection modify ap0 \
ipv6.method ignore
4. Start the access point
sudo nmcli connection up ap0
5. Validate the setup
# Check Wi‑Fi access point gateway IP
ip -4 addr show wlan0
# Check routes
# Expect:
# - 172.18.0.0/24 via wlan0
# - default route via eth0
ip -4 route
6. Connect a client and verify Internet access
# Connected devices at the Wi‑Fi (L2) layer
sudo iw dev wlan0 station dump
# Connected devices at the IP (L3) layer
ip neigh show dev wlan0
Top comments (1)
Really straightforward and easy to follow. Thanks for sharing!