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.
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It only takes a minute to sign up.Sign up to join this community
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 an additional 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) is correct. 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 (as explained here) to change
--dhcp-range=(5) option before starting DHCP server. Or use
/etc/dnsmasq.confto assign fixed IP's only (6) (as explained here).
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.
* Service uses Magisk's SELinux context assuming that device is rooted with Magisk.
netstat to make sure that DHCP server is listening on reserved IP address (or on all IP addresses i.e.
0.0.0.0) so that to avoid IP address collision.