5

I can edit all the crucial aspects of my hotspot/router within the setup options for the hotspot/router configuration.

I am confused as to how the DHCP works when using up the Android phone as a wireless hotspot/router and wanted to figure that out.

One of my attempts to get this information for myself was to try and navigate to 192.168.6.1 via a web browser - this is, of course, the phone's IP address. I was hoping to see some sort of router setup page as you would normally see when configuring a normal ethernet wired/wireless router via a web browser, but unfortunately, there was no such page.

I did some research and found out that you can get some basic information about the phone's IP configuration by downloading a terminal emulator and running a few basic *nix flavored commands.

I was looking for something more - a GUI would be excellent, but I'll take any suggestions on how to access the phone's routing configuration specs.

Is there any sort of "router setup page" that I can access when I enable my wireless hotspot on my Android phone?

migrated from superuser.com Jul 1 '13 at 14:11

This question came from our site for computer enthusiasts and power users.

  • 1
    See this answer — if you are using the builtin tethering support, there is no configuration, IP addresses used for Wi-Fi hotspot and USB tethering are hardcoded. – Sergey Vlasov Jul 24 '13 at 13:17
2

The Android builtin wifi tethering is designed to use 192.168.43.1/24 as the server, with netd handling the tethering, using dnsmasq. First DNS range is 192.168.42.1-254 and and 2nd DNS range is 192.168.43.1-254.

Netd is not easy to change. It requires a socket to communicate with it, and that socket is taken when android starts tethering. But going through the source files for Tethering.java (I used Froyo) we see:

// usb client will be provided 192.168.42.129
private static final String USB_NEAR_IFACE_ADDR      = "192.168.42.129";
private static final String USB_NETMASK              = "255.255.255.0";

// FYI - the default wifi is 192.168.43.1 and 255.255.255.0

private String[] mDhcpRange;
private static final String DHCP_DEFAULT_RANGE1_START = "192.168.42.2";
private static final String DHCP_DEFAULT_RANGE1_STOP  = "192.168.42.254";
private static final String DHCP_DEFAULT_RANGE2_START = "192.168.43.2";
private static final String DHCP_DEFAULT_RANGE2_STOP  = "192.168.43.254";

And Later on we see those ranges used, AS BACKUPS.

    mDhcpRange = context.getResources().getStringArray(
            com.android.internal.R.array.config_tether_dhcp_range);
    if ((mDhcpRange.length == 0) || (mDhcpRange.length % 2 ==1)) {
        mDhcpRange = new String[4];
        mDhcpRange[0] = DHCP_DEFAULT_RANGE1_START;
        mDhcpRange[1] = DHCP_DEFAULT_RANGE1_STOP;
        mDhcpRange[2] = DHCP_DEFAULT_RANGE2_START;
        mDhcpRange[3] = DHCP_DEFAULT_RANGE2_STOP;
    }

The main source for the dhcp ranges is not the hardcoded 42 and 43, but read from array.config_tether_dhcp_range, an internal string array. But it is currently empty.

You could edit the android framework. On my phone, it is /system/framework/framework-res.apk. There are a ton of tutorials online for editing framework-res.apk, from simple strings to full theming. Find one for your phone and android version.

Main thing you want to change is the /res/values/arrays.xml

Look for <array name="config_tether_dhcp_range" />

Change to:

<string-array name="config_tether_dhcp_range">
     <item>192.168.x.y</item>
     <item>192.168.x.z</item>
</string-array>

compile/zip/sign as needed (follow a tutorial), then reinstall.

If you want more than one range, just copy the two items over and over. You always need to provide a start and a stop for each range. Try to keep it in the same /24, ie 192.168.50.5 and 192.168.50.99 or whatever. You can confirm it is working with busybox ps | grep dnsmasq or if you don't have busybox ps dnsmasq then use the pid in cat /proc/pid/cmdline. You should get (or similar):

/system/bin/dnsmasq --no-daemon --no-poll -no-resolv --dhcp-range=192.168.50.5,192.168.50.99,1h

FWIW, my WIFI tethering uses the default dnsmasq ranges, yet my computer was assigned 192.168.43.147/24 and gateway 192.168.43.1/24. Not sure why yours defaulted to a 42.x address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.