Change Android Hostname

Change Android Hostname

This article about changing your android device’s hostname on a network. Android device on the network act like a PC which has its own hostname. You can change your computer hostname simply by using System Properties on the computer. So, how about your android device? So this post will describe how to change android device name or hostname on wifi network.

If you have no idea what hostname do on the network, take a look below. By default, your android hostname will look like this:

android_xxxxx

xxxxx is some number.

Below is a picture of your hostname on router

Android Hostname on Router

 

Now we want to change the hostname directly on the phone. First thing first, we look at the requirement before you can change hostname on your phone.

1. Your android device or phone must be rooted. Take a look at this article if you have no idea what rooting is.

2. Your phone do have android terminal application such as connectbot installed. You can simply download such application from android market on your phone also known as Play Shop or Google Play right now.

 

After you meet all the requirements above, now we can start changing your android device hostname. But before that, you might want to see your default android device hostname. So here we goes.

Open the terminal application, type these commands:

$ su
# getprop net.hostname

the default or preset hostname will be displayed.

Check Android Hostname

 

Now to change the hostname, type this command

# setprop net.hostname NewHostname

NewHostname is the hostname that you want to give for the android device

Change Android Hostname

Yes you are done.

 

You may type again the command below just to confirm your android device hostname has been changed

# getprop net.hostname

Check Android Hostname

Well, if you use busybox, the command will be as simple as

hostname NewHostname

 

However, the new hostname will change back to default once you reboot your android device or phone. So you must repeat the procedure above to change back your phone hostname

So, the question will be if there is any permanent option to change the hostname on Android Device. One of the option is by using custom rom such as cyanogenmod.

That’s All. Thank You.

Sharing is Caring

16 thoughts on “Change Android Hostname”

  1. Great. This was just what I was looking to do. I think we could put an init.d script to change the hostname during boot. It’s an ugly hack but should do the job.

  2. I added the command to the bottom of /system/etc/init.d/90userinit and the hostname is set on boot. 🙂

      1. I have Rooted Galaxy S3 with root Explorer installed.

        init.d folder is missing from /system/etc
        Could you please suggest? Should i make one such folder and then a file (90userinit) within it with the commands
        # su
        # setprop net.hostname

  3. I kinda wonder why Google don’t want us messing with the hostname. I’m sure a lot of people finds it useful to have hostnames on the network that they can actually recognize.
    Imagine a company with WiFi access for all company-issued phones (Android ofc).
    android-oafnouih398
    android-io3ru289021
    android-205ujrwf0ps

    The list goes on… Hmm 50 of these, spot the non-company phone you say?..

    1. Probably because da Google-Buttheads think: “Oh my, our users are so stupid, they will brick anything if we give them a chance. If we gave ’em root, they would delete some system-files right away, if we let them change their devices hostname, *some brainless blahblah here*…” Meh, just fuck it. It’s annoying, but GAH! Whatever….

  4. just add this line to the bottom of build.prop…

    net.hostname=mydevicename

    …save + reboot = done
    that will take care of permanently keeping the name even after a reboot.

  5. I have a rooted i9000 Galaxy S running CyanogenMod 9.1 which includes Busybox.

    The suggested Busybox command didn’t work, but:

    su
    setprop net.hostname myname-Galaxy-S (or similar name)

    works, however on reboot it’s replaced by the standard ‘android-mac-address’ hostname.

    I used ES File Explorer with superuser rights to edit /system/build.prop and save the changes, adding the following line:

    net.hostname=myname-Galaxy-S

    There are only alphabetic characters and minus signs, which should be allowed, and the length is no more than 13 characters, yet when I check after booting, the router’s management screen shows a ‘*’ for the phone’s hostname and net.hostname when I type:

    su
    getprop net.hostname

    on the terminal returns a blank line.

    I can restore the original behaviour ‘android-xxxx’ by removing the net.hostname line from build.prop, but I’m puzzled why it isn’t working. I’ve tried without minus signs, without caps, and without either, but it doesn’t make a difference.

    It is responding to the line as it blanks the hostname, but won’t accept the new name.

    Does anyone have any ideas what’s going wrong?

  6. I’ve found a way to do it in newer Android (tested on 4.0.4 and 4.2.2) and is placing the command setprop net.hostname at the bottom of /system/etc/init.goldfish.sh

    1. >they have app that does it
      > works great “change hostname root”
      > tested it reboot hostname sticks

      *WHO* has this app
      *WHAT is it called?

      without full information the post is useless (and annoying)

Leave a Reply

Your email address will not be published. Required fields are marked *