Headless Raspberry Pi Setup for a Proxy Box

Follow this headless raspberry pi setup guide to flash OS Lite, enable SSH, harden the Pi, reserve its LAN address, and install ProxyKite.
A generic USB 4G dongle connects to a Raspberry Pi, cloud router and globe on a deep navy background.

A headless raspberry pi setup lets you build and maintain a proxy box without connecting a monitor, keyboard or mouse. This guide takes you from Raspberry Pi Imager to a hardened, updated Pi with a stable LAN address, then connects a Huawei E3372 HiLink dongle to ProxyKite.

What you need

Why this matters: preparing the network, storage and power first prevents you from debugging SSH and a USB modem at the same time.

Prepare these items before you write the operating system image:

ItemRecommended starting pointCheck before you begin
Raspberry PiA Pi 4 or Pi 5 with a stable power supplyUse a model and power supply appropriate for your workload.
StorageA reliable microSD card or supported USB storageConfirm the card is backed up; Imager will erase it.
NetworkEthernet for the first setup, or working Wi-FiThe Pi needs outbound internet access.
WorkstationA laptop or desktop with a card readerYou will use it to run Imager and SSH.
ModemHuawei E3372 HiLink or a similar compatible HiLink modelStart with one dongle and one activated data SIM.
USB powerAn externally powered hub for more than one dongleDo not build a fleet on the Pi’s USB power alone.

The Pi is the management box. The dongle and SIM provide the mobile connection. ProxyKite provides software and cloud routing; it does not provide the dongles, SIM cards, mobile data plans, IPs or bandwidth.

For a first build, use Ethernet if possible. Wi-Fi is fine for a small box, but Ethernet makes first-boot discovery and later troubleshooting simpler. If you are planning several dongles, read the guide to building a 4G proxy farm before buying hubs.

Step 1: Choose Raspberry Pi OS Lite and configure Imager

Why this matters: a proxy box does not need a desktop environment, and Raspberry Pi Imager can put the hostname, user, network and SSH settings on the card before the Pi ever boots.

Install the current Raspberry Pi Imager on your workstation. Insert the storage device, then follow this sequence:

  1. Select your Raspberry Pi model when Imager asks for it.
  2. Choose Raspberry Pi OS Lite. Select the 64-bit image when it is available for your model and your software supports it.
  3. Select the correct microSD card or USB storage. Check the capacity and device name carefully because the selected storage will be erased.
  4. Open the operating-system customisation screen.
  5. Set a unique hostname such as proxybox-01.
  6. Create a normal, non-root username and a long password. Do not rely on the old default pi account.
  7. Set the correct time zone and locale.
  8. Configure your Wi-Fi SSID and password if you are not using Ethernet.
  9. Open Remote Access, enable SSH, and choose public-key authentication if you already have an SSH key. Password authentication is acceptable for the first login if you have not prepared a key yet.
  10. Write the image and safely eject the storage device.

Raspberry Pi’s headless setup documentation recommends Imager for this workflow. It also notes that Raspberry Pi OS Lite is a good choice without a desktop and that SSH or Raspberry Pi Connect are the first-boot remote-access options.

Insert the prepared storage into the Pi, connect Ethernet if you are using it, and apply power. Give the first boot a few minutes. Do not connect the full modem fleet yet; one stable management connection is the useful baseline.

Step 2: Find the Pi and make the first SSH connection

Why this matters: SSH is your monitor and keyboard for a headless box, so confirm it works before changing security settings or adding a modem.

From the same local network, try the hostname you entered in Imager:

ssh YOUR_USER@proxybox-01.local

If .local discovery does not work, open your router’s connected-device list and find the Pi by hostname or MAC address. You can also use a network scanner you already trust, then connect with the assigned LAN address:

ssh YOUR_USER@192.168.1.42

After logging in, record the current address and confirm the default route:

hostname
hostname -I
ip -br address
ip route

The success check is simple: you have an interactive shell, hostname shows the box you configured, and ip route shows a default route through Ethernet or Wi-Fi. If the hostname fails but the router shows the Pi online, use the IP address for now; you will make the address predictable in Step 5.

The official Raspberry Pi remote-access guide lists SSH as the normal local-network method and documents both .local discovery and hostname -I.

Raspberry Pi’s documented headless setup path before the box is managed over SSH.
Raspberry Pi’s documented headless setup path before the box is managed over SSH.

Step 3: Update the Pi, install SSH keys and enable a firewall

Why this matters: updates and key-based access reduce avoidable maintenance work before the box becomes part of a proxy setup.

First update the package lists and installed packages:

sudo apt update
sudo apt full-upgrade -y
sudo reboot

Reconnect after the reboot. On your workstation, create an Ed25519 key if you do not already have one:

ssh-keygen -t ed25519 -C "proxybox-01"

Copy the public key to the Pi. Replace the username and address with your values:

ssh-copy-id YOUR_USER@192.168.1.42

Open a new terminal and test key login before disabling password login:

ssh YOUR_USER@192.168.1.42

Keep the original SSH session open while you test. If the new session works without asking for the Pi account password, you can disable password authentication. Create a small SSH drop-in on the Pi:

sudo install -d -m 0755 /etc/ssh/sshd_config.d
sudo nano /etc/ssh/sshd_config.d/10-proxybox-hardening.conf

Add these two lines:

PasswordAuthentication no
PermitRootLogin no

Check the configuration, then reload SSH:

sudo sshd -t
sudo systemctl reload ssh

Do not close your working session until a second key-authenticated login succeeds. If you have not yet installed a key, leave password authentication enabled and use a strong, unique password instead.

You can also use UFW to deny unsolicited inbound traffic while allowing SSH and normal outbound connections:

sudo apt install -y ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status verbose

ProxyKite’s public proxy endpoint uses the box’s outbound connection, so you do not need to open a proxy port on the Pi. If you run another service locally, add only the specific LAN rule it needs. Do not expose an unauthenticated proxy to the internet.

Success looks like a clean package update, reliable key login, sshd -t returning no error, and UFW showing SSH allowed with incoming traffic denied by default.

Step 4: Check the management network before connecting the dongle

Why this matters: the Pi needs one dependable management path while the HiLink device creates another network path.

Check the active interface and connection names:

nmcli device status
nmcli connection show --active
ip route

On current Raspberry Pi OS releases, NetworkManager is the default network tool. Leave the Ethernet or Wi-Fi connection that carries SSH as your management connection. Do not change its route while you are connected over that same path unless you have physical or out-of-band access.

Now connect one Huawei E3372 HiLink dongle. Give it time to start, then inspect the USB devices and interfaces:

lsusb
ip -br link
ip -br address

A HiLink device commonly presents an Ethernet-style network interface and a local management address. The exact interface name and address depend on the device and firmware. If you use the common Huawei address, test it only after checking what Linux assigned:

ping -c 3 192.168.8.1
curl -fsS http://192.168.8.1/ | head

If the device appears as USB storage instead of a network interface, check the exact model and install the USB mode-switching packages supplied by your distribution. Do not flash firmware just because the first USB presentation is unfamiliar. The E3372 HiLink and Stick mode guide explains the difference and the checks to make before changing anything.

Success looks like the Pi sees the dongle, the HiLink management page responds when applicable, and the SIM reports an active data session. Keep the first dongle on a direct Pi port until this path is stable; move to a powered hub before adding more.

Step 5: Give the Pi a stable LAN address

Why this matters: a predictable local address makes SSH, inventory and remote maintenance easier when the Pi reboots.

The preferred method is a DHCP reservation on your router. In the router’s DHCP or connected-device page, reserve the current Pi address against the Pi’s MAC address. Raspberry Pi’s configuration documentation recommends this approach because address management stays on the router and avoids a duplicate-address mistake.

After saving the reservation, reconnect or reboot the Pi and check:

hostname -I
ip route

Use the reserved address in your SSH command and in your inventory sheet. Label the box and record its MAC address, hostname, physical location and hub ports.

If your router cannot create reservations, NetworkManager can assign a static address on the Pi. First identify the connection name and choose an unused address outside the router’s DHCP pool. The following example assumes a wired connection, a /24 LAN, router 192.168.1.1, and an unused Pi address 192.168.1.50:

nmcli connection show
sudo nmcli connection modify "Wired connection 1" \
  ipv4.method manual \
  ipv4.addresses 192.168.1.50/24 \
  ipv4.gateway 192.168.1.1 \
  ipv4.dns "192.168.1.1 1.1.1.1"
sudo nmcli connection up "Wired connection 1"

Replace the connection name and addresses with your network’s values. This command can disconnect your SSH session when the connection is brought up again, so use it only when you have checked the values and know how to reconnect. Never choose an address that another device or the router’s DHCP pool can use.

Success looks like the Pi comes back at the same LAN address after a reboot and the address is still reachable from your workstation.

Step 6: Run the ProxyKite installer

Why this matters: the installer connects the box outward to ProxyKite, so the proxy can be routed without a static public IP or inbound port forwarding on the mobile network.

With the Pi updated, one HiLink dongle online and your licence key ready, run the current documented installer on the Pi:

curl -fsSL https://proxykite.com/install.sh | sudo bash -s -- \
  --key YOUR-LICENCE-KEY

Replace YOUR-LICENCE-KEY with the key for your account. Do not paste a real key into a public issue, screenshot, article or shared shell transcript. If you are unsure which command or key format your account uses, open the ProxyKite getting-started guide and follow the current instructions there.

When the installation finishes, open the ProxyKite panel and confirm that the box and its detected dongle are online. Create or copy the proxy credentials from the panel, then test the generated endpoint rather than assuming that an online box is enough.

For an HTTP check, replace the placeholders with the host, port, username and password shown for your proxy:

curl --fail --silent --show-error \
  --proxy "http://USER:PASSWORD@PROXY_HOST:PROXY_PORT" \
  https://api.ipify.org
printf '\n'

For SOCKS5 with DNS resolution through the proxy:

curl --fail --silent --show-error \
  --proxy "socks5h://USER:PASSWORD@PROXY_HOST:PROXY_PORT" \
  https://api.ipify.org
printf '\n'

If the password contains URL-reserved characters such as @, :, / or #, URL-encode it or use the ready-made connection string from the panel. Keep authentication enabled. ProxyKite supports HTTP and SOCKS5 access, user-and-password or IP-whitelist authentication, and shared or split ports.

Success looks like the panel shows the intended dongle online and both authenticated curl requests return an IP response through the proxy. The Pi itself needs outbound internet access; it does not need a static public IP or an inbound port forward for this route.

Verify the box before adding more dongles

A first proxy is ready for a real workload only after you have checked the whole chain:

  1. SSH reaches the Pi at its reserved LAN address.
  2. sudo apt update and sudo apt full-upgrade complete without errors.
  3. The SSH key works in a new session.
  4. The Pi sees the HiLink device in lsusb and ip -br link.
  5. The panel associates the correct dongle with the correct proxy.
  6. HTTP and SOCKS5 tests return responses with authentication enabled.
  7. A manual rotation works from the panel or the documented rotation flow.
  8. The panel records traffic for the test.

Only then connect a powered hub and add another dongle. Add one at a time and record the physical hub port, SIM label, HiLink address, proxy name and status. This makes a future replacement or connectivity issue much easier to isolate.

Troubleshooting a headless proxy box

The Pi is powered but does not appear on the network

Check the Ethernet cable, switch port, Wi-Fi credentials and router device list. If Wi-Fi was configured during Imager, confirm the SSID and password were entered correctly and that the Pi model supports the network band you selected. For a first boot, connect Ethernet and retry before changing files on the storage card.

proxybox-01.local does not resolve

Use the router’s client list to find the assigned IP and connect with ssh YOUR_USER@IP_ADDRESS. .local discovery depends on mDNS support on both the Pi and your workstation; an address discovered from the router is a valid alternative.

SSH stops working after the firewall change

Keep a second session open while enabling UFW. If you closed both sessions, connect locally if possible and run sudo ufw status verbose. Confirm that OpenSSH is allowed before enabling the firewall again.

The Pi loses its address after reboot

Check that the router reservation is tied to the Pi’s current MAC address, not the dongle’s MAC. If you used nmcli, verify the connection name, gateway, subnet and DNS values, and make sure the chosen address is outside the DHCP pool.

The dongle is visible but has no data session

Check the SIM, APN, signal and carrier terms in the HiLink interface. Run lsusb, ip -br address and ip route again. Do not add a second dongle until the first one has a working data path; otherwise identical devices will make the diagnosis harder.

The panel shows the box but the proxy test fails

Copy the current host, port and credentials from the panel. Test HTTP first, then SOCKS5 with socks5h. Check that the SIM has data, the dongle remains online and the password is URL-encoded if it contains reserved characters. You should not need to open an inbound port on the Pi.

FAQ

Can I set up a Raspberry Pi without a monitor?

Yes. Use Raspberry Pi Imager to configure the hostname, user, network and SSH before inserting the storage into the Pi. After first boot, connect from another computer with SSH over Ethernet or Wi-Fi.

Which Raspberry Pi OS is best for a headless proxy box?

Raspberry Pi OS Lite is the practical starting point because the proxy box does not need a desktop environment. Keep the image current, use a stable power supply, and confirm that the software you plan to install supports the selected architecture.

Does a headless Raspberry Pi need a static public IP?

No. It needs a stable local management address, which is best handled with a router DHCP reservation. For ProxyKite, the box makes an outbound connection to cloud routing, so a static public IP and inbound port forwarding are not required.

How do I SSH into a Raspberry Pi for the first time?

Use the username and hostname configured in Raspberry Pi Imager: ssh YOUR_USER@proxybox-01.local. If .local discovery fails, find the Pi’s LAN address in the router and use ssh YOUR_USER@192.168.1.42 instead.

Can I run several 4G dongles from one headless Pi?

Yes, but add them one at a time and use an externally powered USB hub. Check power, heat, USB stability and each dongle’s mobile session before expanding the box; the Raspberry Pi proxy guide covers the broader hardware layout.

Previous Article

4G Dongle APN Settings: HiLink Setup Guide

Next Article

ERR_PROXY_CONNECTION_FAILED: Causes and Fixes