Does hosts file exist on the iPhone? How to change it?
I just edited my iPhone's 'hosts' file successfully (on Jailbroken iOS 4.0).
- Installed OpenSSH onto iPhone via Cydia
- Using a SFTP client like FileZilla on my computer, I connected to my iPhone
- Address: [use your phone's IP address or hostname, eg.
simophone.local
] - Username:
root
- Password:
alpine
- Address: [use your phone's IP address or hostname, eg.
- Located the
/etc/hosts
file - Made a backup on my computer (in case I want to revert my changes later)
- Edited the hosts file in a decent text editor (such as Notepad++). See here for an explanation of the hosts file.
- Uploaded the changes, overwriting the hosts file on the iPhone
The phone does cache some webpages and DNS queries, so a reboot or clearing the cache may help. Hope that helps someone.
Simon.
Not programming related, but I'll answer anyway. It's in /etc/hosts
.
You can change it with a simple text editor such as nano
.
(Obviously you would need a jailbroken iphone for this)
Another option here is to have your iPhone connect via a proxy. Here's an example of how to do it with Fiddler (it's very easy):
http://conceptdev.blogspot.com/2009/01/monitoring-iphone-web-traffic-with.html
In that case any dns lookups your iPhone does will use the hosts file of the machine Fiddler is running on. Note, though, that you must use a name that will be resolved via DNS. example.local
, for instance, will not work. example.xyz
or example.dev
will.
This doesn't directly answer your question, but it does solve your problem...
What make of router do you have? Your router firmware may allow you to set DNS records for your local network. This is what I do with the Tomato firmware