Use a Raspberry Pi to Bridge Starlink Wi-Fi to Your Router

I wanted to extend my Starlink Wi-Fi network to a router I have in my workshop without the use of any cables, or by having to purchase the Starlink ethernet adapter.

The issue I ran into was that my TP-Link ER706W is primarily a wired VPN router, and does not support Wi-Fi bridging or repeater modes.

Instead, I was able to get a similar effect by:

  • Using Raspberry Pi 4 to connect to the Starlink Wi-Fi network and forward connections to its ethernet port while having NAT
  • Have the TP-Link ER706W router use the Raspberry Pi ethernet connection as the WAN gateway

The below configuration was applied to a Raspberry Pi 4B using Ubuntu 24.04.1 LTS.

Any Wi-Fi router should work here so I’ve kept the Wi-Fi router instructions here generalised.

Set up Port Forwarding

Ubuntu on the Raspberry Pi must be set up to allow port forwarding between network interfaces.

To configure, add the following to /etc/sysctl.conf

net.ipv4.ip_forward=1

Then apply the configuration:

sudo sysctl -p

Configure NAT at the Wi-Fi interface

In this setup, the Raspberry Pi connects to the Starlink Wi-Fi network and acts as a gateway for devices connected to the TP-Link router.

When devices behind the TP-Link router send traffic to the internet, NAT (Network Address Translation) on the Raspberry Pi changes their private IP addresses to the Raspberry Pi’s Wi-Fi IP address.

Add the required rules to iptables with:

# replace wlan0 with your wifi interface if it differs
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

With this configuration, the Starlink Wi-Fi network does not need to handle or deal with the TP-Link router network addresses at all.

Configure port forwarding between the Raspberry Pi interfaces

To forward traffic between the Raspberry Pi Wi-Fi interface and ethernet interface, add the required rules to iptables with:

# replace eth0 and wlan0 with your interface names if the names differ

# outbound forwarding
sudo iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT

# inbound forwarding
sudo iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT

Make all iptables changes persistent:

sudo apt install iptables-persistent

Set a static IP address for the ethernet interface

The ethernet interface needs to be configured with an IP address so it’s reachable as a gateway for the TP-Link router.

The Raspberry Pi ethernet interface and TP-Link router will share their own subnet, separate to the subnets used for the TP-Link router Wi-Fi network.

Here for example, I used:

  • 192.168.10.0/24 for the TP-Link router to Raspberry Pi ethernet network.
  • 192.168.10.10 for the Raspberry Pi ethernet interface IP address
  • 192.168.10.11 for the TP-Link IP address (configured under WAN settings)
  • 192.168.0.0/24 for the TP-Link router Wi-Fi network subnet

Ubuntu uses netplan to configure networking. Here’s a typical configuration for this purpose:

# /etc/netplan/01-network-config.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses:
        - 192.168.10.10/24
  wifis:
    wlan0:
      dhcp4: yes          
      access-points:
        "StarlinkSSID":   
          password: "YourWiFiPassword"  

Before applying the configuration, check for existing configuration. Ubuntu is frequently packages with /etc/netplan/50-cloud-init.yaml for cloud init, which is a tool used to configure cloud instances or virtual machines during their first boot.

If that cloud init config exists, read the instructions within the /etc/netplan/50-cloud-init.yaml file for steps on how to disable it.

Configuration can be applied with:

sudo netplan apply

Configure the TP-Link router to use the Rasberry Pi as a gateway

The TP-Link router can now use the Raspberry Pi as a gateway. Under the WAN settings for the WAN port that connects to the Raspberry Pi, I used the following configuration:

IP Address (of TP-Link router): 192.168.10.11

Subnet Mask: 255.255.255.0

Default Gateway (the Raspberry Pi): 192.168.10.10

Primary DNS: 8.8.8.8

Secondary DNS: 8.8.4.4

DNS is set here because the Raspberry Pi hasn’t been configured to handle DNS requests. Any devices that are connected to the TP-Link Wi-Fi (as their default gateway), will use the DNS specified here.

Devices connected to the TP-Link router wireless (or wired) network should now be able to access the internet.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *