I use my phone as an extended display with x11vnc, which works as intended. The only issue is, that I have to change the IP address on the VNC client on my phone, very often. Because of dynamic DHCP, I suppose. I use a Motorola g Turbo Lineage OS 7.1.2, rooted.

Is Android capable of IP reservation? It basically assigns IP address and hostname depending on the MAC address. Or something that achieves the same.


Is it possible to assign new static lease through an ADB command immediately?


1 Answer 1


Android uses dnsmasq as its DHCP/DNS server (up to Pie). So create the configuration file /etc/dnsmasq.conf with option dhcp-host=<MAC>,<IP> (1).

Root is required to place this file. Since /etc is a symlink to /system/etc, /system partition needs to be mounted R/W. Make sure you don't break dm-verity if enabled on your device.

Set permissions:

~# chown 0.0 /etc/dnsmasq.conf
~# chmod 0644 /etc/dnsmasq.conf
~# chcon u:object_r:system_file:s0 /etc/dnsmasq.conf

SELinux rules also need to be defined if status is enforcing. Use Magisk's suploicy or some other similar tool like sepolicy-inject:

allow dnsmasq system_file file { read getattr open }
allow dnsmasq system_file dir { search }

Is it possible to assign new static lease through an ADB command immediately?

No, you need to modify configuration file and restart the dnsmasq server (switch Hotspot OFF and ON) for changes to take effect.

  • 1
    what about android q? Jun 18, 2020 at 10:17
  • 1
    @HakunaMatata too lazy to test so far. Will update. Jun 18, 2020 at 10:19
  • 1
    Because dnsmasq has been deleted. Jun 18, 2020 at 11:04
  • and what Android uses instead of dnsmasq? Nov 16, 2021 at 21:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .