Hi, Empson and BERNON
Thank you very much for your reply!
Though DHCP server did not offer the DNS server IP adress, it offer the 
gateway. In most case, I think we can use gateway as our DNS server. If we need 
some host's IP address, just send the DNS request to the gateway. May be 
gateway has an DNS server address. (I am not sure if it will go on send request 
to its own gateway when it doesn't have a DNS server's IP.)
I have tested this case in my network. I get the host's IP by set the DNS 
server as default "inet_addr("208.67.222.222") /* resolver1.opendns.com */" or 
my gateway. 
It worked OK.

Thanks to Empson again!
Your explanation are very deep and clear. I think I have understand. May be 
Auto IP is a good choice for me. In fact I will build a network without a DHCP 
host, and they need to have IP address.

Best Regards!
HuangZhenhua
 






2008-11-13



发件人: David Empson
发送时间: 2008-11-13 06:19:12
收件人: Mailing list for lwIP users
抄送: 
主题: Re: [lwip-users] How can I get a DNS Server IP automatically

HuangZhenhua [EMAIL PROTECTED] wrote:
> Another question, What is the difference between DHCP and AutoIP?

DHCP involves a server supplying the client with an IP address, subnet mask, 
gateway and other configuration parameters (e.g. DNS is almost always 
supplied). The client may supply an identification string. The server is 
responsible for picking the appropriate IP address, which it might do by 
allocating from a pool of available addresses, or assigning a fixed address 
based on the client's ID or MAC address.

AutoIP (also known as APIPA for "Automatic Private IP Addressing") is a 
mechanism where a device assigns itself a random IP address from a particular 
range reserved for AutoIP (169.254.0.0/16). No server is involved.The subnet 
mask used is always 255.255.0.0, there is no gateway, and it doesn't have any 
other configuration parameters such as DNS.

After picking a random AutoIP address, the device polls the network to check 
whether that address is already in use by something else. If it is, then the 
device picks another random IP address and tries again.

AutoIP is often used in ad hoc networks which are temporarily set up between 
two or more devices, e.g. you could use it when you plug a laptop into an 
embedded device via a direct Ethernet cable. If both devices use AutoIP then 
they will be able to talk to each other. Actually finding each other may 
require something like sending a broadcast ping, or using a name-based service 
advertising and discovery protocol like SLP, NetBIOS or Apple's Bonjour 
(multicast DNS, with DNS service discovery).

http://en.wikipedia.org/wiki/Zeroconf has a good overview.
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to