原创 2010年10月24日 00:23:00

通过ubuntu等Linux系统都是通过resolve.conf文件进行域名解析的,通过man resolve.conf可以查看到:


The  resolver is a set of routines in the C library that provide access to the Internet Domain Name System (DNS).  The  resolver  configuration file  contains  information  that  is read by the resolver routines the first time they are invoked by a process.  The file is designed  to  be human readable and contains a list of keywords with values that provide various types of resolver information. If this file doesn't exist the only name server to be queried  will  be       on  the  local machine; the domain name is determined from the hostname and the domain search path is constructed from the domain name.



NS resolver:
  Bionic uses a NetBSD-derived resolver library which has been modified in the following ways:
     - don't implement the name-server-switch feature (a.k.a. <nsswitch.h>)
     - read /system/etc/resolv.conf instead of /etc/resolv.conf
     - read the list of servers from system properties. the code looks for 'net.dns1', 'net.dns2', etc.. Each property should contain the IP address of a DNS server.
       these properties are set/modified by other parts of the Android system (e.g. the dhcpd daemon).
       the implementation also supports per-process DNS server list, using the properties 'net.dns1.<pid>', 'net.dns2.<pid>', etc... Where <pid> stands for the numerical ID of the current process.
     - when performing a query, use a properly randomized Query ID (instead of a incremented one), for increased security.
     - when performing a query, bind the local client socket to a random port for increased security.
     - get rid of *many* unfortunate thread-safety issues in the original code
  Bionic does *not* expose implementation details of its DNS resolver; the content of <arpa/nameser.h> is intentionally blank. The resolver implementation might change completely in the future.



通过adb shell中通过getprop查看属性,确实有net.dns1、net.dns2以及wifi中的net.tiwlan0.dns1以及net.tiwlan0.dns2,移动网络中的net.rmnet0.dns1以及net.rmnet0.dns2等属性。


Android 域名解析为IP的方法

Android域名解析为IP的方法 try{   InetAddress x ="ww...
  • cnicfhnui
  • cnicfhnui
  • 2016-03-31 21:11:14
  • 5219


1. Change of Android4.3 在Android4.3以前,如果系统需要备份/恢复,防火墙以及DNS解析管理,Linux内核微调等,是需要ROOT权限才能进行的。在Andro...
  • insswer
  • insswer
  • 2013-12-17 20:14:39
  • 13940

dns工作过程及原理 (linux dns及android dan的实现差异)

dns原理、dns工作过程、dns的实现、linux dns配置原因、android dns的实现框图。 前言本文分析dns工作过程及原理,给一个简单的dns实现代码流程,并针对linux及andro...
  • zjli321
  • zjli321
  • 2017-01-10 18:38:38
  • 2447


原文链接 当服务端IP变化,大量用户还是访问的以前的IP,连接不上服务器。   我们的客户端软件如何...
  • zhyj9493352669
  • zhyj9493352669
  • 2014-01-04 11:02:45
  • 6010

android dns解析

netbsd( server : (system_property)[dhcp.wlan0.dns1]: [
  • tuhuolong
  • tuhuolong
  • 2015-06-14 15:31:25
  • 2043

Android DNS 代码分析

Android DNS 代码都在bionic/libc/netbsd中 (虽然netbsd 是个废弃的项目,但dns功能部分代码被 Android用上了) netbsd 代码晦涩难懂,只有一边写程序,...
  • span76
  • span76
  • 2014-11-25 11:32:14
  • 7859

Android网络设置(route & DNS)

route设置android4.4只使用了一份路由表,使用busybox route就可以完成路由表的设置,从android5.0之后,考虑要对多网络的支持,采用了多路由表,下面的设置方法只适用于an...
  • iampisfan
  • iampisfan
  • 2016-04-01 21:28:22
  • 8149

Android okhttp3 DNS 底层实现追踪(二)

在《Android okhttp3 DNS 底层实现追踪(一)》中分析了okhttp3的DNS从framework通过jni到libc的过程,止步于getaddrinfo。在getaddinfo中,D...
  • hello2mao
  • hello2mao
  • 2016-11-14 22:21:33
  • 1236

[转]Android DNS 代码分析

转自: DNS 代码都在bionic/libc/netbsd中(虽然netbsd ...
  • dahailantian1
  • dahailantian1
  • 2017-11-20 17:43:36
  • 298

最全面的 DNS 原理入门

DNS 是互联网核心协议之一。不管是上网浏览,还是编程开发,都需要了解一点它的知识。   本文详细介绍DNS的原理,以及如何运用工具软件观察它的运作。我的目标是,读完此文后,你就能完全理解DNS。 ...
  • ceshi986745
  • ceshi986745
  • 2016-06-30 08:58:49
  • 8995