User Tools

Site Tools


equipment:rbpi_openwrt

This is an old revision of the document!


Setup OpenWRT with WireGuard VPN on a Raspberry Pi 4

This will guide you through the setup of OpenWRT on a Raspberry Pi 4.

Install OpenWRT

    • Model: Raspberry Pi 4
    • Version: B
    • For the above:
  • Use balenaEtcher or other favorite tool to write OpenWRT onto SD card.
  • See webpage info below for optional step of resizing the default partition.
  • Put SD card in Pi, connect ethernet and power on.

Setup OpenWRT

  • Go to http://192.168.1.1 and login using 'root' and 'openwrt' as default login.
  • Set a new password by following the prompts.
  • Change IP block.
    • Go to Network and choose Interfaces.
    • Edit the LAN
      • Protocol: Static address
      • Bring up on boot: checked
      • IPv4 address: 10.28.9.1
      • IPv4 netmask: 255.255.255.0
    • Save
  • Save Apply and reconnect to new IP address with new password.
  • From the top menu, click on Network and choose Wireless.
  • Click Remove next to the existing wireless config and then Save & Apply.
  • Click Scan to search for available networks, find your and click Join Selected.
  • Enter your WiFi password in the WPA passphrase box and click Submit and then Save.
  • Click Save & Apply to connect to your WiFi.
  • You now have a WAN connection on the internal WiFi adapter and a LAN connection on the LAN port.
  • Now add USB WiFi card as radio1 for our WiFi access point for clients to connect to.
  • The Wifi card I have from a previous nonWifi Pi bundle seems compatable and may not require any extra install steps. See link below for more info if it does.
  • From the top menu, click on the Network tab and choose Wireless.
  • If you see radio1, you are all good with the installation of the second WiFi adapter.
  • Click Edit for the OpenWrt SSID (under the radio1)
    • Click Enable for Wireless network is disabled
    • Change Operating Frequency to 7 or anything that is free
    • Under Interface Configuration, select the Wireless Security tab, choose WPA2-PSK and enter a password that devices will use to connect.
    • Click Save
  • Click Save & Apply

Link: https://tristam.ie/2023/582/#openwrt-install

Setup WireGuard VPN

  • From OpenWRT top menu, click System tab and choose Software.
  • Click Update lists button and wait for process to finish.
  • Click Dismiss
  • Install the following packages by using the Filter field and clicking Install
    • kmod-wireguard
    • luci-proto-wireguard
    • luci-app-wireguard (Try installing this first, it should automatically install the others)
  • Click Network→Interfaces→Add new interface.
    • enter wg0 as the interface name.
    • select WireGuard VPN from protocol drop down
    • click Create interface
  • Click General Settings tab and enter following parameters from your Wireguard setup.
    • Bring up on boot: checked
    • Private Key: Generate new key pair
    • Public Key: this will go into your home wireguard setup on the other end as the peer's public key)
    • Listen Port: blank
    • IP Addresses: whatever you assign it in your home wireguard setup as the peer's ip (10.23.0.13/32)
  • Click Advanced Settings tab
    • Use default gateway: checked
    • enter custom DNS servers (8.8.8.8 and 8.8.4.4)
  • Click on the Firewall tab and select the WAN zone for Create/Assign firewall-zone. (wan wg0: wwan:)
  • Click the Peers tab and Add peer
    • Description: brimble.com
    • Public Key: from the home wireguard instance setup
    • Private Key: blank
    • Preshared key: blank
    • Allowed IPs: 0.0.0.0/0
    • Route Allowed IPs: checked
    • Endpoint Host: brimble.com
    • Endpoint Port: 51820
    • Persistent Keep Alive: 25
    • Click Save and then Save & Apply.
  • Also, set custom DNS again in Interfaces→WWAN if not already.

Link: https://tristam.ie/2023/805/

Connect

  • Use laptop to connect to broadcasting WiFi
  • go to 10.28.9.1 (or whatever your LAN is)
  • go to network/wireless and remove whatever old wifi is under radio0
  • click scan next to radio0 and connect to “hotel wifi”
  • Should now be connected and devices connecting to your device should work.
equipment/rbpi_openwrt.1705082874.txt.gz · Last modified: by dirk