[Q] How do I set the hostname?

viva.fidel

Senior Member
Aug 27, 2010
410
48
0
London
How do I manually assign my phone a hostname on my wlan?

I've gone through all the other threads on XDA but none seem to actually work.

I've tried setprop net.hostname galaxys2

(can check this with getprop net.hostname)

and I've edited system/etc/dhcpcd/dhcpcd.conf and added hostname galaxys2 and ddns-hostname galaxys2

but still no result, anyone got any ideas?
 

desean

Senior Member
Oct 29, 2008
364
214
0
this works for me. just add the below to the end of system/etc/dhcpcd/dhcpcd.conf

Code:
# custom hostname
hostname CHANGETHISTOSOMETHINGELSE
obviously, change the part "CHANGETHISTOSOMETHINGELSE" to the descriptive hostname that you want :D

note: make sure the file permission remains the same as before
 

darkmax1974

Senior Member
Sep 1, 2010
209
15
0
this works for me. just add the below to the end of system/etc/dhcpcd/dhcpcd.conf

Code:
# custom hostname
hostname CHANGETHISTOSOMETHINGELSE
obviously, change the part "CHANGETHISTOSOMETHINGELSE" to the descriptive hostname that you want :D

note: make sure the file permission remains the same as before
Thanks. That's exactly what I wanted.
 

deed02392

Member
Jul 29, 2011
24
3
0
can you tell me more how tho chang the dhcpcd.conf file, i try to use terminal, but the VI command was not found.
Remember it's case sensitive. The exact steps I just followed are as follows:

1. Install Dropbear SSH server. (Needs root)
2. SSH in (I use puttytray on Windows) and login as root (password given in Dropbear)
3. `mount -o rw,remount /system` to make the conf file writeable
4. `vi /system/etc/dhcpcd/dhcpcd.conf`
5. Hit 'I' to enter input mode. Scroll down to the last line and type 'hostname Georges-GSII'
6. Press 'Esc' to exit input mode, then type ':w' and ':q'. It should NOT give an error saying the file is read only.
7. `mount -o ro,remount /system` to mount it read only as it should be
8. Stop the SSH server and restart wifi (just turn it off and on again)

Voila.
 

jijus

Senior Member
Nov 16, 2010
57
15
0
Lexington
Remember it's case sensitive. The exact steps I just followed are as follows:

1. Install Dropbear SSH server. (Needs root)
2. SSH in (I use puttytray on Windows) and login as root (password given in Dropbear)
3. type `mount -o rw,remount /system` press enter to make the conf file writeable
4. type `vi /system/etc/dhcpcd/dhcpcd.conf`press enter
5. Hit 'I' to enter input mode. Scroll down to the last line and type 'hostname Georges-GSII'
6. Press 'Esc' to exit input mode, then type ':w' press enter and type ':q'. press enter It should NOT give an error saying the file is read only.
7. type `mount -o ro,remount /system` press enter to mount it read only as it should be
8. Stop the SSH server and restart wifi (just turn it off and on again)

Voila.
dhcpcd.conf has new entry, hostname Nexus but still host name is androidthensumnumber ....so the above did not work for me
 
Last edited: