Turn Your Android Phone into a Wi‑Fi Repeater Using Termux

17 min read Learn step‑by‑step how to use Termux and hostapd to make any Android device act as a Wi‑Fi repeater without rooting, complete with troubleshooting tips. September 28, 2026 04:30 How to Turn an Android Phone into a Wi‑Fi Repeater with Termux (No Root)

Many Android users have a single Wi‑Fi network but need to extend its reach to a nearby room, a garden, or a second device that only supports Wi‑Fi. While the built‑in hotspot feature can share mobile data, it cannot rebroadcast an existing Wi‑Fi connection. This tutorial shows how to turn an Android phone into a true Wi‑Fi repeater – a device that receives a Wi‑Fi signal and re‑emits it on a different SSID – using only free tools from the Play Store and the command line. No root access is required, but the method does rely on Termux, hostapd, and dnsmasq, all of which run in user space.

Before You Start

  • Device requirements: Android 8.0 (Oreo) or newer. The phone must support simultaneous Wi‑Fi client and AP mode (often called "Wi‑Fi tethering" or "Wi‑Fi sharing"). Most recent Pixel, Samsung, OnePlus, and Xiaomi models support this, but some low‑end devices may not.
  • Battery: Running an AP continuously drains power quickly. Keep the phone plugged into a charger or use a high‑capacity power bank.
  • Data plan: The repeater only forwards traffic; it does not consume mobile data. However, any device that connects through the repeater will use the original Wi‑Fi network’s bandwidth.
  • Network permissions: You will need to grant Termux access to location (required for Wi‑Fi scanning) and to the “Modify system settings” permission so it can change network interfaces.
  • Backup: The steps modify network settings but do not touch user data. Still, a quick backup via adb backup or your preferred method never hurts.

Step 1 – Install Termux and Prepare the Environment

  1. Open the Google Play Store (or F-Droid for a privacy‑focused build) and install Termux.
  2. Launch Termux. The first launch will download additional data; allow it to complete.
  3. Update the package repository and upgrade existing packages:
    pkg update && pkg upgrade -y
  4. Install the core utilities we will need:
    pkg install -y git wget proot-distro iproute2 iputils nano
    Explanation: iproute2 provides the ip command for interface configuration, while iputils gives us ping for testing connectivity.

Step 2 – Install hostapd and dnsmasq Inside Termux

Both hostapd (the Access Point daemon) and dnsmasq (a lightweight DHCP/DNS server) are not available in the default Termux repository, but they can be compiled from source or installed via a pre‑built package repository. The simplest approach is to use the termux-apt-repo community repo.

  1. Add the community repository:
    pkg install -y root-repo
    Note: This repo does not require root; it merely provides extra binaries.
  2. Install hostapd and dnsmasq:
    pkg install -y hostapd dnsmasq
  3. Verify the binaries are present:
    which hostapd
    echo $?
    which dnsmasq
    Both commands should output a path like /data/data/com.termux/files/usr/bin/hostapd.

Step 3 – Connect to the Source Wi‑Fi Network

The phone must first act as a normal Wi‑Fi client to the upstream network you want to repeat.

  1. Open Android Settings → Network & internet → Wi‑Fi.
  2. Select the desired network, enter the password, and confirm you have internet access (e.g., open a web page).
  3. Return to Termux and confirm the interface name (usually wlan0) and its IP address:
    ip addr show wlan0
    You should see an inet line like 192.168.1.45/24.

Step 4 – Create a Dedicated Interface for the Repeater AP

Android’s Wi‑Fi chipset can create a virtual interface for the AP while keeping the client interface active. We will ask hostapd to create this virtual interface.

  1. Create a configuration file for hostapd. In Termux, run:
    nano ~/hostapd.conf
    Paste the following (replace MyRepeater and yourpassword with your desired SSID and passphrase):
    interface=wlan0
        driver=nl80211
        ssid=MyRepeater
        hw_mode=g
        channel=6
        wmm_enabled=1
        macaddr_acl=0
        auth_algs=1
        ignore_broadcast_ssid=0
        wpa=2
        wpa_passphrase=yourpassword
        wpa_key_mgmt=WPA-PSK
        wpa_pairwise=TKIP
        rsn_pairwise=CCMP
    Why these settings? driver=nl80211 works with most modern chipsets. hw_mode=g limits to 2.4 GHz, which is universally supported. Adjust channel if the upstream network uses the same channel to avoid interference.
  2. Start hostapd in the background:
    hostapd ~/hostapd.conf -B
    The -B flag daemonises the process. If you see Failed to start driver nl80211, your device likely does not support simultaneous client+AP mode.
  3. Verify the AP interface appears:
    ip link show wlan0
    You should see state UP and a new AP flag.

Step 5 – Set Up DHCP and DNS with dnsmasq

Clients that connect to the repeater need IP addresses and a way to resolve DNS. dnsmasq handles both.

  1. Create a dnsmasq configuration file:
    nano ~/dnsmasq.conf
    Paste the following (the dhcp-range uses a separate subnet to avoid clashes with the upstream network):
    interface=wlan0      # Listen only on the AP interface
        dhcp-range=192.168.50.10,192.168.50.100,12h
        dhcp-option=3,192.168.50.1   # Default gateway for clients
        dhcp-option=6,8.8.8.8,8.8.4.4   # Google DNS as fallback
        bind-interfaces
  2. Assign a static IP to the AP interface that matches the dhcp-option=3 gateway:
    ip addr add 192.168.50.1/24 dev wlan0
    Why? The repeater acts as a router for the downstream devices, so it needs its own address on that subnet.
  3. Start dnsmasq:
    dnsmasq -C ~/dnsmasq.conf -d &
    The -d flag runs it in the foreground; the trailing & puts it in the background.
  4. Check that dnsmasq is listening:
    netstat -tulnp | grep dnsmasq
    You should see a line with 0.0.0.0:53 bound to the dnsmasq process.

Step 6 – Enable IP Forwarding and NAT

Now the phone must forward packets from the AP subnet (192.168.50.0/24) to the upstream Wi‑Fi interface (e.g., 192.168.1.0/24).

  1. Enable IPv4 forwarding for the current session:
    sysctl -w net.ipv4.ip_forward=1
  2. Set up a NAT rule with iptables so that traffic appears to come from the phone’s upstream IP:
    iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
    Note: The -o wlan0 flag refers to the *client* side of the same physical interface. On devices where the virtual AP appears as wlan0 as well, the rule still works because NAT is applied to packets leaving the interface.
  3. Allow forwarding from the AP subnet to the client interface:
    iptables -A FORWARD -i wlan0 -o wlan0 -j ACCEPT
    iptables -A FORWARD -i wlan0 -o wlan0 -m state --state ESTABLISHED,RELATED -j ACCEPT
  4. Save the iptables rules for the current session (they will disappear after reboot). To persist them across reboots you would need a script launched by Termux’s termux-wake-lock or a third‑party app; this tutorial covers a one‑session setup.

Step 7 – Verify the Repeater Is Working

  1. On a second device (another phone, tablet, or laptop), scan for Wi‑Fi networks. You should see the SSID you defined (MyRepeater).
  2. Connect using the passphrase you set. Once connected, the device should obtain an IP in the 192.168.50.x range.
  3. Open a browser and navigate to any website. If the page loads, the repeater is forwarding traffic correctly.
  4. To confirm traffic routing, run a ping from Termux:
    ping -c 4 8.8.8.8
    You should see replies. Then, on the downstream device, ping the same address to verify end‑to‑end connectivity.

Alternative: Using Android’s Built‑In Wi‑Fi Sharing (If Available)

Some OEM skins (e.g., Samsung One UI) expose a “Wi‑Fi sharing” toggle that automatically creates a repeater without any command‑line work. If you find that option in Settings → Connections → Wi‑Fi → Wi‑Fi sharing, you can skip the entire Termux procedure. However, the built‑in feature often lacks fine‑grained control over DHCP range and may not work on all devices, which is why the Termux method remains valuable.

Troubleshooting Common Issues

Warning: Changing network settings can temporarily disconnect you from the internet. Keep a second device handy to re‑enter settings if needed.

1. AP Not Visible

  • Ensure the device supports concurrent client+AP mode. Run iw list | grep \*\*\* (if iw is installed) and look for “valid interface combinations”. If you only see “#interfaces=1”, the hardware cannot act as a repeater.
  • Check the hostapd.conf channel. If the upstream network uses the same channel, change channel=6 to a free channel (1‑11). Overlapping channels can cause the AP to be hidden.
  • Restart hostapd: pkill hostapd && hostapd ~/hostapd.conf -B.

2. Clients Get IP but Cannot Reach the Internet

  • Confirm NAT is active: iptables -t nat -L -n -v. Look for a rule with MASQUERADE targeting wlan0.
  • Verify IP forwarding is still enabled: cat /proc/sys/net/ipv4/ip_forward should output 1.
  • Check DNS: If browsers report “cannot resolve host”, try setting the client’s DNS manually to 8.8.8.8 or 1.1.1.1. Mis‑configured dhcp-option=6 in dnsmasq.conf is a frequent cause.

3. Hostapd Fails to Start with "nl80211 not found"

  • Some devices expose the Wi‑Fi driver under a different name (e.g., wlan1). Edit hostapd.conf and replace interface=wlan0 with the correct interface name, which you can discover via ip link.
  • If the driver truly lacks nl80211, the hardware cannot be used for AP mode without root-level driver patches – in that case, the method is not viable on that device.

4. Battery Drains Quickly

  • Running an AP continuously keeps the radio in high‑power mode. Enable Android’s built‑in battery saver while the repeater is active, or set a timer to stop the services after a set period:
    sleep 7200 && pkill hostapd && pkill dnsmasq && ip link set wlan0 down
  • Consider using a USB‑powered power bank to keep the phone charged.

5. Repeater Stops After Screen Locks

  • Termux processes stop when the app is swiped away or when Android kills background processes. Install the Termux:Boot add‑on and create a script in ~/.termux/boot that restarts hostapd, dnsmasq, and iptables on boot.
  • Alternatively, enable a wake lock:
    termux-wake-lock
    This keeps the CPU awake while the screen is off.

Safety and Privacy Considerations

  • Open vs. WPA2: Always use wpa=2 with a strong passphrase. An open repeater exposes any nearby device to your upstream network, which can be a security risk.
  • Data Usage Monitoring: Since the repeater forwards all traffic, any device that connects can consume bandwidth on the upstream network. Keep an eye on your router’s usage stats if you have a limited plan.
  • Legal Restrictions: Some public Wi‑Fi networks prohibit rebroadcasting. Verify the terms of service before extending a commercial hotspot.

Cleaning Up – How to Stop the Repeater

  1. Terminate hostapd and dnsmasq:
    pkill hostapd
    pkill dnsmasq
  2. Remove the static IP from the interface:
    ip addr del 192.168.50.1/24 dev wlan0
  3. Flush the NAT rule:
    iptables -t nat -D POSTROUTING -o wlan0 -j MASQUERADE
  4. Disable forwarding (optional):
    sysctl -w net.ipv4.ip_forward=0
  5. Turn off the screen lock wake lock if you enabled it:
    termux-wake-unlock

Wrap‑Up

By following the steps above, you have turned an ordinary Android phone into a functional Wi‑Fi repeater without rooting. The solution leverages Termux’s Linux‑like environment, hostapd for the access point, dnsmasq for DHCP/DNS, and standard iptables NAT to bridge traffic. While the method requires a device that supports concurrent client and AP modes, it offers fine‑grained control over channels, security, and DHCP ranges—features not available in the stock hotspot.

Keep the troubleshooting section handy, especially the checks for driver support and NAT configuration. With a little practice, you can adapt the same workflow to create a captive‑portal hotspot, a guest network, or even a small offline LAN for local file sharing.

User Comments (0)

Add Comment
We'll never share your email with anyone else.