DNS

From WebOS Internals

Jump to: navigation, search

Contents

DNS

Description: The Palm Pre name resolver service / IP lookup

Overview:

The Palm Pre uses conventional DNS hostname look up methods., but there is a service to assign DNS depending on connection type, since the Pre can connect via Wifi, or instead over cellular networks. You can use OpenDNS and other DNS IPs instead, by editing resolv.conf and /etc/hosts file just like on a regular Linux system to specify and override the normal DNS IPs.

Details:

Using another DNS for All Lookups

  • You can use any DNS such as OpenDNS
  • Or look one up via any search engine
    • Caveat: Be careful to assign nameservers NOT too far away from you or your web experience will slow down... CDNs use your nameserver to determine what city you're in, and then web pages (and PALM downloads!) come from servers nearest to where they believe you are (by where your DNS is located.) ... about 40% of the overall internet is now delivered over CDNs so this is significant. This is why using the DNS assigned by your ISP is usually the best choice, since that is your 'point of entry' onto the internet backbone.
  • choose a DNS in your same city if possible
  • Or at least in your same region
  • If you are connecting via a VPN, then use a DNS IP in that city if possible - this is the point of your entry to the internet backbone

...you get the idea. Now on to HOW to do it:

Legacy Linux Method

  • Edit the file /etc/resolv.conf using vi from command line (or any other text editor.) Examples:
search somelocalhost
nameserver 208.67.220.220
nameserver 208.67.222.222
  • The above means that for a hostnamed "somelocalhost" look locally (on the Pre) for it, otherwise use the two nameservers by IP listed.


Change DNS depending on Current Connection

  • There is a Palm service to assign a DNS;
  • Which changes the resolver automatically depending on connection (wifi, EVD0 etc.)
  • I.e; Use dev cscotun0 and dev-type tun in the openvpn config

luna-send -n 1 palm://com.palm.netroute/addNetIf '{ "ifName": "cscotun0", "networkTechnology": "vpn", "networkScope": "wan", "ipv4": { "ip": "openvpn-addr", "netmask": "0xffffffff", "dns": [ "openvpn-dns" ] }, "networkUsage": [ "other" ], "domainsOnIfDns": [ "domain.com" ] }' 
  • This line wraps significantly - scroll right to see the entire line
  • For details, See the bottom this wiki page.


*For discussion, WebOS has several resolv.conf files - possibly rotates between them depending on connection?

/etc/resolv.conf 
/tmp/resolv.conf 
/var/run/resolv.conf
/var/run/ppp/resolv.conf

  • ToDo: - I'll test these out and paste report here. -FreeTim



Override DNS For One Particular Host Lookup

Spoofing

For testing, you can use /etc/hosts to override any hostname look up. This allows you to point "www.google.com" for example to a PARTICULAR IP instead of getting the currently assigned dynamic IP. This method, called spoofing , is useful for testing the Palm Pre against a particular server, which might be useful if you were logging on that server and looking for the hit.

  • Useful for testing AJAX calls against one single web server IP
  • Useful for running searches against one particular search server

Using vi, edit the file

/etc/hosts

  • The format of the file IP, followed by hostname.
  • The full hostname must be given, ie; google.com won't work, www.google.com will work.
  • No reboot or LUNA restart required...
  • Has PRIORITY - the 'hosts' file is checked on every single lookup, and since it's checked first in the chain, has the effect of "overriding" normal DNS lookup for that one hostname.
  • Example
2.2.2.44 www.somedomain.com
2.2.2.55 images.somedomain.com
  • No HTTP allowed in this file, no trailing slash - hostname only
  • When no longer needed you can store your entries for later re-use, and just comment out the lines by putting pound (#) as the first character on the line.
  • Test to see if this works, by using the Terminal and by using PING hostname, before and after your changes.
#2.2.2.44 www.somedomain.com
#2.2.2.55 images.somedomain.com
  • 'Spoofing' method only overrides the DNS lookup for the particular host listed in the /etc/hosts file - any other host lookup will work dynamically using the normal lookup resolver methods. If you are looking to change the way all hosts are looked up, then instead you should change the resolver using the methods near the top of this document.


.

Personal tools
Google AdSense