IP address is
192.168.43.1 by default and there is no option to change it permanently. Is it possible to change it without root access?
My phone is Huawei Android 5.1.
Before Android Pie, tethering IP (
192.168.43.1) was hard-coded (1, 2). But now it's randomized on each session(3). You can use Android's builtin
ip command to set a fixed IP address but it requires root access:
~# ip address add 192.168.43.100/24 dev wlan0
del to delete.
Make sure the name of your Wi-Fi interface (
wlan0 usually). Check with
ip link or
Now there comes two problems:
/data/misc/dhcp/dnsmasq.leases) by DHCP server (
dnsmasqup to Pie) from DHCP range (
192.168.43.254by default) (4). Since the range is hard coded, you either need to replace
/system/bin/dnsmasqwith a shell script to change
--dhcp-range=(5) option before starting DHCP server. Or use
/etc/dnsmasq.confto assign fixed IP's only (6).
A simple solution to both of the above problems is to occupy the desired IP soon after tethering is turned ON. We can use an
init trigger to achieve this. Add these lines to
(/vendor)/etc/init/hostapd.android.rc file (or any
.rc file under
on property:init.svc.hostapd=running exec - -- /system/bin/sleep 2 exec u:r:magisk:s0 -- /system/bin/ip address add 192.168.43.100/24 dev wlan0
hostapd is the system service which manages access points.